Fix mis-removing $value$plusargs calls (#5127) (#5137). [Seth Pellegrino]

Co-authored-by: Seth Pellegrino <seth@codecopse.net>
This commit is contained in:
Wilson Snyder 2024-07-02 18:46:58 -04:00
parent 955ed3f193
commit a6d438d111
4 changed files with 12 additions and 1 deletions

View File

@ -14,6 +14,7 @@ Verilator 5.027 devel
**Minor:**
* Fix fusing macro arguments to not ignore whitespace (#5061). [Tudor Timi]
* Fix mis-removing $value$plusargs calls (#5127) (#5137). [Seth Pellegrino]
Verilator 5.026 2024-06-15

View File

@ -177,6 +177,7 @@ Samuel Riedel
Sean Cross
Sebastien Van Cauwenberghe
Sergi Granell
Seth Pellegrino
Srinivasan Venkataramanan
Stefan Wallentowitz
Stephen Henry

View File

@ -311,7 +311,7 @@ class DeadVisitor final : public VNVisitor {
// still get deleted.
}
void visit(AstNode* nodep) override {
if (nodep->isOutputter()) m_sideEffect = true;
if (!m_sideEffect && !nodep->isPure()) m_sideEffect = true;
iterateChildren(nodep);
checkAll(nodep);
}

View File

@ -14,6 +14,7 @@ module t;
string sv_str;
reg [7*8:1] p_in;
string sv_in;
integer unread; // never read
initial begin
if ($test$plusargs("PLUS")!==1) $stop;
@ -119,6 +120,14 @@ module t;
if ($value$plusargs("INT=%d", p_i)) ;
if (p_i !== 32'd1234) $stop;
// bug5127 - assign side effect test
p_i = 0;
p_r = 0;
unread = $value$plusargs("INT=%d", p_i);
unread = $value$plusargs("REAL=%e", p_r);
if (p_i !== 32'd1234) $stop;
if (p_r !== 1.2345) $stop;
$write("*-* All Finished *-*\n");
$finish;
end