Assignment
The assignment statement assigns the value of an expression to a variable.
The bit width of the variable being assigned to will grow, if necessary, to accommodate the value being assigned.
If the expression being assigned has an explicit width (using the bit selection operator, for example) and the width of the variable assigned to is smaller than the width of the assigned value, then a compile time error will occur.
Example
INT tenBit WIDTH 10; INT tenBit2 WIDTH 10; INT twentyBit WIDTH 20; INT twentyBit2 WIDTH 20; // Initialise the variables to values that fit their widths tenBit := 0x3FF; twentyBit := 0xAAAAA; // Both variables retain their widths and take the value 0x3FF. // The top 10 bits of twentyBit2 are set to 0 twentyBit2 := tenBit; // tenBit2 increases in length to 20 bits and takes the value 0xAAAAA tenBit2 := twentyBit; // Trying to fit a 20 bit value into ten bits causes a compile time error tenBit2[9..0] := twentyBit;
XJTAG v4.2.5
