From 7d9e8a8d1a73bb066c7dde1a7218e42524b9446e Mon Sep 17 00:00:00 2001 From: Cesar_Strauss Date: Mon, 7 Sep 2020 12:08:07 +0100 Subject: [PATCH] Introduction to style formatting --- Documentation/gtkwave_tutorial.mdwn | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/Documentation/gtkwave_tutorial.mdwn b/Documentation/gtkwave_tutorial.mdwn index 2eb679b86..f142c3cdc 100644 --- a/Documentation/gtkwave_tutorial.mdwn +++ b/Documentation/gtkwave_tutorial.mdwn @@ -94,6 +94,35 @@ Recreate the document (you can change the file name): If you now run ``gtkwave color.gtkw``, you will see that ``op__sdir`` has the new color. +## Writing GTKWave documents, with style + +Let's say we want all input traces be orange, and all output traces be +yellow. To change them one by one, as we did with ``op__sdir``, would be +very tedious and verbose. Also, hardcoding the color name will make it +difficult to change it later. + +To solve this, lets create a style specification: + + style = { + 'in': {'color': 'orange'}, + 'out': {'color': 'yellow'} + } + +Then, change: + + ('op__sdir', {'color': 'orange'}) + +to: + + ('op__sdir', 'in') + +then (notice how we add ``style``): + + write_gtkw("style1.gtkw", "test_shifter.vcd", traces, style, module='top.shf') + +If you now run ``gtkwave style1.gtkw``, you will see that ``op__sdir`` +still has the new color. + # New signals at simulation time At simulation time, you can declare a new signal, and use it inside -- 2.30.2