I have an abstract class which has four children classes. In Modelsim (SE 10.5b), I want to add some waveforms of whichever child is currently active. this can change during simulation. In my experimentation, I found that using the add wave command takes a snapshot when first called, and remembers which child was currently active at that time. All future add wave calls will refer to that child, even if the child has meanwhile changed.

I tried both adding through TCL code and through the class instance viewer. Through class instance viewer I get errors in constructing path; See the first code example below, including the corresponding error. This is the command automatically generated when using the class instance window.

When I remove the super. section, it does add a wave, but this wave always refers to the 'snapshot' child.

Error line:

add wave sim:/@[email protected]_spi_env.current_driver.super.name

Error: Child not found while constructing path expression: super

"Correct" line (always refers to 'snapshot child'):

add wave sim:/@[email protected]_spi_env.current_driver.name

I would like the waveform to change which child it internally references to, whenever that child changes in the code. Currently, it just gives a blank wave, whenever the current child is not equal to the 'snapshot child'.

A workaround I could work with would be e.g. adding a line in the TCL script to tell modelsim to re-evaluated these children. (I tried looking for it in the command reference manual, but could not find such a thing).


Ok, I found the solution. It seems that, for modelsim to properly update the waveforms when switching between children classes, it needs to already have a pointer to those children classes, or something like that. The way I fixed it in my code is as by including the next section of add-wave commands just before the actual add-wave commands I need:

add wave -group {Scope_finders} sim:/@[email protected]_class1
add wave -group {Scope_finders} sim:/@[email protected]_class2
add wave -group {Scope_finders} sim:/@[email protected]_class3
add wave -group {Scope_finders} sim:/@[email protected]_class4

delete wave -group {Scope_finders}

This apparently allows modelsim to construct the path to the proper classes and class members, without clogging up the wave window.

0 Answers