From 32a50f48658d5250305a6a4ac8e738c93a44038f Mon Sep 17 00:00:00 2001 From: Cesar Strauss Date: Sun, 6 Dec 2020 08:47:37 -0300 Subject: [PATCH] Implement the "submodule" attribute When encountered, it is merged to the module path attribute, and consumed (it is not propagated to children). --- src/nmutil/gtkw.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/nmutil/gtkw.py b/src/nmutil/gtkw.py index 71eace0..53d5cb6 100644 --- a/src/nmutil/gtkw.py +++ b/src/nmutil/gtkw.py @@ -42,7 +42,8 @@ def write_gtkw(gtkw_name, vcd_name, gtkw_dom, gtkw_style=None, Attribute choices: - * module: instance path, for prepending to the signal name + * module: absolute path of the current module + * submodule: same as above, but relative * color: trace color * base: numerical base for value display * display: alternate text to display in the signal pane @@ -146,6 +147,16 @@ def write_gtkw(gtkw_name, vcd_name, gtkw_dom, gtkw_style=None, elif isinstance(node, dict): if 'comment' in node: gtkw.blank(node['comment']) + # merge the submodule into the module path + if 'submodule' in node_style: + node_module = node_style['submodule'] + if 'module' in node_style: + node_top_module = node_style['module'] + node_module = node_top_module + '.' + node_module + # update the module path + node_style['module'] = node_module + # don't propagate this attribute to children + del node_style['submodule'] # emit the group delimiters and walk over the child list if children is not None: # only emit a group if it has a name -- 2.30.2