From: Cesar_Strauss Date: Mon, 7 Sep 2020 11:08:07 +0000 (+0100) Subject: Introduction to style formatting X-Git-Tag: convert-csv-opcode-to-binary~2166 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7d9e8a8d1a73bb066c7dde1a7218e42524b9446e;p=libreriscv.git Introduction to style formatting --- 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