mirror of
https://github.com/verilator/verilator.git
synced 2026-10-06 10:03:44 +02:00
Fix delayed initial assignment (#6929)
This commit is contained in:
+10
-4
@@ -1202,10 +1202,16 @@ class TimingControlVisitor final : public VNVisitor {
|
||||
new AstAssign{flp, new AstVarRef{flp, tmpVarp, VAccess::WRITE}, tmpAssignRhsp});
|
||||
// If the RHS is different from the currently scheduled value, schedule the new assignment
|
||||
// The generation will increase, effectively 'descheduling' the previous assignment.
|
||||
alwaysp->addStmtsp(new AstIf{flp,
|
||||
new AstNeq{flp, preAssignp->rhsp()->cloneTree(false),
|
||||
new AstVarRef{flp, tmpVarp, VAccess::READ}},
|
||||
forkp->unlinkFrBack()});
|
||||
AstNodeExpr* const didNotInitp
|
||||
= new AstLogNot{flp, new AstCExpr{flp, "vlSymsp->__Vm_didInit", 1}};
|
||||
AstVarRef* const firstIterp
|
||||
= new AstVarRef{flp, m_netlistp->stlFirstIterationp(), VAccess::READ};
|
||||
AstNodeExpr* const schedCondp
|
||||
= new AstLogOr{flp,
|
||||
new AstNeq{flp, preAssignp->rhsp()->cloneTree(false),
|
||||
new AstVarRef{flp, tmpVarp, VAccess::READ}},
|
||||
new AstLogAnd{flp, didNotInitp, firstIterp}};
|
||||
alwaysp->addStmtsp(new AstIf{flp, schedCondp, forkp->unlinkFrBack()});
|
||||
}
|
||||
void visit(AstDisableFork* nodep) override {
|
||||
if (m_hasProcess) return;
|
||||
|
||||
Reference in New Issue
Block a user