Fix $urandom_range passed variable (#2563).

This commit is contained in:
Wilson Snyder 2020-09-22 08:44:51 -04:00
parent 7a9e79ea79
commit 0c49cca527
3 changed files with 6 additions and 1 deletions

View File

@ -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

View File

@ -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);
}

View File

@ -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;