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 *
.