0

I'm currently working with a big project with many module and sub-module inside. Is it possible (GUI or tcl scripts) to add all wave and group it in tree like module-tree?

For example: module A include module b0, b1, b2, b3,..., b10. I want to add each block b0~b10 in seperated ground inside group A.

I think it's lazy way to do but it may better than many configure with tcl script.

Khanh N. Dang
  • 906
  • 1
  • 9
  • 18

3 Answers3

4

I am not a Questa/Modelsim expert but I do a bit with it in TCL so this is just my approach to doing it.

This breaks down into several steps;
1) Traverse the design hierarchy
2) Create groupings
3) Add signals to groups

1) Traversing the design
Either traverse the model itself, or add all signals to wave and traverse that
1.1) You can select+search for things using search wave -all signal_name
1.2) or you can also traverse the design using find instance /* and then recurs manually on that (etc. find instance /top/* ...) you can then find nets/signals using find signals/nets/.. YOUR_LEVEL

2) Creating groups
You can create a group by selecting something in the wave window and doing "wave group name".

What isn't so obvious is you can do the same thing by actually then re-selecting the 'red group diamond' that appears and re-group it thus creating a sub-group

Or you can also specify sub groups using "add wave -group G1 -group G2"

3) Add signals to groups
You can add signals by using the normal "add -position N wave signal_name"

Other bits that help;
a) Selecting things in the wave window

set WAVEWIN [view wave]
$WAVEWIN.tree.tree1 curselection
$WAVEWIN.tree.tree1 selection clear all
$WAVEWIN.tree.tree1 selection set 1 2 etc

b) getting signal names from the selected items

# gets its signal name "sim:/path/to/sig"
set SIGPATH $WAVEWIN.tree.tree1 get 1

c) I might comment that adding all the signals to the same wave window might get really unmanageable so you might also want to consider adding to separate wave windows?

set WAVEWIN [view -new wave]
  • Thank for your beatiful answer, it look awesome to manually config. But i'm looking for recursive method for add all wave form. – Khanh N. Dang Oct 29 '12 at 13:44
1

Since you want just an automatic way to do a recursive grouping of the design in simulation then here is a bit of code I think will do this. Its just ONE implementation using some of the above answer but I didnt want to confuse the above answer by adding this into it so created this separate answer.

What you want to do (manual view of wanted ticle output)

add wave                         /top/*
add wave -group dut              /top/dut/*
add wave -group dut -group subA  /top/dut/subA/*

You can do that using the Questa/Modelsim find command and the add wave just as shown above with a little TCL magic. Note the '-noupdate' makes adding a LARGE NUMBER of signals far faster but you need to call wave refresh when done.

# Kick everything off from here.
proc add_wave_groupedrecursive { } {
  add_wave_breadthwiserecursive "" ""

  # Added all signals, now trigger a wave window update
  wave refresh
}

proc add_wave_breadthwiserecursive { instance_name prev_group_option } {
    # Should be a list something like "/top/inst (MOD1)"
    set breadthwise_instances [find instances $instance_name/*]

    # IFF there are items itterate through them breadthwise
    foreach inst $breadthwise_instances {
      # Separate "/top/inst"  from "(MOD1)"
      set inst_path [lindex [split $inst " "] 0]

      # Get just the end word after last "/"
      set gname     [lrange [split $inst_path "/"] end end]

      # Recursively call this routine with next level to investigate
      add_wave_breadthwiserecursive  "$inst_path"  "$prev_group_option -group $gname" 
    }

    # Avoid including your top level /* as we already have /top/*
    if { $instance_name != "" } {
        # Echo the wave add command, but you can turn this off
        echo add wave -noupdate $prev_group_option "$instance_name/*"

        set CMD "add wave -noupdate $prev_group_option $instance_name/*"
        eval $CMD
    }

    # Return up the recursing stack
    return
}

You could of course improve this to allow you to only show N levels, or maybe even only modules of interest using regexp from TCL. But I leave that exercise up to the reader.

0

Not sure if this is obvious now, but you can do:

add wave -recursive *
Druid
  • 6,423
  • 4
  • 41
  • 56