mirror of
https://github.com/verilator/verilator.git
synced 2026-09-01 02:16:47 +02:00
Add parsing of solve-before inside foreach (#6934)
This commit is contained in:
+10
-6
@@ -1309,8 +1309,9 @@ class ConstraintExprVisitor final : public VNVisitor {
|
||||
// Convert to plain foreach
|
||||
FileLine* const fl = nodep->fileline();
|
||||
|
||||
AstNode* const arrayp = nodep->arrayp()->unlinkFrBack();
|
||||
if (m_wantSingle) {
|
||||
if (!nodep->stmtsp()) {
|
||||
nodep->unlinkFrBack();
|
||||
} else if (m_wantSingle) {
|
||||
AstNodeExpr* const itemp = editSingle(fl, nodep->stmtsp());
|
||||
AstCStmt* const cstmtp = new AstCStmt{fl};
|
||||
cstmtp->add("ret += \" \";\n");
|
||||
@@ -1320,14 +1321,17 @@ class ConstraintExprVisitor final : public VNVisitor {
|
||||
AstCExpr* const cexprp = new AstCExpr{fl};
|
||||
cexprp->dtypeSetString();
|
||||
cexprp->add("([&]{\nstd::string ret;\n");
|
||||
cexprp->add(new AstBegin{fl, "", new AstForeach{fl, arrayp, cstmtp}, true});
|
||||
cexprp->add(new AstBegin{
|
||||
fl, "", new AstForeach{fl, nodep->arrayp()->unlinkFrBack(), cstmtp}, true});
|
||||
cexprp->add("return ret.empty() ? \"#b1\" : \"(bvand\" + ret + \")\";\n})()");
|
||||
nodep->replaceWith(new AstSFormatF{fl, "%@", false, cexprp});
|
||||
} else {
|
||||
iterateAndNextNull(nodep->stmtsp());
|
||||
nodep->replaceWith(new AstBegin{
|
||||
fl, "", new AstForeach{fl, arrayp, nodep->stmtsp()->unlinkFrBackWithNext()},
|
||||
true});
|
||||
nodep->replaceWith(
|
||||
new AstBegin{fl, "",
|
||||
new AstForeach{fl, nodep->arrayp()->unlinkFrBack(),
|
||||
nodep->stmtsp()->unlinkFrBackWithNext()},
|
||||
true});
|
||||
}
|
||||
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user