From 9b1ac6ab50adea75396dddfe8aae56e68a930fdc Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Sat, 23 Dec 2023 19:55:14 -0800 Subject: [PATCH] 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 --- ivtest/ivltests/br_gh497a.v | 1 + ivtest/ivltests/part_sel_port.v | 1 + 2 files changed, 2 insertions(+) diff --git a/ivtest/ivltests/br_gh497a.v b/ivtest/ivltests/br_gh497a.v index 33319f1a0..dbc5b6e0f 100644 --- a/ivtest/ivltests/br_gh497a.v +++ b/ivtest/ivltests/br_gh497a.v @@ -25,6 +25,7 @@ assign array6[2:1] = 8'h32; reg failed = 0; initial begin + #0 $display("%h", array1); if (array1 !== 16'h4321) failed = 1; $display("%h", array2); diff --git a/ivtest/ivltests/part_sel_port.v b/ivtest/ivltests/part_sel_port.v index 64e502b10..91fce2697 100644 --- a/ivtest/ivltests/part_sel_port.v +++ b/ivtest/ivltests/part_sel_port.v @@ -33,6 +33,7 @@ mod_test dut(test_string[1:8]); mod_test2 dut2(test_string[9:16]); initial begin + #0 if(test_string !== "testTESTabcdefgh") begin $display("FAILED"); $finish();