mirror of
https://github.com/verilator/verilator.git
synced 2026-10-06 10:03:44 +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:
@@ -107,7 +107,6 @@ class TaskStateVisitor final : public VNVisitor {
|
||||
// MEMBERS
|
||||
VarToScopeMap m_varToScopeMap; // Map for Var -> VarScope mappings
|
||||
FuncToClassMap m_funcToClassMap; // Map for ctor func -> class
|
||||
AstAssignW* m_assignwp = nullptr; // Current assignment
|
||||
AstNodeFTask* m_ctorp = nullptr; // Class constructor
|
||||
AstClass* m_classp = nullptr; // Current class
|
||||
V3Graph m_callGraph; // Task call graph
|
||||
@@ -144,13 +143,6 @@ public:
|
||||
void checkPurity(AstNodeFTask* nodep) { checkPurity(nodep, getFTaskVertex(nodep)); }
|
||||
|
||||
private:
|
||||
void convertAssignWToAlways() {
|
||||
// Wire assigns must become always statements to deal with insertion
|
||||
// of multiple statements. Perhaps someday make all wassigns into always's?
|
||||
UINFO(5, " IM_WireRep " << m_assignwp);
|
||||
m_assignwp->convertToAlways();
|
||||
VL_DO_CLEAR(pushDeletep(m_assignwp), m_assignwp = nullptr);
|
||||
}
|
||||
void checkPurity(AstNodeFTask* nodep, TaskBaseVertex* vxp) {
|
||||
if (nodep->recursive()) return; // Impure, but no warning
|
||||
if (!vxp->pure()) {
|
||||
@@ -193,18 +185,7 @@ private:
|
||||
}
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
void visit(AstAssignW* nodep) override {
|
||||
VL_RESTORER(m_assignwp);
|
||||
m_assignwp = nodep;
|
||||
VL_DO_DANGLING(iterateChildren(nodep), nodep); // May delete nodep.
|
||||
}
|
||||
void visit(AstExprStmt* nodep) override {
|
||||
if (m_assignwp) convertAssignWToAlways();
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
void visit(AstNodeFTaskRef* nodep) override {
|
||||
// Includes handling AstMethodCall, AstNew
|
||||
if (m_assignwp) convertAssignWToAlways();
|
||||
// We make multiple edges if a task is called multiple times from another task.
|
||||
UASSERT_OBJ(nodep->taskp(), nodep, "Unlinked task");
|
||||
TaskFTaskVertex* const taskVtxp = getFTaskVertex(nodep->taskp());
|
||||
|
||||
Reference in New Issue
Block a user