Say I have this module:
module Test(
input logic a,
output logic b
);
assign output = a ? 1'bZ : 1'b1;
endmodule;
Currently, when testing the module with a C++ testbench, the output of the simulation shows the High-Z state as 0 (I assume because Verilator models logic lines as integers).
Is there any capability to test whether a 0
is a numerical 0
or a High-Z?
-
\$\begingroup\$ Is case equality (===) something that can help with your problem? \$\endgroup\$Rajesh Shashi Kumar– Rajesh Shashi Kumar2019年04月27日 08:12:28 +00:00Commented Apr 27, 2019 at 8:12
-
\$\begingroup\$ I think verilator does not support X or Z \$\endgroup\$Rainb– Rainb2024年06月16日 08:37:44 +00:00Commented Jun 16, 2024 at 8:37
1 Answer 1
I don't think so. I believe you can write the expression b === 'bz
within your SystemVerilog code, and that returns true (1'b1
) within your code when b
should have had a z
state, but the actual output gets converted to a 0.