mirror of
https://github.com/verilator/verilator.git
synced 2026-09-02 02:38:15 +02:00
- Delete 'finalsp'. It was used in one place, basically unnecessary and safe to remove. - Make 'argsp' a 'List[AstVar]'. This held before. It holds the function argument and return variables. - Replace 'intitsp' with 'varsp' and make it into 'List[AstVar]' to hold the function local variables. This was most of its use before. The few places we inserted statements here now moved into 'stmtsp' by inserting at the front of the list.
This commit is contained in:
+10
-4
@@ -164,11 +164,17 @@ class ClockVisitor final : public VNVisitor {
|
||||
|
||||
//========== Move sampled assignments
|
||||
void visit(AstVarScope* nodep) override {
|
||||
AstVar* varp = nodep->varp();
|
||||
AstVar* const varp = nodep->varp();
|
||||
if (varp->valuep() && varp->name().substr(0, strlen("__Vsampled")) == "__Vsampled") {
|
||||
m_evalp->addInitsp(new AstAssign{
|
||||
nodep->fileline(), new AstVarRef{nodep->fileline(), nodep, VAccess::WRITE},
|
||||
VN_AS(varp->valuep()->unlinkFrBack(), NodeExpr)});
|
||||
FileLine* const flp = nodep->fileline();
|
||||
AstNodeExpr* const rhsp = VN_AS(varp->valuep()->unlinkFrBack(), NodeExpr);
|
||||
AstVarRef* const lhsp = new AstVarRef{flp, nodep, VAccess::WRITE};
|
||||
AstAssign* const assignp = new AstAssign{flp, lhsp, rhsp};
|
||||
if (AstNode* const stmtsp = m_evalp->stmtsp()) {
|
||||
stmtsp->addHereThisAsNext(assignp);
|
||||
} else {
|
||||
m_evalp->addStmtsp(assignp);
|
||||
}
|
||||
varp->direction(VDirection::NONE); // Restore defaults
|
||||
varp->primaryIO(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user