mirror of
https://github.com/verilator/verilator.git
synced 2026-09-04 08:33:38 +02:00
Unify code generation for trace declarations in both trace formats (#4612)
This patch adds some abstract enums to pass to the trace decl* APIs, so
the VCD/FST specific code can be kept in verilated_{vcd,fst}_*.cc, and
removed from V3Emit*. It also reworks the generation of the trace init
functions (those that call 'decl*' for the signals) such that the scope
hierarchy is traversed precisely once during initialization, which
simplifies the FST writer. This later change also has the side effect of
fixing tracing of nested interfaces when traced via an interface
reference - see the change in the expected t_interface_ref_trace - which
previously were missed.
This commit is contained in:
+16
-21
@@ -51,30 +51,25 @@ private:
|
||||
m_scope += "__DOT__" + nodep->name();
|
||||
}
|
||||
|
||||
if (VN_IS(nodep->modp(), Iface)) {
|
||||
nodep->addIntfRefsp(new AstIntfRef{nodep->fileline(), m_scope});
|
||||
}
|
||||
{
|
||||
AstNodeModule* const modp = nodep->modp();
|
||||
// Pass Cell pointers down to the next module
|
||||
for (AstPin* pinp = nodep->pinsp(); pinp; pinp = VN_AS(pinp->nextp(), Pin)) {
|
||||
AstVar* const varp = pinp->modVarp();
|
||||
const AstVarRef* const varrefp = VN_CAST(pinp->exprp(), VarRef);
|
||||
if (!varrefp) continue;
|
||||
const AstVar* const fromVarp = varrefp->varp();
|
||||
const AstIfaceRefDType* const irdtp = VN_CAST(fromVarp->dtypep(), IfaceRefDType);
|
||||
if (!irdtp) continue;
|
||||
AstNodeModule* const modp = nodep->modp();
|
||||
// Pass Cell pointers down to the next module
|
||||
for (AstPin* pinp = nodep->pinsp(); pinp; pinp = VN_AS(pinp->nextp(), Pin)) {
|
||||
AstVar* const varp = pinp->modVarp();
|
||||
const AstVarRef* const varrefp = VN_CAST(pinp->exprp(), VarRef);
|
||||
if (!varrefp) continue;
|
||||
const AstVar* const fromVarp = varrefp->varp();
|
||||
const AstIfaceRefDType* const irdtp = VN_CAST(fromVarp->dtypep(), IfaceRefDType);
|
||||
if (!irdtp) continue;
|
||||
|
||||
AstCell* cellp;
|
||||
if ((cellp = VN_CAST(fromVarp->user1p(), Cell)) || (cellp = irdtp->cellp())) {
|
||||
varp->user1p(cellp);
|
||||
const string alias = m_scope + "__DOT__" + pinp->name();
|
||||
cellp->addIntfRefsp(new AstIntfRef{pinp->fileline(), alias});
|
||||
}
|
||||
AstCell* cellp;
|
||||
if ((cellp = VN_CAST(fromVarp->user1p(), Cell)) || (cellp = irdtp->cellp())) {
|
||||
varp->user1p(cellp);
|
||||
const string alias = m_scope + "__DOT__" + pinp->name();
|
||||
cellp->addIntfRefsp(new AstIntfRef{pinp->fileline(), alias});
|
||||
}
|
||||
|
||||
iterateChildren(modp);
|
||||
}
|
||||
|
||||
iterateChildren(modp);
|
||||
}
|
||||
void visit(AstAssignVarScope* nodep) override {
|
||||
// Reference
|
||||
|
||||
Reference in New Issue
Block a user