Modelsim "add waves" script
A very useful script that i use often for VHDL development is a TCL script that will recursively step through from a certain point in the hierarchy and add elements for each component below that level to a group in the wave window.
Something like this in TCL:
add wave -noupdate -group tb /top_tb/* add wave -noupdate -group dut /top_tb/dut/* add wave -noupdate -group dut -group module1 /top_tb/dut/module1/*
Can be done recursively using a function like as follows which utilizes modelsim's find commands.
proc add_waves_recursive {inst level group} { if {[expr{$level-1}]==0} { add wave -noupdate $group -group [lrange [split $inst "/"] end end] $inst/* return } set wg [find instances $inst] if {[llength $wg]==0} { add wave -noupdate $group -group [lrange [split [lindex $g 0] "/"] end end] [lindex $g 0]/* return } foreach s $wg { set g [split $s " "] add_waves_recursive{[lindex $g 0]/* [expr{$level-1}] "-group [lrange [split [lindex $g 0] "/"] end end]"} } }
This type of script is awesome because it dynamically figures out new signals that are added to the design. One real pain, however, is that types derived from std_logic, like unsigned or signed, do not automatically get a designated radix of decimal or unsigned. This means to view things in that manner you have to go and update the elements radix every time you redo the signals.
My question to sigasi is this. Would it be possible to leverage your tools understanding of the signals present in a design to create an annotated list of add wave commands that have the proper radix and are sorted in the groups structure shown above?
In much the same way that the tool creates a makefile, walk the hierarchy and create a TCL script which adds a new group for each module in the hierarchy and all of its signals with the correct radix indicated.
Sample script output:
add wave -noupdate -group tb -radix decimal /top_tb/signal1 add wave -noupdate -group tb -radix decimal /top_tb/signal2 add wave -noupdate -group tb -radix decimal /top_tb/signal3 add wave -noupdate -group tb -radix unsigned /top_tb/signal4 add wave -noupdate -group tb -group dut -radix decimal /top_tb/dut/signal0 add wave -noupdate -group tb -group dut -radix decimal /top_tb/dut/signal1 add wave -noupdate -group tb -group dut -radix decimal /top_tb/dut/signal2 add wave -noupdate -group dut -group dut -group module1 -radix unsigned /top_tb/dut/module1/signal0 add wave -noupdate -group dut -group dut -group module1 -radix unsigned /top_tb/dut/module1/signal1 add wave -noupdate -group dut -group dut -group module1 -radix unsigned /top_tb/dut/module1/signal2
The feature could be further expanded to analyze the fixed point types and add the proper fixed point radix for those signals as well.
I believe this would be a great addition to your tool.
- Forums:
Hi Mike, The idea sounds
Hi Mike,
The idea sounds interesting. We will need to figure out more specific design specs before we can move to action, though.
There are other requests for generating text files from the project: documentation, hierarchy file more build scripts, etc.
Traditional EDA tools have a gazillion options that nobody uses. As an EDA2.0 company, we have an approach of making the user interface as simple as possible (but no simpler). So, before we start generating more and more files, I would want to pause. What will be the UI? Where will you specify which scripts should be generated? And how do you select the options for generating these scripts? Even more important: will Sigasi create the logic for generating scripts or could this programmed (scripted) by the user?
Any ideas (including screen mock-ups) are more than welcome.
Hello, I'm looking for this
Hello, I'm looking for this exact feature.
Adding all signals from a specific instance and recursive from that point, grouping the signals into the instance name.
When trying to use the proc add_waves_recursive all I get is en error message saying:
If the proc add_waves_recursive is contained in a file called add_waves.tcl, can you please help me out how to execute it?
I've tried different syntax and searched the web for answers but without any success (I'm quite new to using .tcl in Modelsim).
I'm using ModelSim 6.6d.
Best regards!
//
Kent
Hi Kent. This is not the
Hi Kent. This is not the right place to ask support questions about ModelSim. You can start looking here or ask a question on StackExchange
Post new comment