babaduredi
Member level 1

Hi,
While defining test case for a hardware, i had to use following in statement:
-8'd3;
Now this statement means -3 in decimal or 8-bit binary stored as 2's complement of binary 3, i.e 8'b1111_1101. Now when we write 8'b1111_1101, it can be -3 or (2^8)-3=253 in decimal. So how does compiler decide whether it's -3 or 253?
While defining test case for a hardware, i had to use following in statement:
-8'd3;
Now this statement means -3 in decimal or 8-bit binary stored as 2's complement of binary 3, i.e 8'b1111_1101. Now when we write 8'b1111_1101, it can be -3 or (2^8)-3=253 in decimal. So how does compiler decide whether it's -3 or 253?