From 5001767f3aa1860929982a3ba366615a4108ca51 Mon Sep 17 00:00:00 2001 From: Cesar Strauss Date: Sun, 23 Aug 2020 14:44:54 -0300 Subject: [PATCH] Add color style --- src/soc/experiment/alu_fsm.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/soc/experiment/alu_fsm.py b/src/soc/experiment/alu_fsm.py index 6f5de4fd..0079bbd5 100644 --- a/src/soc/experiment/alu_fsm.py +++ b/src/soc/experiment/alu_fsm.py @@ -294,6 +294,18 @@ def write_gtkw(gtkw_name, vcd_name, gtkw_style, gtkw_dom, In place of a class name, an inline class description can be used. ``(signal, {attribute: value, ...}, ...)`` """ + colors = { + 'blue': GTKWColor.blue, + 'cycle': GTKWColor.cycle, + 'green': GTKWColor.green, + 'indigo': GTKWColor.indigo, + 'normal': GTKWColor.normal, + 'orange': GTKWColor.orange, + 'red': GTKWColor.red, + 'violet': GTKWColor.violet, + 'yellow': GTKWColor.yellow, + } + with open(gtkw_name, "wt") as gtkw_file: gtkw = GTKWSave(gtkw_file) if loc is not None: @@ -348,7 +360,10 @@ def write_gtkw(gtkw_name, vcd_name, gtkw_style, gtkw_dom, # prepend module name to signal if 'module' in node_style: signal_name = node_style['module'] + '.' + signal_name - gtkw.trace(signal_name) + color = None + if 'color' in node_style: + color = colors[node_style['color']] + gtkw.trace(signal_name, color=color) walk(gtkw_dom, root_style) -- 2.30.2