In reply to dave_59:
In reply to sj1992:
That is a completely different question. The code you show works. You don’t even need a force/release statement. A simple procedural assignment to 0 would work. There must be something different in your environment than what you have shown.
I tried the below code but the signal remains X after the force and release statements
module top;
logic [2:0] signal = 1;
logic clk = 0;
always_comb begin
if (signal === 3'bxxx) begin
$display("signal is x at %0d", $realtime);
force signal = 0;
release signal;
$display("after release signal is: %0b at %0d", signal,$realtime);
end
end
initial begin
#2 signal = 'x;
#10 $display("calling finish");
$stop();
end
initial begin
clk = 0;
forever begin
#1 clk = ~clk;
end
end
endmodule