mirror of
https://github.com/verilator/verilator.git
synced 2026-10-06 01:54:01 +02:00
Initial idea was to remodel AssignW as Assign under Alway. Trying that uncovered some issues, the most difficult of them was that a delay attached to a continuous assignment behaves differently from a delay attached to a blocking assignment statement, so we need to keep the knowledge of which flavour an assignment was until V3Timing. So instead of removing AstAssignW, we always wrap it in an AstAlways, with a special `keyword()` type. This makes it into a proper procedural statement, which is almost equivalent to AstAssign, except for the case when they contain a delay. We still gain the benefits of #6280 and can simplify some code. Every AstNodeStmt should now be under an AstNodeProcedure - which we should rename to AstProcess, or an AstNodeFTask). As a result, V3Table can now handle AssignW for free. Also uncovered and fixed a bug in handling intra-assignment delays if a function is present on the RHS of an AssignW. There is more work to be done towards #6280, and potentially simplifying AssignW handing, but this is the minimal change required to tick it off the TODO list for #6280.
This commit is contained in:
+8
-4
@@ -171,7 +171,7 @@ class InlineMarkVisitor final : public VNVisitor {
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
void visit(AstAlways* nodep) override {
|
||||
m_modp->user4Inc(); // statement count
|
||||
if (nodep->keyword() != VAlwaysKwd::CONT_ASSIGN) nodep->user4Inc(); // statement count
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
void visit(AstNodeAssign* nodep) override {
|
||||
@@ -480,7 +480,9 @@ void connectPort(AstNodeModule* modp, AstVar* nodep, AstNodeExpr* pinExprp) {
|
||||
// the port variable. The constant can still be inlined, in which case
|
||||
// this is needed for tracing the inlined port variable.
|
||||
if (AstConst* const pinp = VN_CAST(pinExprp, Const)) {
|
||||
modp->addStmtsp(new AstAssignW{flp, portRef(VAccess::WRITE), pinp->cloneTree(false)});
|
||||
AstAssignW* const ap
|
||||
= new AstAssignW{flp, portRef(VAccess::WRITE), pinp->cloneTree(false)};
|
||||
modp->addStmtsp(new AstAlways{ap});
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -516,9 +518,11 @@ void connectPort(AstNodeModule* modp, AstVar* nodep, AstNodeExpr* pinExprp) {
|
||||
// Otherwise create the continuous assignment between the port var and the pin expression
|
||||
UINFO(6, "Not inlning port variable: " << nodep);
|
||||
if (nodep->direction() == VDirection::INPUT) {
|
||||
modp->addStmtsp(new AstAssignW{flp, portRef(VAccess::WRITE), pinRef(VAccess::READ)});
|
||||
AstAssignW* const ap = new AstAssignW{flp, portRef(VAccess::WRITE), pinRef(VAccess::READ)};
|
||||
modp->addStmtsp(new AstAlways{ap});
|
||||
} else if (nodep->direction() == VDirection::OUTPUT) {
|
||||
modp->addStmtsp(new AstAssignW{flp, pinRef(VAccess::WRITE), portRef(VAccess::READ)});
|
||||
AstAssignW* const ap = new AstAssignW{flp, pinRef(VAccess::WRITE), portRef(VAccess::READ)};
|
||||
modp->addStmtsp(new AstAlways{ap});
|
||||
} else {
|
||||
pinExprp->v3fatalSrc("V3Tristate left INOUT port");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user