Fix associative array first method as statement (#3228).

This commit is contained in:
Wilson Snyder 2022-01-01 17:10:14 -05:00
parent 2a0ec88379
commit 655910d486
3 changed files with 8 additions and 0 deletions

View File

@ -29,6 +29,7 @@ Verilator 4.217 devel
* Fix break under foreach loop (#3230).
* Fix VL_STREAML_FAST_QQI with 64 bit left-hand-side (#3232) (#3235)
* Fix $sformat of inputs/outputs (#3236). [Adrien Le Masle]
* Fix associative array first method as statement (#3228). [Adrien Le Masle]
* Fix associative array foreach loop (#3229).
* Fix $fclose not accepting expressions (#3237). [Julie Schwartz]
* Fix $random not updating seed (#3238). [Julie Schwartz]

View File

@ -2680,6 +2680,7 @@ private:
nodep->name(), // first/last/next/prev
index_exprp->unlinkFrBack());
newp->dtypeSetSigned32();
if (!nodep->firstAbovep()) newp->makeStatement();
} else if (nodep->name() == "exists") { // function int exists(input index)
// IEEE really should have made this a "bit" return
methodOkArguments(nodep, 1, 1);

View File

@ -44,6 +44,12 @@ module t (/*AUTOARG*/
i = a.prev(k); `checkh(i, 0);
v = $sformatf("%p", a); `checks(v, "'{'h2:\"bared\", 'h3:\"fooed\"} ");
a.first(k); `checks(k, 4'd2);
a.next(k); `checks(k, 4'd3);
a.next(k);
a.last(k); `checks(k, 4'd3);
a.prev(k); `checks(k, 4'd2);
a.delete(4'd2);
i = a.size(); `checkh(i, 1);