Add support for displaying individual bits from wide signals
authorCesar Strauss <cestrauss@gmail.com>
Tue, 17 Nov 2020 10:53:37 +0000 (07:53 -0300)
committerCesar Strauss <cestrauss@gmail.com>
Tue, 17 Nov 2020 10:53:37 +0000 (07:53 -0300)
src/nmutil/gtkw.py

index ff1b237fcb61508fd67ed3de9a34378a830fac92..83a7db1722e3c3362d3c491a9f6824ffd368a883 100644 (file)
@@ -35,6 +35,7 @@ def write_gtkw(gtkw_name, vcd_name, gtkw_dom, gtkw_style=None,
     * base: numerical base for value display
     * display: alternate text to display in the signal pane
     * comment: comment to display in the signal pane
+    * bit: select a bit from a wide signal. MSB is zero, unfortunately
 
     **gtkw_dom format**
 
@@ -144,7 +145,12 @@ def write_gtkw(gtkw_name, vcd_name, gtkw_dom, gtkw_style=None,
                     node_color = colors.get(node_style.get('color'))
                     node_base = node_style.get('base')
                     display = node_style.get('display')
-                    gtkw.trace(signal_name, color=node_color,
-                               datafmt=node_base, alias=display)
+                    if 'bit' not in node_style:
+                        gtkw.trace(signal_name, color=node_color,
+                                   datafmt=node_base, alias=display)
+                    else:
+                        bit = node_style['bit']
+                        gtkw.trace_bit(bit, signal_name, color=node_color,
+                                       alias=display)
 
         walk(gtkw_dom, root_style)