Guest
HI
We are forcing some wires in a design from our testbench. We read some
information from a file and force the wires depending on the data in
the file. When we have multiple force assignment within one simulation
delta using the same variable on the right hand side, the last value
seems to get applied to all the forces. I have created a small testcase
to show this. If you look at the simulation result it shows that the
initial assignments are ok, but when we went to the next simulation
time, all the values were overwritten by the last value. Looks like the
forces were initially executed but then reexecuted again when the
simulation time moved.
Has anyone else experinenced this? Is this the expected behavior of
verilog force statements? Or is this a bug in the simulator?
Thanks.
-Dipu
-------------verilog code-----------------
module temp(
);
wire [7:0] test1;
reg [7:0] test2;
reg [7:0] test3;
reg [7:0] dataval;
initial begin
force test1 = 0;
force test2 = 0;
force test3 = 0;
$display (" time %0t : test1 =%0d, test2=%0d, test3=%0d", $time,
test1, test2, test3 );
dataval = 8'd1;
force test1 = dataval;
$display (" time %0t : test1 =%0d, test2=%0d, test3=%0d", $time,
test1, test2, test3 );
dataval = 8'd2;
force test2 = dataval;
$display (" time %0t : test1 =%0d, test2=%0d, test3=%0d", $time,
test1, test2, test3 );
dataval = 8'd3;
force test3 = dataval;
$display (" time %0t : test1 =%0d, test2=%0d, test3=%0d", $time,
test1, test2, test3 );
#1;
$display (" time %0t : test1 =%0d, test2=%0d, test3=%0d", $time,
test1, test2, test3 );
#1;
end
endmodule
---------------------simulation result----------
time 0 : test1 =0, test2=0, test3=0
time 0 : test1 =1, test2=0, test3=0
time 0 : test1 =1, test2=2, test3=0
time 0 : test1 =1, test2=2, test3=3
time 1000 : test1 =3, test2=3, test3=3
-----------------------------------
We are forcing some wires in a design from our testbench. We read some
information from a file and force the wires depending on the data in
the file. When we have multiple force assignment within one simulation
delta using the same variable on the right hand side, the last value
seems to get applied to all the forces. I have created a small testcase
to show this. If you look at the simulation result it shows that the
initial assignments are ok, but when we went to the next simulation
time, all the values were overwritten by the last value. Looks like the
forces were initially executed but then reexecuted again when the
simulation time moved.
Has anyone else experinenced this? Is this the expected behavior of
verilog force statements? Or is this a bug in the simulator?
Thanks.
-Dipu
-------------verilog code-----------------
module temp(
);
wire [7:0] test1;
reg [7:0] test2;
reg [7:0] test3;
reg [7:0] dataval;
initial begin
force test1 = 0;
force test2 = 0;
force test3 = 0;
$display (" time %0t : test1 =%0d, test2=%0d, test3=%0d", $time,
test1, test2, test3 );
dataval = 8'd1;
force test1 = dataval;
$display (" time %0t : test1 =%0d, test2=%0d, test3=%0d", $time,
test1, test2, test3 );
dataval = 8'd2;
force test2 = dataval;
$display (" time %0t : test1 =%0d, test2=%0d, test3=%0d", $time,
test1, test2, test3 );
dataval = 8'd3;
force test3 = dataval;
$display (" time %0t : test1 =%0d, test2=%0d, test3=%0d", $time,
test1, test2, test3 );
#1;
$display (" time %0t : test1 =%0d, test2=%0d, test3=%0d", $time,
test1, test2, test3 );
#1;
end
endmodule
---------------------simulation result----------
time 0 : test1 =0, test2=0, test3=0
time 0 : test1 =1, test2=0, test3=0
time 0 : test1 =1, test2=2, test3=0
time 0 : test1 =1, test2=2, test3=3
time 1000 : test1 =3, test2=3, test3=3
-----------------------------------