mirror of
https://github.com/verilator/verilator.git
synced 2026-09-02 02:38:15 +02:00
Fix empty foreach in if in constraints (#5408)
Signed-off-by: Krzysztof Bieganski <[email protected]>
This commit is contained in:
+3
-1
@@ -695,11 +695,13 @@ class ConstraintExprVisitor final : public VNVisitor {
|
||||
AstNode* const cstmtp = new AstText{fl, "ret += \" \" + "};
|
||||
cstmtp->addNext(itemp);
|
||||
cstmtp->addNext(new AstText{fl, ";"});
|
||||
AstNode* const exprsp = new AstText{fl, "([&]{ std::string ret = \"(bvand\";"};
|
||||
AstNode* const exprsp = new AstText{fl, "([&]{ std::string ret;"};
|
||||
exprsp->addNext(new AstBegin{
|
||||
fl, "",
|
||||
new AstForeach{fl, nodep->arrayp()->unlinkFrBack(), new AstCStmt{fl, cstmtp}},
|
||||
false, true});
|
||||
exprsp->addNext(
|
||||
new AstText{fl, "return ret.empty() ? \"#b1\" : \"(bvand \" + ret + \")\";"});
|
||||
exprsp->addNext(new AstText{fl, "return ret + \")\"; })()"});
|
||||
AstNodeExpr* const newp = new AstCExpr{fl, exprsp};
|
||||
newp->dtypeSetString();
|
||||
|
||||
Reference in New Issue
Block a user