I am working on large design using Modelsim.
I've read about the way modelsim simulation works. I am wondering, is there a way that when modelsim evaluates a signal in the simulation phase and it found it to be a red signal, i.e. 'X', to warn me about it?
Knowing that is impossible to list all the signals of the design and look at them one by one.
Also it's very hard to put assertion command for all signals.
You can use the when
command to carry out a desired action when a condition is met. The find
command can extract signals from the design hierarchy. Look at the Modelsim command reference documentation to see all of its options. The examine
command is used to determine the length of arrays and scalar type signals. This example will not work on record types.
proc whenx {sig action} {
when -label $sig "$sig = [string repeat X [string length [examine $sig]]]" $action
}
foreach s [find signals -r /*] {whenx $s "echo \"$s is an X at \$now\""}
This example does not handle arrays which are only partially X's. While you can use array indices in the when
expression to test individual bits, it isn't clear how to determine the bounds of an array programmatically in Modelsim tcl.
You can cancel all when
conditions with nowhen *
.