Skip to content

Casting

vctx is a strongly typed language. To convert between types (for example, from a register value to a boolean, or between integer widths), you use the as keyword.

expression as type

// Converting a u1 register to a boolean output
reg state: u1 = 0
led := state as bool
// Resizing logic (example generic usage)
wire foo: u16 = concat(0 as u4, val[11..0])