When executing the following piece of SystemVerilog code (compiled and run with Questa)
bit [7:0] test = 255;
$display("%b %b %b", test, test == 255, test == '1);
$display("%b %b %b", ~test, ~test == 0, ~test == '0);
$display("%b %b %b", 8'b00000000, 8'b00000000 == 0, 8'b00000000 == '0);
the output is
11111111 1 1
00000000 0 1
00000000 1 1
My question is about the 2nd number on the 2nd output line: How is binary 00000000
different from 0? And why is it only different if it is the result of ~test
, and not when it is a literal? Is this a Questa bug or a property of the language?