gtkwave tcl script for adding specific signals

1.2k views Asked by At

I have a huge VCD file that I use in combination with gtkwave to observe certain signal behaviors. I have a list of signals stored into a .txt file which are the ones that I wish to probe. The thing is that by doing the insertion of the signals manually by hand is a painstakingly long process. So my question here is,

Is there a way, given the .txt file to compose a .tcl script that filters and adds the designated signals from the list to the waveform editor?

2

There are 2 answers

0
ex1led On BEST ANSWER

Well, after scouting on manuals and some gists I found here and there seems that there is a load of gtkwave instructions one can use that are listed (most of them) on the gtkwave manual (Appendix E) here. So in a nutshell all one has to do is to write a .tcl script in the following format:

# add_waves.tcl 
set sig_list [list sig_name_a, register_name\[32:0\], ... ] # note the escaping of the [,] brackets
gtkwave::addSignalsFromList $sig_list

and then invoke the gktwave as:

gtkwave VCD_file.vcd --script=add_waves.tcl

Furthermore, access to the GUI menu options are viable as well via the following syntax in tcl:

gtkwave::/Edit/<Option> <value>
0
Rafael Nicolas Trozzo On

I was facing this same situation and implemented the solution provided in the accepted answer.

However, I lost some time parsing from the .txt file, I just hadn't noticed that in that case the escaping of the [,] characters is not necessary, it's handled by tcl.

My final script that reads from a wave_names.txt file is:

proc listFromFile {filename} {
    set f [open $filename r]
    set data [split [string trim [read $f]]]
    close $f
    return $data
}

set sig_list [listFromFile wave_names.txt]

gtkwave::addSignalsFromList $sig_list