How can I make Modelsim warn me about 'X' signal?

会有一股神秘感。 提交于 2019-12-06 12:11:28

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/25605909/how-can-i-make-modelsim-warn-me-about-x-signal

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!