FPGA Q&A: ModelSim Simulation Errors
Last edited by
Last edited time
Sep 2, 2024 07:39 PM
AI summary
The document discusses two
vsim
commands for ModelSim simulation. The first command runs simulations with default optimizations, which may hide some signals, making it suitable for performance. The second command, using -voptargs=+acc
, disables certain optimizations to ensure all signals are visible, making it ideal for debugging. It is recommended to use the second command for debugging and the first for performance-optimized simulations.Tags
ModelSim Commands
FPGA Debugging
Simulation Optimization
Fix Link:
Let's break down and compare the two
vsim
commands:1. Command: vsim -L altera_primitives -L altera_mf -L 220model work.top_tb
Purpose:
- This command runs the simulation for the testbench
top_tb
located in thework
library.
- The
L
options specify additional libraries that ModelSim needs to use during the simulation. In this case: altera_primitives
: Altera primitive libraryaltera_mf
: Altera Megafunction library220model
: Altera model library
Default Behavior:
- ModelSim applies optimization techniques by default to improve simulation performance. This optimization may remove or hide some signals that it deems unnecessary for simulation output, leading to certain signals not being visible in the wave window.
- Signals not directly affecting outputs or used in assertions might not be visible.
2. Command: vsim -voptargs=+acc -L altera_primitives -L altera_mf -L 220model work.top_tb
Purpose:
- Similar to the first command, this runs the simulation for
top_tb
using the specified libraries.
voptargs=+acc
: This additional flag modifies the optimization settings of the simulation.
Behavior with
-voptargs=+acc
:+acc
(Access): This flag tells ModelSim to keep all hierarchical signals and variables visible by providing full access (acc
) to all objects within the design.
- By using
voptargs=+acc
, you effectively disable certain optimizations that would otherwise hide internal signals. This makes all internal signals and variables visible and accessible during simulation, allowing you to add them to the wave window.
- This setting is particularly useful for debugging purposes as it ensures no signal is optimized away, providing a comprehensive view of all signals in the simulation.
Conclusion:
vsim -L altera_primitives -L altera_mf -L 220model work.top_tb
:- This command runs the simulation with default optimizations enabled. It is suitable for final simulations or when simulation performance is a priority.
- Some signals may not be visible in the wave window due to optimizations.
vsim -voptargs=+acc -L altera_primitives -L altera_mf -L 220model work.top_tb
:- This command runs the simulation with optimizations that preserve all signals (
+acc
). It is ideal for debugging, as it provides complete visibility of all signals and variables in the design. - It disables certain optimizations that might hide signals, making it easier to debug but potentially slower in simulation performance due to the increased amount of data being processed.
Recommendation: Use the second command (
vsim -voptargs=+acc ...
) when you need full visibility of all signals for debugging purposes. Use the first command for performance-optimized simulations when all signals' visibility is not necessary.Loading...