Here is the example behavioral Verilog code in question
module constant;
reg [7:0] foo;
initial begin
foo = 1'bz;
$display("%H", foo);
end
endmodule
Icarus Verilog gave me
$ iverilog -o constant constant.v
$ ./constant
0Z
However, according to this website (and the lecturer of an FPGA course I am taking),
If number is smaller than the size constant, then it will be padded to the left with zeros. If the most significant bit of a specified number has an unknown (x) or high-impedance (z) value, then that value will be used to pad to the left.
In that case, the output should be ZZ
instead of 0Z
. I am pretty sure this is due to a change in the specification (maybe it's ZZ
in Verilog 1995 and 0Z
in Verilog 2001, or whatever), but what are the standards that result in each behavior? I have tried searching online for the specification, but they don't seem to be freely available, like this one which requires purchasing or a subscription.
As a bonus, where can I find a summary of changes across various specifications of Verilog?