Here state variable will receive 5 bit value but inside a case statement checking with 2 bit and 4 bit value.
How the sv simulator will handle this. Will it truncate above 1 bit for (4’b1_1001) and 3 bit for (2’b1_0000).
Can you please anyone help me to understand this scenario.
5.7.1 Integer literal constants
If the size of the unsigned number is larger than the size specified for the literal constant, the unsigned number shall be truncated from the left.
state is a logic variable. Your statement states that , If we write 4’b1_1001, sv simulator will take LSB 4 bits as valid. will it omit the msb bit (1) to check.
State variable holds 5 bit value but inside a case, checking with 4 bit value.
Check will happen with 5 bit value or 4 bit value.
Is my understanding correct ? correct me If I am wrong.
The literal 4’b1_1001 is treated as if you wrote 4’b1001. When you compare a 5-bit operand (state[4:0]) to a 4-bit unsigned literal, the 4-bit literal gets zero-extended by one bit.