diff --git a/Changes b/Changes index 7f58bb57a..d1276caae 100644 --- a/Changes +++ b/Changes @@ -22,6 +22,8 @@ The contributors that suggested a given feature are shown in []. Thanks! **** Fix little endian cell ranges, bug1631. [Julien Margetts] +**** Fix queues as statements, bug1641. [Peter Monsson, Stefan Wallentowitz] + * Verilator 4.024 2019-12-08 diff --git a/src/V3Width.cpp b/src/V3Width.cpp index c8981902d..b1503e581 100644 --- a/src/V3Width.cpp +++ b/src/V3Width.cpp @@ -2051,6 +2051,9 @@ private: newp->dtypeFrom(adtypep->subDTypep()); newp->protect(false); newp->didWidth(true); + if (!nodep->firstAbovep()) { + newp->makeStatement(); + } } else if (nodep->name() == "push_back" || nodep->name() == "push_front") { methodOkArguments(nodep, 1, 1); diff --git a/test_regress/t/t_queue.v b/test_regress/t/t_queue.v index 1eea7f91e..4ef274e7e 100644 --- a/test_regress/t/t_queue.v +++ b/test_regress/t/t_queue.v @@ -60,7 +60,7 @@ module t (/*AUTOARG*/ //v = q[0]; `checks(v, "ins0"); //v = q[3]; `checks(v, "ins3"); - v = q.pop_front(); `checks(v, "f2"); + q.pop_front(); v = q.pop_front(); `checks(v, "f1"); v = q.pop_back(); `checks(v, "b2"); v = q.pop_back(); `checks(v, "b1"); @@ -73,7 +73,7 @@ module t (/*AUTOARG*/ v = q.pop_front(); `checks(v, ""); // Was empty, optional warning v = q.pop_back(); `checks(v, ""); // Was empty, optional warning - // COnversion of insert/delete with zero to operator + // Conversion of insert/delete with zero to operator q.push_front("front"); q.insert(0, "newfront"); i = q.size(); `checkh(i, 2);