Previous: , Up: Assignments   [Contents][Index]


25.8.2 Bit Assignments

Bit assignment statements have the form:

bconc_exp = exp

Where bconc_exp is an expression composed by bit-concatenation operators and operands that should be valid l-values themselves, and exp is an expression whose type must be integral and whose width must correspond exactly to the width of the integral type of bconc_exp.

For example, consider this code:

var a = 0UH;
var b = 0UH;

a:::b = 0xbeef;

The assignment above updates the value of the variable a to be 0xbeUH and the value of the variable b to be 0xefUH. Note how the signedness of bconc_exp and exp may differ.

Any valid l-value can be used as an operand of the bit-concatenation operators in bconc_exp. For example:

var a = [0UH,0UH];

a[0]:::a[1] = 0xbeef;

or, using struct fields:

type Foo = struct { uint<16> hi; uint<16> lo; };

var f = Foo {};
f.hi:::f.lo = 0xbeef;