Fix $urandom_range with no second argument

This commit is contained in:
Wilson Snyder 2020-12-16 18:33:08 -05:00
parent ce9293fcb3
commit 6adda241c9
2 changed files with 3 additions and 0 deletions

View File

@ -3786,6 +3786,7 @@ system_f_call_or_t<nodep>: // IEEE: part of system_tf_call (can be task or func)
| yD_UNSIGNED '(' expr ')' { $$ = new AstUnsigned($1, $3); }
| yD_URANDOM '(' expr ')' { $$ = new AstRand($1, $3, true); }
| yD_URANDOM parenE { $$ = new AstRand($1, nullptr, true); }
| yD_URANDOM_RANGE '(' expr ')' { $$ = new AstURandomRange($1, $3, new AstConst($1, 0)); }
| yD_URANDOM_RANGE '(' expr ',' expr ')' { $$ = new AstURandomRange($1, $3, $5); }
| yD_VALUEPLUSARGS '(' expr ',' expr ')' { $$ = new AstValuePlusArgs($1, $3, $5); }
;

View File

@ -40,6 +40,8 @@ module t(/*AUTOARG*/);
if (v1 != 0 && v1 != 1) $stop;
v1 = $urandom_range(2, 0);
if (v1 != 0 && v1 != 1) $stop;
v1 = $urandom_range(3);
if (v1 != 0 && v1 != 1 && v1 != 2) $stop;
end
// Seed stability