Forcing Signals with Questasim/ModelSim
I’ve been using vcs and questasim for verification for a while, and both of these tools allow us to interact with the simulator using their cli. We can use them for debugging, create checking point, restore simulation, … . But mostly for my case, I use this cli for forcing signals. And this method help me in many situations such as creating some error cases (for testing purpose), or forcing signals from the logic that has not been implements yet. Let’s go through some examples for forcing signals using Questasim (or another version of this eda tool is ModelSim).
How to force signals
As mentioned, we force signals using the interactive mode of those EDA tool, so whenever we in the command line interface (aka cli) we can call the force commands to force signals. Usually, I create a file containing forcing commands, then source this file during simulation like below.
vsim -do <force_file.tcl> <other simulation options>
For Questasim and VCS, these commands is the Tcl-based command, which means you will use tcl syntax for writing your force file.
Some examples of forcing signals using Questasim
First up
- Make sure your signals have correct path, you can find signal path by using Questasim cli command in cli mode:
find nets -recursive -ports /top/*TOP*/*MODULE_A*/*RESET*
- Check your tcl syntax carefully.
- Careful with radix format. Tcl will understand this radix format
0b11
, but for Questasim, we need to write data value with this format:'b11
,'hfaab
,'d1024
. So check the EDA user guide carefully. - If you use force file like this:
vsim -do <force_file.tcl>
, considering using below template
#force_file.tcl
echo "FORCE BEGIN"
#your force commands
echo "FORCE END"
run -all
Forcing Examples
Description | Code |
---|---|
forcing signals with fix value from certain simulation time |
|
forcing signal to be similar to other signal |
|
forcing signal when another signal got x value |
|
forcing signal to be a clock |
|
forcing signal when another signal active 1 the first time |
|
Finding more information
Read the User Manual released by Questasim for more information and example on how to force signals. The manual files usually can be found at the installation directory of each tool. Besides, you could also refer the ModelSim PE manual. It’s a free download tool from Mentor for education purpose and the commands are similar to Questasim.
[Tags
linux_env
eda_tool
]