From decfa6bd7a26f8d11da73910881d29f354c344b9 Mon Sep 17 00:00:00 2001 From: Geza Lore Date: Fri, 11 Feb 2022 17:03:12 +0000 Subject: [PATCH] V3Order: Use unique ordinals per function name This helps diffing generated code after reordering output, otherwise no functional change. --- src/V3Order.cpp | 23 +++++++++++------------ test_regress/t/t_protect_ids_key.out | 4 ++-- test_regress/t/t_verilated_debug.out | 4 ++-- test_regress/t/t_xml_debugcheck.out | 8 ++++---- 4 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/V3Order.cpp b/src/V3Order.cpp index fecee609e..433082e68 100644 --- a/src/V3Order.cpp +++ b/src/V3Order.cpp @@ -1054,8 +1054,8 @@ public: class OrderProcess final : VNDeleter { // NODE STATE - // AstNodeModule::user3 -> int: Number of AstCFuncs created under this module - // AstNode::user4 -> Used by V3Const::constifyExpensiveEdit + // AstNode::user3 -> Used by loop reporting + // AstNode::user4 -> Used by V3Const::constifyExpensiveEdit const VNUser3InUse user3InUse; // STATE @@ -1073,6 +1073,7 @@ class OrderProcess final : VNDeleter { friend class OrderMoveDomScope; V3List m_pomReadyDomScope; // List of ready domain/scope pairs, by loopId std::vector m_unoptflatVars; // Vector of variables in UNOPTFLAT loop + std::map, unsigned> m_funcNums; // Function ordinals // STATS std::array m_statCut; // Count of each edge type cut @@ -1115,16 +1116,14 @@ class OrderProcess final : VNDeleter { string cfuncName(AstNodeModule* modp, AstSenTree* domainp, AstScope* scopep, AstNode* forWhatp) { - modp->user3Inc(); - const int funcnum = modp->user3(); - string name = (domainp->hasCombo() - ? "_combo" - : (domainp->hasInitial() - ? "_initial" - : (domainp->hasSettle() - ? "_settle" - : (domainp->isMulti() ? "_multiclk" : "_sequent")))); - name = name + "__" + scopep->nameDotless() + "__" + cvtToStr(funcnum); + string name = domainp->hasCombo() ? "_combo" + : domainp->hasInitial() ? "_initial" + : domainp->hasSettle() ? "_settle" + : domainp->isMulti() ? "_multiclk" + : "_sequent"; + name = name + "__" + scopep->nameDotless(); + const unsigned funcnum = m_funcNums.emplace(std::make_pair(modp, name), 0).first->second++; + name = name + "__" + cvtToStr(funcnum); if (v3Global.opt.profCFuncs()) { name += "__PROF__" + forWhatp->fileline()->profileFuncname(); } diff --git a/test_regress/t/t_protect_ids_key.out b/test_regress/t/t_protect_ids_key.out index 4575b30b0..45059c7d7 100644 --- a/test_regress/t/t_protect_ids_key.out +++ b/test_regress/t/t_protect_ids_key.out @@ -29,8 +29,8 @@ - - + + diff --git a/test_regress/t/t_verilated_debug.out b/test_regress/t/t_verilated_debug.out index 932ee8483..9cbfc96c8 100644 --- a/test_regress/t/t_verilated_debug.out +++ b/test_regress/t/t_verilated_debug.out @@ -8,7 +8,7 @@ internalsDump: -V{t#,#}+++++TOP Evaluate Vt_verilated_debug::eval_step -V{t#,#}+ Vt_verilated_debug___024root___eval_debug_assertions -V{t#,#}+ Vt_verilated_debug___024root___eval_initial --V{t#,#}+ Vt_verilated_debug___024root___initial__TOP__1 +-V{t#,#}+ Vt_verilated_debug___024root___initial__TOP__0 Data: w96: 000000aa 000000bb 000000cc -V{t#,#}+ Initial loop -V{t#,#}+ Vt_verilated_debug___024root___eval_settle @@ -19,6 +19,6 @@ internalsDump: -V{t#,#}+ Vt_verilated_debug___024root___eval_debug_assertions -V{t#,#}+ Clock loop -V{t#,#}+ Vt_verilated_debug___024root___eval --V{t#,#}+ Vt_verilated_debug___024root___sequent__TOP__2 +-V{t#,#}+ Vt_verilated_debug___024root___sequent__TOP__0 *-* All Finished *-* -V{t#,#}+ Vt_verilated_debug___024root___final diff --git a/test_regress/t/t_xml_debugcheck.out b/test_regress/t/t_xml_debugcheck.out index 7df0425da..7ef8e07b3 100644 --- a/test_regress/t/t_xml_debugcheck.out +++ b/test_regress/t/t_xml_debugcheck.out @@ -28,7 +28,7 @@ - + @@ -842,7 +842,7 @@ - + @@ -1398,7 +1398,7 @@ - + @@ -1411,7 +1411,7 @@ - +