mirror of
https://github.com/verilator/verilator.git
synced 2026-09-01 18:36:28 +02:00
Fix randomizing current object with rand class instance member (#5292)
Signed-off-by: Krzysztof Bieganski <[email protected]>
This commit is contained in:
+11
-11
@@ -119,20 +119,20 @@ class RandomizeMarkVisitor final : public VNVisitorConst {
|
||||
m_baseToDerivedMap[basep].insert(nodep);
|
||||
}
|
||||
}
|
||||
void visit(AstMethodCall* nodep) override {
|
||||
if (nodep->name() != "randomize") return;
|
||||
if (const AstClassRefDType* const classRefp
|
||||
= VN_CAST(nodep->fromp()->dtypep()->skipRefp(), ClassRefDType)) {
|
||||
AstClass* const classp = classRefp->classp();
|
||||
classp->user1(true);
|
||||
markMembers(classp);
|
||||
}
|
||||
iterateChildrenConst(nodep);
|
||||
}
|
||||
void visit(AstNodeFTaskRef* nodep) override {
|
||||
iterateChildrenConst(nodep);
|
||||
if (nodep->name() != "randomize") return;
|
||||
if (m_classp) m_classp->user1(true);
|
||||
AstClass* classp = m_classp;
|
||||
if (const AstMethodCall* const methodCallp = VN_CAST(nodep, MethodCall)) {
|
||||
if (const AstClassRefDType* const classRefp
|
||||
= VN_CAST(methodCallp->fromp()->dtypep()->skipRefp(), ClassRefDType)) {
|
||||
classp = classRefp->classp();
|
||||
}
|
||||
}
|
||||
if (classp) {
|
||||
classp->user1(true);
|
||||
markMembers(classp);
|
||||
}
|
||||
}
|
||||
void visit(AstConstraintExpr* nodep) override {
|
||||
VL_RESTORER(m_constraintExprp);
|
||||
|
||||
Reference in New Issue
Block a user