Hi Forum,
( A) I was trying the following code to calculate the bit length of an expression
The 1st initial block i1 has 6 $display statements where the intended output is observed in the last 4 $display statements.
(1) When we write 32’( i << j ) is the 32’ size cast applied to both operands or is it only i or j ?
(B) Return value of $bits.
As per LRM ::
$bits returns the number of bits required to hold an expression as a bit stream
Using the 2nd initial block i2 I am trying to understand the meaning of above quote
(2) When we write $bits(i << j), how is the return value calculated ?
(3) Why does $bits(32'(i << j)) give same output as $bits(32'(i) << j) or $bits(i << 32'(j)) ?
(4) When written in a conditional operation I observe different results with last 2 $display statements of i2, why is it so ?
(C) As per LRM binary operators + - have the same precedence.
Associativity for these operators is left to right.
What does the left to right mean here ?
For the following constraint expression A + B - C + D - E + F == Z
Does the quote imply that the calculation starts from leftmost variable i.e A ?
How would Z be calculated be in this case ?
Thanks