diff --git a/Changes b/Changes index b9724f83b..e28a62b48 100644 --- a/Changes +++ b/Changes @@ -11,6 +11,8 @@ The contributors that suggested a given feature are shown in []. Thanks! **** Fix -G dropping public indication (#2561). [Andrew Goessling] +**** Fix $urandom_range passed variable (#2563). [nanduraj1] + * Verilator 4.100 2020-09-07 diff --git a/src/V3Width.cpp b/src/V3Width.cpp index 79e7e3433..02e3ca90b 100644 --- a/src/V3Width.cpp +++ b/src/V3Width.cpp @@ -1123,6 +1123,8 @@ private: if (m_vup->prelim()) { nodep->dtypeSetUInt32(); // Says the spec AstNodeDType* expDTypep = nodep->findUInt32DType(); + userIterateAndNext(nodep->lhsp(), WidthVP(CONTEXT, PRELIM).p()); + userIterateAndNext(nodep->rhsp(), WidthVP(CONTEXT, PRELIM).p()); iterateCheck(nodep, "LHS", nodep->lhsp(), SELF, FINAL, expDTypep, EXTEND_EXP); iterateCheck(nodep, "RHS", nodep->rhsp(), SELF, FINAL, expDTypep, EXTEND_EXP); } diff --git a/test_regress/t/t_urandom.v b/test_regress/t/t_urandom.v index 3bb04f64f..3a894c6ae 100644 --- a/test_regress/t/t_urandom.v +++ b/test_regress/t/t_urandom.v @@ -35,7 +35,8 @@ module t(/*AUTOARG*/); // Range for (int test = 0; test < 20; ++test) begin - v1 = $urandom_range(0, 2); + v1 = 2; + v1 = $urandom_range(0, v1); if (v1 != 0 && v1 != 1) $stop; v1 = $urandom_range(2, 0); if (v1 != 0 && v1 != 1) $stop;