Monday, September 27, 2010

Questasim: How to force an internal signal from another signal through TCL script?

The 'force' command available in Questa / ModelSim allows force of value but not signal onto a signal.

Solution

The following example TCL script will do the job:


  when /tb/dut/signal_b {
        force /tb/dut/signal_a [examine /tb/dut/signal_b]   }


where, /tb/dut/signal_a is the source and /tb/dut/signal_b is the destination signal.


Note that in the above case one should provide visibility to the internal object(s) during simulation by either using vsim option -voptargs="+acc" when in optimized(vopt) mode or using vsim option -novopt to be in non-optimized (novopt) mode. Please see User's Manual for details on internal object visibility during simulation - see the section "Preserving Object Visibility for Debugging Purposes".


For details on how to use TCL script, please refer to User's Manual under chapter "Tcl and Macros".


One could force value of a signal onto another signal in the heirarchy within the source code by using Signal Spy feature in Questa / ModelSim. Refer to section "init_signal_driver"

No comments:

Post a Comment