ivtest: Fix `assign` vs `initial` race condition in some tests
The first evaluation of an `assign` statement is scheduled at the same time as `initial` statements. There are some test cases that evaluate the result of an `assign` statement in an `initial` statement. This is an inherent race condition and might fail depending on the exact order of evaluation. To fix this add an additional delay in the `initial` block. This will make sure that all `assign` statements get fully resolved first. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
parent
192b6aec96
commit
9b1ac6ab50
|
|
@ -25,6 +25,7 @@ assign array6[2:1] = 8'h32;
|
||||||
reg failed = 0;
|
reg failed = 0;
|
||||||
|
|
||||||
initial begin
|
initial begin
|
||||||
|
#0
|
||||||
$display("%h", array1);
|
$display("%h", array1);
|
||||||
if (array1 !== 16'h4321) failed = 1;
|
if (array1 !== 16'h4321) failed = 1;
|
||||||
$display("%h", array2);
|
$display("%h", array2);
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ mod_test dut(test_string[1:8]);
|
||||||
mod_test2 dut2(test_string[9:16]);
|
mod_test2 dut2(test_string[9:16]);
|
||||||
|
|
||||||
initial begin
|
initial begin
|
||||||
|
#0
|
||||||
if(test_string !== "testTESTabcdefgh") begin
|
if(test_string !== "testTESTabcdefgh") begin
|
||||||
$display("FAILED");
|
$display("FAILED");
|
||||||
$finish();
|
$finish();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue