From 7bfc1a00a723cd91d8d52c146b5e7b45844a2ed6 Mon Sep 17 00:00:00 2001
From: Wilson Snyder <wsnyder@wsnyder.org>
Date: Thu, 14 Apr 2022 09:14:44 -0400
Subject: [PATCH] Fix tracing interfaces inside interfaces (#3309).

---
 Changes                                       |   2 +-
 src/V3Inline.cpp                              |   9 +-
 src/V3TraceDecl.cpp                           |  46 +++--
 test_regress/t/t_interface_ref_trace.out      |  25 ++-
 test_regress/t/t_interface_ref_trace.v        |   6 +
 test_regress/t/t_interface_ref_trace_fst.out  | 172 ++++++++++--------
 .../t/t_interface_ref_trace_fst_sc.out        | 172 ++++++++++--------
 7 files changed, 261 insertions(+), 171 deletions(-)

diff --git a/Changes b/Changes
index 91b355795..12f8458f1 100644
--- a/Changes
+++ b/Changes
@@ -18,10 +18,10 @@ Verilator 4.221 devel
 * Fix MSVC localtime_s (#3124).
 * Fix Bison 3.8.2 error (#3366). [elike-ypq]
 * Fix rare bug in -Oz (V3Localize) (#3286). [Geza Lore, Shunyao CAD]
+* Fix tracing interfaces inside interfaces (#3309). [Kevin Millis]
 * Fix filenames with dots overwriting debug .vpp files (#3373).
 * Fix including VK_USER_OBJS in make library (#3370). [Julien Margetts]
 
-
 Verilator 4.220 2022-03-12
 ==========================
 
diff --git a/src/V3Inline.cpp b/src/V3Inline.cpp
index eabbca566..2c451c62c 100644
--- a/src/V3Inline.cpp
+++ b/src/V3Inline.cpp
@@ -647,7 +647,11 @@ private:
             m_scope += "__DOT__" + nodep->name();
         }
 
-        if (AstModule* const modp = VN_CAST(nodep->modp(), Module)) {
+        if (VN_IS(nodep->modp(), Iface)) {
+            nodep->addIntfRefp(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();
@@ -666,9 +670,6 @@ private:
             }
 
             iterateChildren(modp);
-        } else if (VN_IS(nodep->modp(), Iface)) {
-            nodep->addIntfRefp(new AstIntfRef(nodep->fileline(), m_scope));
-            // No need to iterate on interface cells
         }
     }
     virtual void visit(AstAssignVarScope* nodep) override {
diff --git a/src/V3TraceDecl.cpp b/src/V3TraceDecl.cpp
index 5859ff819..15669c0d1 100644
--- a/src/V3TraceDecl.cpp
+++ b/src/V3TraceDecl.cpp
@@ -190,6 +190,27 @@ private:
 
     std::string getScopeChar(VltTraceScope sct) { return std::string(1, (char)(0x80 + sct)); }
 
+    std::string addAboveInterface(const std::string& scopeName) {
+        std::string out;
+        // Hierarchical interfaces didn't know if interface vs module
+        // above them. so convert a scope string to have the interface character.
+        // Uses list of scopes to see what's an interface above.
+        size_t begin = 0;
+        while (true) {
+            const size_t end = scopeName.find(' ', begin);
+            if (end == string::npos) break;
+            const string& extra = scopeName.substr(begin, end - begin);
+            out += extra;
+            if (m_scopeSubFuncps.count(out + getScopeChar(VLT_TRACE_SCOPE_INTERFACE) + " ")) {
+                out += getScopeChar(VLT_TRACE_SCOPE_INTERFACE) + " ";
+            } else {
+                out += " ";
+            }
+            begin = end + 1;
+        }
+        return out;
+    }
+
     void addTraceDecl(const VNumRange& arrayRange,
                       int widthOverride) {  // If !=0, is packed struct/array where basicp size
                                             // misreflects one element
@@ -199,8 +220,10 @@ private:
         } else if (const AstBasicDType* const bdtypep = m_traValuep->dtypep()->basicp()) {
             bitRange = bdtypep->nrange();
         }
-        addToSubFunc(new AstTraceDecl{m_traVscp->fileline(), m_traName, m_traVscp->varp(),
-                                      m_traValuep->cloneTree(false), bitRange, arrayRange});
+        auto* const newp
+            = new AstTraceDecl{m_traVscp->fileline(),         m_traName, m_traVscp->varp(),
+                               m_traValuep->cloneTree(false), bitRange,  arrayRange};
+        addToSubFunc(newp);
     }
 
     void addIgnore(const char* why) {
@@ -217,17 +240,14 @@ private:
         UASSERT_OBJ(!m_traVscp, nodep, "Should not nest");
         UASSERT_OBJ(m_traName.empty(), nodep, "Should not nest");
 
-        FileLine* const flp = nodep->fileline();
+        VL_RESTORER(m_currScopep);
         m_currScopep = nodep;
 
         // Gather all signals under this AstScope
         iterateChildrenConst(nodep);
 
         // If nothing to trace in this scope, then job done
-        if (m_signals.empty()) {
-            m_currScopep = nullptr;
-            return;
-        }
+        if (m_signals.empty()) return;
 
         // Sort signals, first by enclosing instance, then by source location, then by name
         std::stable_sort(m_signals.begin(), m_signals.end(), [](const Signal& a, const Signal& b) {
@@ -239,6 +259,7 @@ private:
         });
 
         // Build trace initialization functions for this AstScope
+        FileLine* const flp = nodep->fileline();
         PathAdjustor pathAdjustor{flp, [&](AstNodeStmt* stmtp) { addToSubFunc(stmtp); }};
         for (const Signal& signal : m_signals) {
             // Adjust name prefix based on path in hierarchy
@@ -278,6 +299,7 @@ private:
             scopeName = scopeName.substr(0, lastDot + 1);
             const size_t scopeLen = scopeName.length();
 
+            UASSERT_OBJ(cellp->intfRefp(), cellp, "Interface without tracing reference");
             for (AstIntfRef *irp = cellp->intfRefp(), *nextIrp; irp; irp = nextIrp) {
                 nextIrp = VN_AS(irp->nextp(), IntfRef);
 
@@ -288,6 +310,9 @@ private:
 
                 string scopeName = AstNode::vcdName(irp->name());
                 if (scopeName.substr(0, 4) == "TOP ") scopeName.erase(0, 4);
+                // Note this insert doesn't know what above is interfaces.
+                // Perhaps all scopes should be changed to include the VLT_TRACE_SCOPE characters.
+                // Instead we fix up when printing m_scopeSubFuncps
                 scopeName += getScopeChar(VLT_TRACE_SCOPE_INTERFACE) + ' ';
                 m_scopeSubFuncps.emplace(scopeName, m_subFuncps);
 
@@ -300,8 +325,6 @@ private:
             if (VString::startsWith(scopeName, "TOP ")) scopeName.erase(0, 4);
             m_scopeSubFuncps.emplace(scopeName, std::move(m_subFuncps));
         }
-
-        m_currScopep = nullptr;
     }
     virtual void visit(AstVarScope* nodep) override {
         UASSERT_OBJ(m_currScopep, nodep, "AstVarScope not under AstScope");
@@ -454,9 +477,10 @@ public:
         // Build top level trace initialization functions
         PathAdjustor pathAdjustor{flp, [&](AstNodeStmt* stmtp) { addToTopFunc(stmtp); }};
         for (const auto& item : m_scopeSubFuncps) {
+            const std::string scopeName = item.first;
+            const std::string scopeNameInterfaced = addAboveInterface(scopeName);
             // Adjust name prefix based on path in hierarchy
-            pathAdjustor.adjust(item.first);
-
+            pathAdjustor.adjust(scopeNameInterfaced);
             // Call all sub functions for this path
             for (AstCFunc* const subFuncp : item.second) {
                 AstCCall* const callp = new AstCCall{flp, subFuncp};
diff --git a/test_regress/t/t_interface_ref_trace.out b/test_regress/t/t_interface_ref_trace.out
index 67a6e327b..5e2a4c6b1 100644
--- a/test_regress/t/t_interface_ref_trace.out
+++ b/test_regress/t/t_interface_ref_trace.out
@@ -1,7 +1,6 @@
 $version Generated by VerilatedVcd $end
-$date Wed Dec  4 07:47:51 2019
- $end
-$timescale   1ps $end
+$date Thu Apr 14 07:06:40 2022 $end
+$timescale 1ps $end
 
  $scope module top $end
   $var wire  1 0 clk $end
@@ -57,6 +56,10 @@ $timescale   1ps $end
      $var wire  1 0 clk $end
      $var wire 32 # cyc [31:0] $end
      $var wire 32 * value [31:0] $end
+     $scope interface inner $end
+      $var wire 32 # cyc [31:0] $end
+      $var wire 32 3 value [31:0] $end
+     $upscope $end
      $scope struct the_struct $end
       $var wire 32 + val100 [31:0] $end
       $var wire 32 , val200 [31:0] $end
@@ -130,6 +133,10 @@ $timescale   1ps $end
      $var wire  1 0 clk $end
      $var wire 32 # cyc [31:0] $end
      $var wire 32 - value [31:0] $end
+     $scope interface inner $end
+      $var wire 32 # cyc [31:0] $end
+      $var wire 32 4 value [31:0] $end
+     $upscope $end
      $scope struct the_struct $end
       $var wire 32 . val100 [31:0] $end
       $var wire 32 / val200 [31:0] $end
@@ -180,6 +187,10 @@ $timescale   1ps $end
     $var wire  1 0 clk $end
     $var wire 32 # cyc [31:0] $end
     $var wire 32 $ value [31:0] $end
+    $scope interface inner $end
+     $var wire 32 # cyc [31:0] $end
+     $var wire 32 1 value [31:0] $end
+    $upscope $end
     $scope struct the_struct $end
      $var wire 32 % val100 [31:0] $end
      $var wire 32 & val200 [31:0] $end
@@ -189,6 +200,10 @@ $timescale   1ps $end
     $var wire  1 0 clk $end
     $var wire 32 # cyc [31:0] $end
     $var wire 32 ' value [31:0] $end
+    $scope interface inner $end
+     $var wire 32 # cyc [31:0] $end
+     $var wire 32 2 value [31:0] $end
+    $upscope $end
     $scope struct the_struct $end
      $var wire 32 ( val100 [31:0] $end
      $var wire 32 ) val200 [31:0] $end
@@ -236,6 +251,10 @@ b00000000000000000000001111101010 -
 b00000000000000000000010001001110 .
 b00000000000000000000010010110010 /
 00
+b00000000000000000000000000000000 1
+b00000000000000000000000000000000 2
+b00000000000000000000000000000000 3
+b00000000000000000000000000000000 4
 #10
 b00000000000000000000000000000001 #
 b00000000000000000000000000000010 $
diff --git a/test_regress/t/t_interface_ref_trace.v b/test_regress/t/t_interface_ref_trace.v
index a3fabda04..0f2577d47 100644
--- a/test_regress/t/t_interface_ref_trace.v
+++ b/test_regress/t/t_interface_ref_trace.v
@@ -11,10 +11,16 @@ typedef struct packed {
    integer     val200;
 } struct_t;
 
+// This interface is not connected to any cells
+interface ifc_inner(input integer cyc);
+   integer     value;
+endinterface
+
 interface ifc (input logic clk,
                input integer cyc);
    integer 		     value;
    struct_t the_struct;
+   ifc_inner inner (.*);
 endinterface
 
 module t (/*AUTOARG*/
diff --git a/test_regress/t/t_interface_ref_trace_fst.out b/test_regress/t/t_interface_ref_trace_fst.out
index f26bb0647..858d03801 100644
--- a/test_regress/t/t_interface_ref_trace_fst.out
+++ b/test_regress/t/t_interface_ref_trace_fst.out
@@ -1,5 +1,5 @@
 $date
-	Tue Feb 22 23:55:07 2022
+	Thu Apr 14 07:06:50 2022
 
 $end
 $version
@@ -59,6 +59,10 @@ $upscope $end
 $upscope $end
 $upscope $end
 $scope interface intf_in_sub_all $end
+$scope interface inner $end
+$var wire 32 " cyc [31:0] $end
+$var integer 32 , value [31:0] $end
+$upscope $end
 $var wire 1 ! clk $end
 $var wire 32 " cyc [31:0] $end
 $var integer 32 ) value [31:0] $end
@@ -113,10 +117,10 @@ $scope module ac3 $end
 $scope interface intf_for_check $end
 $var wire 1 ! clk $end
 $var wire 32 " cyc [31:0] $end
-$var integer 32 , value [31:0] $end
+$var integer 32 - value [31:0] $end
 $scope struct the_struct $end
-$var logic 32 - val100 [31:0] $end
-$var logic 32 . val200 [31:0] $end
+$var logic 32 . val100 [31:0] $end
+$var logic 32 / val200 [31:0] $end
 $upscope $end
 $upscope $end
 $upscope $end
@@ -124,20 +128,24 @@ $scope module as3 $end
 $scope interface intf_for_struct $end
 $var wire 1 ! clk $end
 $var wire 32 " cyc [31:0] $end
-$var integer 32 , value [31:0] $end
+$var integer 32 - value [31:0] $end
 $scope struct the_struct $end
-$var logic 32 - val100 [31:0] $end
-$var logic 32 . val200 [31:0] $end
+$var logic 32 . val100 [31:0] $end
+$var logic 32 / val200 [31:0] $end
 $upscope $end
 $upscope $end
 $upscope $end
 $scope interface intf_in_sub_all $end
+$scope interface inner $end
+$var wire 32 " cyc [31:0] $end
+$var integer 32 0 value [31:0] $end
+$upscope $end
 $var wire 1 ! clk $end
 $var wire 32 " cyc [31:0] $end
-$var integer 32 , value [31:0] $end
+$var integer 32 - value [31:0] $end
 $scope struct the_struct $end
-$var logic 32 - val100 [31:0] $end
-$var logic 32 . val200 [31:0] $end
+$var logic 32 . val100 [31:0] $end
+$var logic 32 / val200 [31:0] $end
 $upscope $end
 $upscope $end
 $scope interface intf_one $end
@@ -182,6 +190,10 @@ $upscope $end
 $upscope $end
 $upscope $end
 $scope interface intf_1 $end
+$scope interface inner $end
+$var wire 32 " cyc [31:0] $end
+$var integer 32 1 value [31:0] $end
+$upscope $end
 $var wire 1 ! clk $end
 $var wire 32 " cyc [31:0] $end
 $var integer 32 # value [31:0] $end
@@ -191,6 +203,10 @@ $var logic 32 % val200 [31:0] $end
 $upscope $end
 $upscope $end
 $scope interface intf_2 $end
+$scope interface inner $end
+$var wire 32 " cyc [31:0] $end
+$var integer 32 2 value [31:0] $end
+$upscope $end
 $var wire 1 ! clk $end
 $var wire 32 " cyc [31:0] $end
 $var integer 32 & value [31:0] $end
@@ -226,9 +242,13 @@ $upscope $end
 $enddefinitions $end
 #0
 $dumpvars
-b00000000000000000000010010110010 .
-b00000000000000000000010001001110 -
-b00000000000000000000001111101010 ,
+b00000000000000000000000000000000 2
+b00000000000000000000000000000000 1
+b00000000000000000000000000000000 0
+b00000000000000000000010010110010 /
+b00000000000000000000010001001110 .
+b00000000000000000000001111101010 -
+b00000000000000000000000000000000 ,
 b00000000000000000000010010110001 +
 b00000000000000000000010001001101 *
 b00000000000000000000001111101001 )
@@ -253,16 +273,16 @@ b00000000000000000000000011001011 (
 b00000000000000000000001111101010 )
 b00000000000000000000010001001110 *
 b00000000000000000000010010110010 +
-b00000000000000000000001111101011 ,
-b00000000000000000000010001001111 -
-b00000000000000000000010010110011 .
+b00000000000000000000001111101011 -
+b00000000000000000000010001001111 .
+b00000000000000000000010010110011 /
 #15
 0!
 #20
 1!
-b00000000000000000000010010110100 .
-b00000000000000000000010001010000 -
-b00000000000000000000001111101100 ,
+b00000000000000000000010010110100 /
+b00000000000000000000010001010000 .
+b00000000000000000000001111101100 -
 b00000000000000000000010010110011 +
 b00000000000000000000010001001111 *
 b00000000000000000000001111101011 )
@@ -287,16 +307,16 @@ b00000000000000000000000011001101 (
 b00000000000000000000001111101100 )
 b00000000000000000000010001010000 *
 b00000000000000000000010010110100 +
-b00000000000000000000001111101101 ,
-b00000000000000000000010001010001 -
-b00000000000000000000010010110101 .
+b00000000000000000000001111101101 -
+b00000000000000000000010001010001 .
+b00000000000000000000010010110101 /
 #35
 0!
 #40
 1!
-b00000000000000000000010010110110 .
-b00000000000000000000010001010010 -
-b00000000000000000000001111101110 ,
+b00000000000000000000010010110110 /
+b00000000000000000000010001010010 .
+b00000000000000000000001111101110 -
 b00000000000000000000010010110101 +
 b00000000000000000000010001010001 *
 b00000000000000000000001111101101 )
@@ -321,16 +341,16 @@ b00000000000000000000000011001111 (
 b00000000000000000000001111101110 )
 b00000000000000000000010001010010 *
 b00000000000000000000010010110110 +
-b00000000000000000000001111101111 ,
-b00000000000000000000010001010011 -
-b00000000000000000000010010110111 .
+b00000000000000000000001111101111 -
+b00000000000000000000010001010011 .
+b00000000000000000000010010110111 /
 #55
 0!
 #60
 1!
-b00000000000000000000010010111000 .
-b00000000000000000000010001010100 -
-b00000000000000000000001111110000 ,
+b00000000000000000000010010111000 /
+b00000000000000000000010001010100 .
+b00000000000000000000001111110000 -
 b00000000000000000000010010110111 +
 b00000000000000000000010001010011 *
 b00000000000000000000001111101111 )
@@ -355,16 +375,16 @@ b00000000000000000000000011010001 (
 b00000000000000000000001111110000 )
 b00000000000000000000010001010100 *
 b00000000000000000000010010111000 +
-b00000000000000000000001111110001 ,
-b00000000000000000000010001010101 -
-b00000000000000000000010010111001 .
+b00000000000000000000001111110001 -
+b00000000000000000000010001010101 .
+b00000000000000000000010010111001 /
 #75
 0!
 #80
 1!
-b00000000000000000000010010111010 .
-b00000000000000000000010001010110 -
-b00000000000000000000001111110010 ,
+b00000000000000000000010010111010 /
+b00000000000000000000010001010110 .
+b00000000000000000000001111110010 -
 b00000000000000000000010010111001 +
 b00000000000000000000010001010101 *
 b00000000000000000000001111110001 )
@@ -389,16 +409,16 @@ b00000000000000000000000011010011 (
 b00000000000000000000001111110010 )
 b00000000000000000000010001010110 *
 b00000000000000000000010010111010 +
-b00000000000000000000001111110011 ,
-b00000000000000000000010001010111 -
-b00000000000000000000010010111011 .
+b00000000000000000000001111110011 -
+b00000000000000000000010001010111 .
+b00000000000000000000010010111011 /
 #95
 0!
 #100
 1!
-b00000000000000000000010010111100 .
-b00000000000000000000010001011000 -
-b00000000000000000000001111110100 ,
+b00000000000000000000010010111100 /
+b00000000000000000000010001011000 .
+b00000000000000000000001111110100 -
 b00000000000000000000010010111011 +
 b00000000000000000000010001010111 *
 b00000000000000000000001111110011 )
@@ -423,16 +443,16 @@ b00000000000000000000000011010101 (
 b00000000000000000000001111110100 )
 b00000000000000000000010001011000 *
 b00000000000000000000010010111100 +
-b00000000000000000000001111110101 ,
-b00000000000000000000010001011001 -
-b00000000000000000000010010111101 .
+b00000000000000000000001111110101 -
+b00000000000000000000010001011001 .
+b00000000000000000000010010111101 /
 #115
 0!
 #120
 1!
-b00000000000000000000010010111110 .
-b00000000000000000000010001011010 -
-b00000000000000000000001111110110 ,
+b00000000000000000000010010111110 /
+b00000000000000000000010001011010 .
+b00000000000000000000001111110110 -
 b00000000000000000000010010111101 +
 b00000000000000000000010001011001 *
 b00000000000000000000001111110101 )
@@ -457,16 +477,16 @@ b00000000000000000000000011010111 (
 b00000000000000000000001111110110 )
 b00000000000000000000010001011010 *
 b00000000000000000000010010111110 +
-b00000000000000000000001111110111 ,
-b00000000000000000000010001011011 -
-b00000000000000000000010010111111 .
+b00000000000000000000001111110111 -
+b00000000000000000000010001011011 .
+b00000000000000000000010010111111 /
 #135
 0!
 #140
 1!
-b00000000000000000000010011000000 .
-b00000000000000000000010001011100 -
-b00000000000000000000001111111000 ,
+b00000000000000000000010011000000 /
+b00000000000000000000010001011100 .
+b00000000000000000000001111111000 -
 b00000000000000000000010010111111 +
 b00000000000000000000010001011011 *
 b00000000000000000000001111110111 )
@@ -491,16 +511,16 @@ b00000000000000000000000011011001 (
 b00000000000000000000001111111000 )
 b00000000000000000000010001011100 *
 b00000000000000000000010011000000 +
-b00000000000000000000001111111001 ,
-b00000000000000000000010001011101 -
-b00000000000000000000010011000001 .
+b00000000000000000000001111111001 -
+b00000000000000000000010001011101 .
+b00000000000000000000010011000001 /
 #155
 0!
 #160
 1!
-b00000000000000000000010011000010 .
-b00000000000000000000010001011110 -
-b00000000000000000000001111111010 ,
+b00000000000000000000010011000010 /
+b00000000000000000000010001011110 .
+b00000000000000000000001111111010 -
 b00000000000000000000010011000001 +
 b00000000000000000000010001011101 *
 b00000000000000000000001111111001 )
@@ -525,16 +545,16 @@ b00000000000000000000000011011011 (
 b00000000000000000000001111111010 )
 b00000000000000000000010001011110 *
 b00000000000000000000010011000010 +
-b00000000000000000000001111111011 ,
-b00000000000000000000010001011111 -
-b00000000000000000000010011000011 .
+b00000000000000000000001111111011 -
+b00000000000000000000010001011111 .
+b00000000000000000000010011000011 /
 #175
 0!
 #180
 1!
-b00000000000000000000010011000100 .
-b00000000000000000000010001100000 -
-b00000000000000000000001111111100 ,
+b00000000000000000000010011000100 /
+b00000000000000000000010001100000 .
+b00000000000000000000001111111100 -
 b00000000000000000000010011000011 +
 b00000000000000000000010001011111 *
 b00000000000000000000001111111011 )
@@ -559,16 +579,16 @@ b00000000000000000000000011011101 (
 b00000000000000000000001111111100 )
 b00000000000000000000010001100000 *
 b00000000000000000000010011000100 +
-b00000000000000000000001111111101 ,
-b00000000000000000000010001100001 -
-b00000000000000000000010011000101 .
+b00000000000000000000001111111101 -
+b00000000000000000000010001100001 .
+b00000000000000000000010011000101 /
 #195
 0!
 #200
 1!
-b00000000000000000000010011000110 .
-b00000000000000000000010001100010 -
-b00000000000000000000001111111110 ,
+b00000000000000000000010011000110 /
+b00000000000000000000010001100010 .
+b00000000000000000000001111111110 -
 b00000000000000000000010011000101 +
 b00000000000000000000010001100001 *
 b00000000000000000000001111111101 )
@@ -593,6 +613,6 @@ b00000000000000000000000011011111 (
 b00000000000000000000001111111110 )
 b00000000000000000000010001100010 *
 b00000000000000000000010011000110 +
-b00000000000000000000001111111111 ,
-b00000000000000000000010001100011 -
-b00000000000000000000010011000111 .
+b00000000000000000000001111111111 -
+b00000000000000000000010001100011 .
+b00000000000000000000010011000111 /
diff --git a/test_regress/t/t_interface_ref_trace_fst_sc.out b/test_regress/t/t_interface_ref_trace_fst_sc.out
index dbbfe4f3b..7131845ae 100644
--- a/test_regress/t/t_interface_ref_trace_fst_sc.out
+++ b/test_regress/t/t_interface_ref_trace_fst_sc.out
@@ -1,5 +1,5 @@
 $date
-	Tue Feb 22 23:55:19 2022
+	Thu Apr 14 07:06:59 2022
 
 $end
 $version
@@ -58,6 +58,10 @@ $upscope $end
 $upscope $end
 $upscope $end
 $scope interface intf_in_sub_all $end
+$scope interface inner $end
+$var wire 32 " cyc [31:0] $end
+$var integer 32 , value [31:0] $end
+$upscope $end
 $var wire 1 ! clk $end
 $var wire 32 " cyc [31:0] $end
 $var integer 32 ) value [31:0] $end
@@ -112,10 +116,10 @@ $scope module ac3 $end
 $scope interface intf_for_check $end
 $var wire 1 ! clk $end
 $var wire 32 " cyc [31:0] $end
-$var integer 32 , value [31:0] $end
+$var integer 32 - value [31:0] $end
 $scope struct the_struct $end
-$var logic 32 - val100 [31:0] $end
-$var logic 32 . val200 [31:0] $end
+$var logic 32 . val100 [31:0] $end
+$var logic 32 / val200 [31:0] $end
 $upscope $end
 $upscope $end
 $upscope $end
@@ -123,20 +127,24 @@ $scope module as3 $end
 $scope interface intf_for_struct $end
 $var wire 1 ! clk $end
 $var wire 32 " cyc [31:0] $end
-$var integer 32 , value [31:0] $end
+$var integer 32 - value [31:0] $end
 $scope struct the_struct $end
-$var logic 32 - val100 [31:0] $end
-$var logic 32 . val200 [31:0] $end
+$var logic 32 . val100 [31:0] $end
+$var logic 32 / val200 [31:0] $end
 $upscope $end
 $upscope $end
 $upscope $end
 $scope interface intf_in_sub_all $end
+$scope interface inner $end
+$var wire 32 " cyc [31:0] $end
+$var integer 32 0 value [31:0] $end
+$upscope $end
 $var wire 1 ! clk $end
 $var wire 32 " cyc [31:0] $end
-$var integer 32 , value [31:0] $end
+$var integer 32 - value [31:0] $end
 $scope struct the_struct $end
-$var logic 32 - val100 [31:0] $end
-$var logic 32 . val200 [31:0] $end
+$var logic 32 . val100 [31:0] $end
+$var logic 32 / val200 [31:0] $end
 $upscope $end
 $upscope $end
 $scope interface intf_one $end
@@ -181,6 +189,10 @@ $upscope $end
 $upscope $end
 $upscope $end
 $scope interface intf_1 $end
+$scope interface inner $end
+$var wire 32 " cyc [31:0] $end
+$var integer 32 1 value [31:0] $end
+$upscope $end
 $var wire 1 ! clk $end
 $var wire 32 " cyc [31:0] $end
 $var integer 32 # value [31:0] $end
@@ -190,6 +202,10 @@ $var logic 32 % val200 [31:0] $end
 $upscope $end
 $upscope $end
 $scope interface intf_2 $end
+$scope interface inner $end
+$var wire 32 " cyc [31:0] $end
+$var integer 32 2 value [31:0] $end
+$upscope $end
 $var wire 1 ! clk $end
 $var wire 32 " cyc [31:0] $end
 $var integer 32 & value [31:0] $end
@@ -225,9 +241,13 @@ $upscope $end
 $enddefinitions $end
 #0
 $dumpvars
-b00000000000000000000010010110010 .
-b00000000000000000000010001001110 -
-b00000000000000000000001111101010 ,
+b00000000000000000000000000000000 2
+b00000000000000000000000000000000 1
+b00000000000000000000000000000000 0
+b00000000000000000000010010110010 /
+b00000000000000000000010001001110 .
+b00000000000000000000001111101010 -
+b00000000000000000000000000000000 ,
 b00000000000000000000010010110001 +
 b00000000000000000000010001001101 *
 b00000000000000000000001111101001 )
@@ -252,9 +272,9 @@ b00000000000000000000000011001011 (
 b00000000000000000000001111101010 )
 b00000000000000000000010001001110 *
 b00000000000000000000010010110010 +
-b00000000000000000000001111101011 ,
-b00000000000000000000010001001111 -
-b00000000000000000000010010110011 .
+b00000000000000000000001111101011 -
+b00000000000000000000010001001111 .
+b00000000000000000000010010110011 /
 #11
 #12
 #13
@@ -267,9 +287,9 @@ b00000000000000000000010010110011 .
 #19
 #20
 1!
-b00000000000000000000010010110100 .
-b00000000000000000000010001010000 -
-b00000000000000000000001111101100 ,
+b00000000000000000000010010110100 /
+b00000000000000000000010001010000 .
+b00000000000000000000001111101100 -
 b00000000000000000000010010110011 +
 b00000000000000000000010001001111 *
 b00000000000000000000001111101011 )
@@ -302,9 +322,9 @@ b00000000000000000000000011001101 (
 b00000000000000000000001111101100 )
 b00000000000000000000010001010000 *
 b00000000000000000000010010110100 +
-b00000000000000000000001111101101 ,
-b00000000000000000000010001010001 -
-b00000000000000000000010010110101 .
+b00000000000000000000001111101101 -
+b00000000000000000000010001010001 .
+b00000000000000000000010010110101 /
 #31
 #32
 #33
@@ -317,9 +337,9 @@ b00000000000000000000010010110101 .
 #39
 #40
 1!
-b00000000000000000000010010110110 .
-b00000000000000000000010001010010 -
-b00000000000000000000001111101110 ,
+b00000000000000000000010010110110 /
+b00000000000000000000010001010010 .
+b00000000000000000000001111101110 -
 b00000000000000000000010010110101 +
 b00000000000000000000010001010001 *
 b00000000000000000000001111101101 )
@@ -352,9 +372,9 @@ b00000000000000000000000011001111 (
 b00000000000000000000001111101110 )
 b00000000000000000000010001010010 *
 b00000000000000000000010010110110 +
-b00000000000000000000001111101111 ,
-b00000000000000000000010001010011 -
-b00000000000000000000010010110111 .
+b00000000000000000000001111101111 -
+b00000000000000000000010001010011 .
+b00000000000000000000010010110111 /
 #51
 #52
 #53
@@ -367,9 +387,9 @@ b00000000000000000000010010110111 .
 #59
 #60
 1!
-b00000000000000000000010010111000 .
-b00000000000000000000010001010100 -
-b00000000000000000000001111110000 ,
+b00000000000000000000010010111000 /
+b00000000000000000000010001010100 .
+b00000000000000000000001111110000 -
 b00000000000000000000010010110111 +
 b00000000000000000000010001010011 *
 b00000000000000000000001111101111 )
@@ -402,9 +422,9 @@ b00000000000000000000000011010001 (
 b00000000000000000000001111110000 )
 b00000000000000000000010001010100 *
 b00000000000000000000010010111000 +
-b00000000000000000000001111110001 ,
-b00000000000000000000010001010101 -
-b00000000000000000000010010111001 .
+b00000000000000000000001111110001 -
+b00000000000000000000010001010101 .
+b00000000000000000000010010111001 /
 #71
 #72
 #73
@@ -417,9 +437,9 @@ b00000000000000000000010010111001 .
 #79
 #80
 1!
-b00000000000000000000010010111010 .
-b00000000000000000000010001010110 -
-b00000000000000000000001111110010 ,
+b00000000000000000000010010111010 /
+b00000000000000000000010001010110 .
+b00000000000000000000001111110010 -
 b00000000000000000000010010111001 +
 b00000000000000000000010001010101 *
 b00000000000000000000001111110001 )
@@ -452,9 +472,9 @@ b00000000000000000000000011010011 (
 b00000000000000000000001111110010 )
 b00000000000000000000010001010110 *
 b00000000000000000000010010111010 +
-b00000000000000000000001111110011 ,
-b00000000000000000000010001010111 -
-b00000000000000000000010010111011 .
+b00000000000000000000001111110011 -
+b00000000000000000000010001010111 .
+b00000000000000000000010010111011 /
 #91
 #92
 #93
@@ -467,9 +487,9 @@ b00000000000000000000010010111011 .
 #99
 #100
 1!
-b00000000000000000000010010111100 .
-b00000000000000000000010001011000 -
-b00000000000000000000001111110100 ,
+b00000000000000000000010010111100 /
+b00000000000000000000010001011000 .
+b00000000000000000000001111110100 -
 b00000000000000000000010010111011 +
 b00000000000000000000010001010111 *
 b00000000000000000000001111110011 )
@@ -502,9 +522,9 @@ b00000000000000000000000011010101 (
 b00000000000000000000001111110100 )
 b00000000000000000000010001011000 *
 b00000000000000000000010010111100 +
-b00000000000000000000001111110101 ,
-b00000000000000000000010001011001 -
-b00000000000000000000010010111101 .
+b00000000000000000000001111110101 -
+b00000000000000000000010001011001 .
+b00000000000000000000010010111101 /
 #111
 #112
 #113
@@ -517,9 +537,9 @@ b00000000000000000000010010111101 .
 #119
 #120
 1!
-b00000000000000000000010010111110 .
-b00000000000000000000010001011010 -
-b00000000000000000000001111110110 ,
+b00000000000000000000010010111110 /
+b00000000000000000000010001011010 .
+b00000000000000000000001111110110 -
 b00000000000000000000010010111101 +
 b00000000000000000000010001011001 *
 b00000000000000000000001111110101 )
@@ -552,9 +572,9 @@ b00000000000000000000000011010111 (
 b00000000000000000000001111110110 )
 b00000000000000000000010001011010 *
 b00000000000000000000010010111110 +
-b00000000000000000000001111110111 ,
-b00000000000000000000010001011011 -
-b00000000000000000000010010111111 .
+b00000000000000000000001111110111 -
+b00000000000000000000010001011011 .
+b00000000000000000000010010111111 /
 #131
 #132
 #133
@@ -567,9 +587,9 @@ b00000000000000000000010010111111 .
 #139
 #140
 1!
-b00000000000000000000010011000000 .
-b00000000000000000000010001011100 -
-b00000000000000000000001111111000 ,
+b00000000000000000000010011000000 /
+b00000000000000000000010001011100 .
+b00000000000000000000001111111000 -
 b00000000000000000000010010111111 +
 b00000000000000000000010001011011 *
 b00000000000000000000001111110111 )
@@ -602,9 +622,9 @@ b00000000000000000000000011011001 (
 b00000000000000000000001111111000 )
 b00000000000000000000010001011100 *
 b00000000000000000000010011000000 +
-b00000000000000000000001111111001 ,
-b00000000000000000000010001011101 -
-b00000000000000000000010011000001 .
+b00000000000000000000001111111001 -
+b00000000000000000000010001011101 .
+b00000000000000000000010011000001 /
 #151
 #152
 #153
@@ -617,9 +637,9 @@ b00000000000000000000010011000001 .
 #159
 #160
 1!
-b00000000000000000000010011000010 .
-b00000000000000000000010001011110 -
-b00000000000000000000001111111010 ,
+b00000000000000000000010011000010 /
+b00000000000000000000010001011110 .
+b00000000000000000000001111111010 -
 b00000000000000000000010011000001 +
 b00000000000000000000010001011101 *
 b00000000000000000000001111111001 )
@@ -652,9 +672,9 @@ b00000000000000000000000011011011 (
 b00000000000000000000001111111010 )
 b00000000000000000000010001011110 *
 b00000000000000000000010011000010 +
-b00000000000000000000001111111011 ,
-b00000000000000000000010001011111 -
-b00000000000000000000010011000011 .
+b00000000000000000000001111111011 -
+b00000000000000000000010001011111 .
+b00000000000000000000010011000011 /
 #171
 #172
 #173
@@ -667,9 +687,9 @@ b00000000000000000000010011000011 .
 #179
 #180
 1!
-b00000000000000000000010011000100 .
-b00000000000000000000010001100000 -
-b00000000000000000000001111111100 ,
+b00000000000000000000010011000100 /
+b00000000000000000000010001100000 .
+b00000000000000000000001111111100 -
 b00000000000000000000010011000011 +
 b00000000000000000000010001011111 *
 b00000000000000000000001111111011 )
@@ -702,9 +722,9 @@ b00000000000000000000000011011101 (
 b00000000000000000000001111111100 )
 b00000000000000000000010001100000 *
 b00000000000000000000010011000100 +
-b00000000000000000000001111111101 ,
-b00000000000000000000010001100001 -
-b00000000000000000000010011000101 .
+b00000000000000000000001111111101 -
+b00000000000000000000010001100001 .
+b00000000000000000000010011000101 /
 #191
 #192
 #193
@@ -717,9 +737,9 @@ b00000000000000000000010011000101 .
 #199
 #200
 1!
-b00000000000000000000010011000110 .
-b00000000000000000000010001100010 -
-b00000000000000000000001111111110 ,
+b00000000000000000000010011000110 /
+b00000000000000000000010001100010 .
+b00000000000000000000001111111110 -
 b00000000000000000000010011000101 +
 b00000000000000000000010001100001 *
 b00000000000000000000001111111101 )
@@ -752,9 +772,9 @@ b00000000000000000000000011011111 (
 b00000000000000000000001111111110 )
 b00000000000000000000010001100010 *
 b00000000000000000000010011000110 +
-b00000000000000000000001111111111 ,
-b00000000000000000000010001100011 -
-b00000000000000000000010011000111 .
+b00000000000000000000001111111111 -
+b00000000000000000000010001100011 .
+b00000000000000000000010011000111 /
 #211
 #212
 #213