Backout unstable dbb35ab8 (#4318) (#4320)

This commit is contained in:
Wilson Snyder 2023-07-05 14:26:28 -04:00
parent 8182c3fe2c
commit 294d78e0e2
3 changed files with 103 additions and 720 deletions

View File

@ -299,7 +299,6 @@ private:
// Other // Other
SenTreeFinder m_finder{m_netlistp}; // Sentree finder and uniquifier SenTreeFinder m_finder{m_netlistp}; // Sentree finder and uniquifier
SenExprBuilder* m_senExprBuilderp = nullptr; // Sens expression builder for current m_scope
// METHODS // METHODS
// Find net delay on the LHS of an assignment // Find net delay on the LHS of an assignment
@ -572,12 +571,7 @@ private:
void visit(AstScope* nodep) override { void visit(AstScope* nodep) override {
VL_RESTORER(m_scopep); VL_RESTORER(m_scopep);
m_scopep = nodep; m_scopep = nodep;
SenExprBuilder senExprBuilder{m_scopep}; iterateChildren(nodep);
{ // Restore m_senExprBuilderp before destroying senExprBuilder
VL_RESTORER(m_senExprBuilderp);
m_senExprBuilderp = &senExprBuilder;
iterateChildren(nodep);
}
} }
void visit(AstActive* nodep) override { void visit(AstActive* nodep) override {
m_activep = nodep; m_activep = nodep;
@ -733,14 +727,14 @@ private:
= new AstCAwait{flp, evalMethodp, getCreateDynamicTriggerSenTree()}; = new AstCAwait{flp, evalMethodp, getCreateDynamicTriggerSenTree()};
awaitEvalp->dtypeSetVoid(); awaitEvalp->dtypeSetVoid();
// Construct the sen expression for this sentree // Construct the sen expression for this sentree
UASSERT_OBJ(m_senExprBuilderp, nodep, "No SenExprBuilder for this scope"); SenExprBuilder senExprBuilder{m_scopep};
auto* const assignp = new AstAssign{flp, new AstVarRef{flp, trigvscp, VAccess::WRITE}, auto* const assignp = new AstAssign{flp, new AstVarRef{flp, trigvscp, VAccess::WRITE},
m_senExprBuilderp->build(sensesp).first}; senExprBuilder.build(sensesp).first};
// Put all the locals and inits before the trigger eval loop // Put all the locals and inits before the trigger eval loop
for (AstVar* const varp : m_senExprBuilderp->getAndClearLocals()) { for (AstVar* const varp : senExprBuilder.getAndClearLocals()) {
nodep->addHereThisAsNext(varp); nodep->addHereThisAsNext(varp);
} }
for (AstNodeStmt* const stmtp : m_senExprBuilderp->getAndClearInits()) { for (AstNodeStmt* const stmtp : senExprBuilder.getAndClearInits()) {
nodep->addHereThisAsNext(stmtp); nodep->addHereThisAsNext(stmtp);
} }
// Create the trigger eval loop, which will await the evaluation step and check the // Create the trigger eval loop, which will await the evaluation step and check the
@ -749,7 +743,7 @@ private:
flp, new AstLogNot{flp, new AstVarRef{flp, trigvscp, VAccess::READ}}, flp, new AstLogNot{flp, new AstVarRef{flp, trigvscp, VAccess::READ}},
awaitEvalp->makeStmt()}; awaitEvalp->makeStmt()};
// Put pre updates before the trigger check and assignment // Put pre updates before the trigger check and assignment
for (AstNodeStmt* const stmtp : m_senExprBuilderp->getAndClearPreUpdates()) { for (AstNodeStmt* const stmtp : senExprBuilder.getAndClearPreUpdates()) {
loopp->addStmtsp(stmtp); loopp->addStmtsp(stmtp);
} }
// Then the trigger check and assignment // Then the trigger check and assignment
@ -762,7 +756,7 @@ private:
loopp->addStmtsp(awaitPostUpdatep->makeStmt()); loopp->addStmtsp(awaitPostUpdatep->makeStmt());
} }
// Put the post updates at the end of the loop // Put the post updates at the end of the loop
for (AstNodeStmt* const stmtp : m_senExprBuilderp->getAndClearPostUpdates()) { for (AstNodeStmt* const stmtp : senExprBuilder.getAndClearPostUpdates()) {
loopp->addStmtsp(stmtp); loopp->addStmtsp(stmtp);
} }
// Finally, await the resumption step in 'act' // Finally, await the resumption step in 'act'

View File

@ -80,32 +80,9 @@ module t;
endtask endtask
endclass endclass
class ClkClass;
logic clk;
int count;
function new;
clk = 0;
count = 0;
endfunction
task flip;
clk = ~clk;
endtask;
task count_5;
@(posedge clk) count++;
@(posedge clk) count++;
@(posedge clk) count++;
@(posedge clk) count++;
@(posedge clk) count++;
endtask
endclass
EventClass ec = new; EventClass ec = new;
WaitClass wc = new; WaitClass wc = new;
LocalWaitClass lc = new; LocalWaitClass lc = new;
ClkClass cc = new;
initial begin initial begin
@ec.e; @ec.e;
@ -128,13 +105,8 @@ module t;
`WRITE_VERBOSE(("Event in class triggered at time %0t!\n", $time)); `WRITE_VERBOSE(("Event in class triggered at time %0t!\n", $time));
end end
always #5 cc.flip;
initial cc.count_5;
initial begin initial begin
#80 #80
if (cc.count != 5) $stop;
if (ec.trig_count != 3) $stop; if (ec.trig_count != 3) $stop;
if (!wc.ok) $stop; if (!wc.ok) $stop;
if (!lc.ok) $stop; if (!lc.ok) $stop;

File diff suppressed because it is too large Load Diff