mirror of
https://github.com/verilator/verilator.git
synced 2026-10-06 10:03:44 +02:00
Internals: Rename AstSenTree pointers to sentreep. No functional change intended except JSON.
This commit is contained in:
+31
-30
@@ -506,9 +506,9 @@ class TimingControlVisitor final : public VNVisitor {
|
||||
stmtp->replaceWith(delayp->unlinkFrBack());
|
||||
delayp->addStmtsp(stmtp);
|
||||
stmtp = delayp;
|
||||
} else if (AstSenTree* const sensesp = VN_CAST(controlp, SenTree)) {
|
||||
} else if (AstSenTree* const sentreep = VN_CAST(controlp, SenTree)) {
|
||||
AstEventControl* const eventControlp
|
||||
= new AstEventControl{sensesp->fileline(), sensesp->unlinkFrBack(), nullptr};
|
||||
= new AstEventControl{sentreep->fileline(), sentreep->unlinkFrBack(), nullptr};
|
||||
stmtp->replaceWith(eventControlp);
|
||||
eventControlp->addStmtsp(stmtp);
|
||||
stmtp = eventControlp;
|
||||
@@ -619,8 +619,8 @@ class TimingControlVisitor final : public VNVisitor {
|
||||
});
|
||||
}
|
||||
// Creates a trigger scheduler variable
|
||||
AstVarScope* getCreateTriggerSchedulerp(AstSenTree* const sensesp) {
|
||||
if (!sensesp->user1p()) {
|
||||
AstVarScope* getCreateTriggerSchedulerp(AstSenTree* const sentreep) {
|
||||
if (!sentreep->user1p()) {
|
||||
if (!m_trigSchedDtp) {
|
||||
m_trigSchedDtp
|
||||
= new AstBasicDType{m_scopeTopp->fileline(), VBasicDTypeKwd::TRIGGER_SCHEDULER,
|
||||
@@ -628,27 +628,27 @@ class TimingControlVisitor final : public VNVisitor {
|
||||
m_netlistp->typeTablep()->addTypesp(m_trigSchedDtp);
|
||||
}
|
||||
AstVarScope* const trigSchedp
|
||||
= m_scopeTopp->createTemp(m_trigSchedNames.get(sensesp), m_trigSchedDtp);
|
||||
sensesp->user1p(trigSchedp);
|
||||
= m_scopeTopp->createTemp(m_trigSchedNames.get(sentreep), m_trigSchedDtp);
|
||||
sentreep->user1p(trigSchedp);
|
||||
}
|
||||
return VN_AS(sensesp->user1p(), VarScope);
|
||||
return VN_AS(sentreep->user1p(), VarScope);
|
||||
}
|
||||
// Creates a string describing the sentree
|
||||
AstCExpr* createEventDescription(AstSenTree* const sensesp) const {
|
||||
if (!sensesp->user2p()) {
|
||||
AstCExpr* createEventDescription(AstSenTree* const sentreep) const {
|
||||
if (!sentreep->user2p()) {
|
||||
std::stringstream ss;
|
||||
ss << '"';
|
||||
V3EmitV::verilogForTree(sensesp, ss);
|
||||
V3EmitV::verilogForTree(sentreep, ss);
|
||||
ss << '"';
|
||||
// possibly a multiline string
|
||||
std::string comment = ss.str();
|
||||
std::replace(comment.begin(), comment.end(), '\n', ' ');
|
||||
AstCExpr* const commentp = new AstCExpr{sensesp->fileline(), comment, 0};
|
||||
AstCExpr* const commentp = new AstCExpr{sentreep->fileline(), comment, 0};
|
||||
commentp->dtypeSetString();
|
||||
sensesp->user2p(commentp);
|
||||
sentreep->user2p(commentp);
|
||||
return commentp;
|
||||
}
|
||||
return VN_AS(sensesp->user2p(), CExpr)->cloneTree(false);
|
||||
return VN_AS(sentreep->user2p(), CExpr)->cloneTree(false);
|
||||
}
|
||||
// Adds debug info to a hardcoded method call
|
||||
void addDebugInfo(AstCMethodHard* const methodp) const {
|
||||
@@ -662,9 +662,9 @@ class TimingControlVisitor final : public VNVisitor {
|
||||
methodp->addPinsp(bp);
|
||||
}
|
||||
// Adds debug info to a trigSched.trigger() call
|
||||
void addEventDebugInfo(AstCMethodHard* const methodp, AstSenTree* const sensesp) const {
|
||||
void addEventDebugInfo(AstCMethodHard* const methodp, AstSenTree* const sentreep) const {
|
||||
if (v3Global.opt.protectIds()) return;
|
||||
methodp->addPinsp(createEventDescription(sensesp));
|
||||
methodp->addPinsp(createEventDescription(sentreep));
|
||||
addDebugInfo(methodp);
|
||||
}
|
||||
// Adds process pointer to a hardcoded method call
|
||||
@@ -812,17 +812,17 @@ class TimingControlVisitor final : public VNVisitor {
|
||||
if (!hasFlags(nodep, T_SUSPENDEE)) return;
|
||||
nodep->setSuspendable();
|
||||
FileLine* const flp = nodep->fileline();
|
||||
AstSenTree* const sensesp = m_activep->sensesp();
|
||||
if (sensesp->hasClocked()) {
|
||||
AstSenTree* const sentreep = m_activep->sentreep();
|
||||
if (sentreep->hasClocked()) {
|
||||
AstNode* const bodysp = nodep->stmtsp()->unlinkFrBackWithNext();
|
||||
auto* const controlp = new AstEventControl{flp, sensesp->cloneTree(false), bodysp};
|
||||
auto* const controlp = new AstEventControl{flp, sentreep->cloneTree(false), bodysp};
|
||||
nodep->addStmtsp(controlp);
|
||||
iterate(controlp);
|
||||
}
|
||||
// Note: The 'while (true)' outer loop will be added in V3Sched
|
||||
auto* const activep = new AstActive{
|
||||
flp, "", new AstSenTree{flp, new AstSenItem{flp, AstSenItem::Initial{}}}};
|
||||
activep->sensesStorep(activep->sensesp());
|
||||
activep->senTreeStorep(activep->sentreep());
|
||||
activep->addStmtsp(nodep->unlinkFrBack());
|
||||
m_activep->addNextHere(activep);
|
||||
}
|
||||
@@ -905,11 +905,12 @@ class TimingControlVisitor final : public VNVisitor {
|
||||
void visit(AstEventControl* nodep) override {
|
||||
// Do not allow waiting on local named events, as they get enqueued for clearing, but can
|
||||
// go out of scope before that happens
|
||||
if (!nodep->sensesp()) nodep->v3warn(E_UNSUPPORTED, "Unsupported: no sense equation (@*)");
|
||||
if (!nodep->sentreep())
|
||||
nodep->v3warn(E_UNSUPPORTED, "Unsupported: no sense equation (@*)");
|
||||
FileLine* const flp = nodep->fileline();
|
||||
// Relink child statements after the event control
|
||||
if (nodep->stmtsp()) nodep->addNextHere(nodep->stmtsp()->unlinkFrBackWithNext());
|
||||
if (needDynamicTrigger(nodep->sensesp())) {
|
||||
if (needDynamicTrigger(nodep->sentreep())) {
|
||||
// Create the trigger variable and init it with 0
|
||||
AstVarScope* const trigvscp
|
||||
= createTemp(flp, m_dynTrigNames.get(nodep), nodep->findBitDType(), nodep);
|
||||
@@ -923,8 +924,8 @@ class TimingControlVisitor final : public VNVisitor {
|
||||
"evaluation"};
|
||||
evalMethodp->dtypeSetVoid();
|
||||
addProcessInfo(evalMethodp);
|
||||
auto* const sensesp = nodep->sensesp();
|
||||
addEventDebugInfo(evalMethodp, sensesp);
|
||||
auto* const sentreep = nodep->sentreep();
|
||||
addEventDebugInfo(evalMethodp, sentreep);
|
||||
// Create the co_await
|
||||
AstCAwait* const awaitEvalp
|
||||
= new AstCAwait{flp, evalMethodp, getCreateDynamicTriggerSenTree()};
|
||||
@@ -932,7 +933,7 @@ class TimingControlVisitor final : public VNVisitor {
|
||||
// Construct the sen expression for this sentree
|
||||
UASSERT_OBJ(m_senExprBuilderp, nodep, "No SenExprBuilder for this scope");
|
||||
auto* const assignp = new AstAssign{flp, new AstVarRef{flp, trigvscp, VAccess::WRITE},
|
||||
m_senExprBuilderp->build(sensesp).first};
|
||||
m_senExprBuilderp->build(sentreep).first};
|
||||
// Get the SenExprBuilder results
|
||||
const SenExprBuilder::Results senResults = m_senExprBuilderp->getAndClearResults();
|
||||
// Put all and inits before the trigger eval loop
|
||||
@@ -957,7 +958,7 @@ class TimingControlVisitor final : public VNVisitor {
|
||||
loopp->addStmtsp(anyTriggeredMethodp->makeStmt());
|
||||
// If the post update is destructive (e.g. event vars are cleared), create an await for
|
||||
// the post update step
|
||||
if (destructivePostUpdate(sensesp)) {
|
||||
if (destructivePostUpdate(sentreep)) {
|
||||
AstCAwait* const awaitPostUpdatep = awaitEvalp->cloneTree(false);
|
||||
VN_AS(awaitPostUpdatep->exprp(), CMethodHard)->name("postUpdate");
|
||||
loopp->addStmtsp(awaitPostUpdatep->makeStmt());
|
||||
@@ -971,21 +972,21 @@ class TimingControlVisitor final : public VNVisitor {
|
||||
// Replace the event control with the loop
|
||||
nodep->replaceWith(loopp);
|
||||
} else {
|
||||
auto* const sensesp = m_finder.getSenTree(nodep->sensesp());
|
||||
nodep->sensesp()->unlinkFrBack()->deleteTree();
|
||||
auto* const sentreep = m_finder.getSenTree(nodep->sentreep());
|
||||
nodep->sentreep()->unlinkFrBack()->deleteTree();
|
||||
// Get this sentree's trigger scheduler
|
||||
// Replace self with a 'co_await trigSched.trigger()'
|
||||
auto* const triggerMethodp = new AstCMethodHard{
|
||||
flp, new AstVarRef{flp, getCreateTriggerSchedulerp(sensesp), VAccess::WRITE},
|
||||
flp, new AstVarRef{flp, getCreateTriggerSchedulerp(sentreep), VAccess::WRITE},
|
||||
"trigger"};
|
||||
triggerMethodp->dtypeSetVoid();
|
||||
// If it should be committed immediately, pass true, otherwise false
|
||||
triggerMethodp->addPinsp(nodep->user2() ? new AstConst{flp, AstConst::BitTrue{}}
|
||||
: new AstConst{flp, AstConst::BitFalse{}});
|
||||
addProcessInfo(triggerMethodp);
|
||||
addEventDebugInfo(triggerMethodp, sensesp);
|
||||
addEventDebugInfo(triggerMethodp, sentreep);
|
||||
// Create the co_await
|
||||
AstCAwait* const awaitp = new AstCAwait{flp, triggerMethodp, sensesp};
|
||||
AstCAwait* const awaitp = new AstCAwait{flp, triggerMethodp, sentreep};
|
||||
awaitp->dtypeSetVoid();
|
||||
nodep->replaceWith(awaitp->makeStmt());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user