Skip to content

Commit

Permalink
Remove visit count from ConstraintExprVisitor
Browse files Browse the repository at this point in the history
Signed-off-by: Ryszard Rozak <[email protected]>
  • Loading branch information
RRozak committed Dec 9, 2024
1 parent 66941eb commit 5b5a6b4
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/V3Randomize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,6 @@ class ConstraintExprVisitor final : public VNVisitor {
AstVar* const m_genp; // VlRandomizer variable of the class
AstVar* m_randModeVarp; // Relevant randmode state variable
bool m_wantSingle = false; // Whether to merge constraint expressions with LOGAND
const int m_visitCnt = 0; // visit count

AstSFormatF* getConstFormat(AstNodeExpr* nodep) {
return new AstSFormatF{nodep->fileline(), (nodep->width() & 3) ? "#b%b" : "#x%x", false,
Expand Down Expand Up @@ -829,11 +828,10 @@ class ConstraintExprVisitor final : public VNVisitor {
public:
// CONSTRUCTORS
explicit ConstraintExprVisitor(AstNode* nodep, AstNodeFTask* taskp, AstVar* genp,
AstVar* randModeVarp, const int visitCnt)
AstVar* randModeVarp)
: m_taskp{taskp}
, m_genp{genp}
, m_randModeVarp{randModeVarp}
, m_visitCnt{visitCnt} {
, m_randModeVarp{randModeVarp} {
iterateAndNextNull(nodep);
}
};
Expand Down Expand Up @@ -1917,7 +1915,7 @@ class RandomizeVisitor final : public VNVisitor {
m_memberMap.insert(classp, setupTaskp);

AstConstraint* const constrCopyp = constrp->cloneTree(false);
ConstraintExprVisitor{constrCopyp->itemsp(), setupTaskp, genArgp, randModeVarp, 1};
ConstraintExprVisitor{constrCopyp->itemsp(), setupTaskp, genArgp, randModeVarp};
if (constrCopyp->itemsp()) {
setupTaskp->addStmtsp(constrCopyp->itemsp()->unlinkFrBackWithNext());
}
Expand Down Expand Up @@ -2141,10 +2139,7 @@ class RandomizeVisitor final : public VNVisitor {
// Generate constraint setup code and a hardcoded call to the solver
AstNode* const capturedTreep = withp->exprp()->unlinkFrBackWithNext();
randomizeFuncp->addStmtsp(capturedTreep);
{
ConstraintExprVisitor{capturedTreep, randomizeFuncp, localGenp, randModeVarp,
++m_withCnt};
}
{ ConstraintExprVisitor{capturedTreep, randomizeFuncp, localGenp, randModeVarp}; }

// Call the solver and set return value
AstVarRef* const randNextp = new AstVarRef{fl, localGenp, VAccess::READWRITE};
Expand Down

0 comments on commit 5b5a6b4

Please sign in to comment.