From c11cd18491a8e82cfc1b2390a5ebe8ee08e779aa Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sat, 19 Jun 2021 13:41:19 -0400 Subject: [PATCH] In XML, show pinIndex information (#2877). --- Changes | 1 + src/V3AstNodes.h | 9 +++-- src/V3EmitXml.cpp | 1 + src/V3LinkDot.cpp | 1 + test_regress/t/t_clk_concat.pl | 6 ++-- test_regress/t/t_clk_concat_vlt.pl | 8 ++--- test_regress/t/t_var_port_xml.out | 40 ++++++++++----------- test_regress/t/t_xml_first.out | 18 +++++----- test_regress/t/t_xml_flat.out | 6 ++-- test_regress/t/t_xml_flat_no_inline_mod.out | 2 +- test_regress/t/t_xml_flat_pub_mod.out | 2 +- test_regress/t/t_xml_flat_vlvbound.out | 8 ++--- test_regress/t/t_xml_output.out | 2 +- test_regress/t/t_xml_tag.out | 6 ++-- 14 files changed, 58 insertions(+), 52 deletions(-) diff --git a/Changes b/Changes index 25eac6207..e3d23ce0c 100644 --- a/Changes +++ b/Changes @@ -22,6 +22,7 @@ Verilator 4.205 devel * Remove deprecated --no-relative-cfuncs option (#3024). [Geza Lore] * Merge const static data globally into a new constant pool (#3013). [Geza Lore] * Allow configure override of AR program (#2999). [ahouska] +* In XML, show pinIndex information (#2877). [errae233] * Fix error on unsupported recursive functions (#2957). [Trefor Southwell] diff --git a/src/V3AstNodes.h b/src/V3AstNodes.h index 94ef71ce3..d47a2aa52 100644 --- a/src/V3AstNodes.h +++ b/src/V3AstNodes.h @@ -1889,6 +1889,10 @@ private: VDirection m_direction; // Direction input/output etc VDirection m_declDirection; // Declared direction input/output etc AstBasicDTypeKwd m_declKwd; // Keyword at declaration time + VLifetime m_lifetime; // Lifetime + VVarAttrClocker m_attrClocker; + MTaskIdSet m_mtaskIds; // MTaskID's that read or write this var + int m_pinNum = 0; // For XML, if non-zero the connection pin number bool m_ansi : 1; // ANSI port list variable (for dedup check) bool m_declTyped : 1; // Declared as type (for dedup check) bool m_tristate : 1; // Inout or triwire or trireg @@ -1925,9 +1929,6 @@ private: bool m_overridenParam : 1; // Overridden parameter by #(...) or defparam bool m_trace : 1; // Trace this variable bool m_isLatched : 1; // Not assigned in all control paths of combo always - VLifetime m_lifetime; // Lifetime - VVarAttrClocker m_attrClocker; - MTaskIdSet m_mtaskIds; // MTaskID's that read or write this var void init() { m_ansi = false; @@ -2226,6 +2227,8 @@ public: void addProducingMTaskId(int id) { m_mtaskIds.insert(id); } void addConsumingMTaskId(int id) { m_mtaskIds.insert(id); } const MTaskIdSet& mtaskIds() const { return m_mtaskIds; } + void pinNum(int id) { m_pinNum = id; } + int pinNum() const { return m_pinNum; } }; class AstDefParam final : public AstNode { diff --git a/src/V3EmitXml.cpp b/src/V3EmitXml.cpp index 3b452ef15..ebe61b2e2 100644 --- a/src/V3EmitXml.cpp +++ b/src/V3EmitXml.cpp @@ -136,6 +136,7 @@ class EmitXmlFileVisitor final : public AstNVisitor { if (nodep->isIO()) { puts(" dir="); putsQuoted(kw); + if (nodep->pinNum() != 0) puts(" pinIndex=\"" + cvtToStr(nodep->pinNum()) + "\""); puts(" vartype="); putsQuoted(!vt.empty() ? vt : typ == AstVarType::PORT ? "port" : "unknown"); } else { diff --git a/src/V3LinkDot.cpp b/src/V3LinkDot.cpp index 05469e928..4fc0dff4a 100644 --- a/src/V3LinkDot.cpp +++ b/src/V3LinkDot.cpp @@ -1438,6 +1438,7 @@ private: "__pinNumber" + cvtToStr(nodep->pinNum()), refp, nullptr /*classOrPackagep*/); symp->exported(false); + refp->pinNum(nodep->pinNum()); } // Ports not needed any more VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep); diff --git a/test_regress/t/t_clk_concat.pl b/test_regress/t/t_clk_concat.pl index 20e02184d..cebae1cb9 100755 --- a/test_regress/t/t_clk_concat.pl +++ b/test_regress/t/t_clk_concat.pl @@ -17,9 +17,9 @@ compile( ); if ($Self->{vlt_all}) { - file_grep("$out_filename", qr/\/i); - file_grep("$out_filename", qr/\/i); - file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); } execute( diff --git a/test_regress/t/t_clk_concat_vlt.pl b/test_regress/t/t_clk_concat_vlt.pl index 4aae842ef..9808ed638 100755 --- a/test_regress/t/t_clk_concat_vlt.pl +++ b/test_regress/t/t_clk_concat_vlt.pl @@ -18,10 +18,10 @@ compile( ); if ($Self->{vlt_all}) { - file_grep("$out_filename", qr/\/i); - file_grep("$out_filename", qr/\/i); - file_grep("$out_filename", qr/\/i); - file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); + file_grep("$out_filename", qr/\/i); } execute( diff --git a/test_regress/t/t_var_port_xml.out b/test_regress/t/t_var_port_xml.out index b2e6f9f4f..bf16c637b 100644 --- a/test_regress/t/t_var_port_xml.out +++ b/test_regress/t/t_var_port_xml.out @@ -57,54 +57,54 @@ - + - + - + - + - + - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + diff --git a/test_regress/t/t_xml_first.out b/test_regress/t/t_xml_first.out index 4c75a4867..b00ac18b9 100644 --- a/test_regress/t/t_xml_first.out +++ b/test_regress/t/t_xml_first.out @@ -18,9 +18,9 @@ - - - + + + @@ -49,9 +49,9 @@ - - - + + + @@ -68,9 +68,9 @@ - - - + + + diff --git a/test_regress/t/t_xml_flat.out b/test_regress/t/t_xml_flat.out index 4ba3a085a..853f82d5e 100644 --- a/test_regress/t/t_xml_flat.out +++ b/test_regress/t/t_xml_flat.out @@ -15,9 +15,9 @@ - - - + + + diff --git a/test_regress/t/t_xml_flat_no_inline_mod.out b/test_regress/t/t_xml_flat_no_inline_mod.out index 803aa990b..0ab79da52 100644 --- a/test_regress/t/t_xml_flat_no_inline_mod.out +++ b/test_regress/t/t_xml_flat_no_inline_mod.out @@ -15,7 +15,7 @@ - + diff --git a/test_regress/t/t_xml_flat_pub_mod.out b/test_regress/t/t_xml_flat_pub_mod.out index 5515cd69c..557437eb3 100644 --- a/test_regress/t/t_xml_flat_pub_mod.out +++ b/test_regress/t/t_xml_flat_pub_mod.out @@ -15,7 +15,7 @@ - + diff --git a/test_regress/t/t_xml_flat_vlvbound.out b/test_regress/t/t_xml_flat_vlvbound.out index ae5da8f13..86271d4b1 100644 --- a/test_regress/t/t_xml_flat_vlvbound.out +++ b/test_regress/t/t_xml_flat_vlvbound.out @@ -15,10 +15,10 @@ - - - - + + + + diff --git a/test_regress/t/t_xml_output.out b/test_regress/t/t_xml_output.out index 3426e21ae..645a7b61b 100644 --- a/test_regress/t/t_xml_output.out +++ b/test_regress/t/t_xml_output.out @@ -15,7 +15,7 @@ - + diff --git a/test_regress/t/t_xml_tag.out b/test_regress/t/t_xml_tag.out index 191ce8023..873eaa1a0 100644 --- a/test_regress/t/t_xml_tag.out +++ b/test_regress/t/t_xml_tag.out @@ -17,9 +17,9 @@ - - - + + +