Post Simulation Debug Tutorial
Post Simulation Debug Tutorial
Table Of Contents
Table Of Contents
Post Simulation Debug Tutorial ....................................................................................................... 1
Introduction .................................................................................................................................. 1
Creating a project......................................................................................................................... 1
Simulation .................................................................................................................................... 2
Changing top-level during simulation in the PSD mode .............................................................. 8
ii
Creating a project
In the normal course of action, the first thing you have to do is to create a new project. Next, you
modify your project by adding or creating new modules (source code files, state diagrams, block
diagrams, etc.). Since all steps needed to go through to create a design are described in other
tutorials, we will omit this part and assume that we have a complete design that is ready for
simulation.
NOTE: Creating a new project, adding new modules to the design and other topics related to the
Design Entry are described in the following tutorials: VHDL Entry and Simulation Tutorial, Verilog
Entry and Simulation Tutorial, Mixed VHDL-Verilog Tutorial.
In this tutorial we will use the freq_meter sample design that is shipped with the Active-HDL
software.
1. In the first step, run Active-HDL and open the Workspace/Design Explorer (File | Open
Workspace/Design Explorer) to load the freq_meter workspace. The figure below shows its
default location:
CNT_BCD2.bde
testbench_cnt_bcd_conf.vhd
3. Compile the design, by using the menu command Design | Compile All.
After successful compilation (the Console window should display a line similar to the following:
# Compile success 0 Errors 0 Warnings Analysis time : 1.0 [s])
Simulation
Preparing the design for simulation
1. The first step you need to make is to initialize simulation by choosing the Simulation |
Initialize Simulation menu command.
Note how the Simulation/Time Status field looks (upper left corner of the Active-HDL window).
By examining this field you can easily determine whether you are dealing with a regular
simulation or a simulation in the Post Simulation Debug mode.
3. Switch to the Structure tab of the Design Browser window and select the testbench
(stimulusfromfile) item.
4. Select all signals with ACTUAL, EXPECTED, and STIM prefixes and drag them to the
waveform window. You should see the following result:
and Go to current
NOTE: You may see a message box announcing the end of simulation: "Simulation has finished.
There are no more vectors to simulate."
The Save full signal history option in the Trace/Debug category of the Design Settings dialog
box.
This change will not be visible until you reinitialize simulation:
8. End the current simulation (Simulation | End Simulation) and initialize it again (Simulation |
Initialize Simulation).
NOTE: Active-HDL allows you to observe values of signals in different views. In the next few
steps, we will watch values in three windows (Hierarchy Viewer, Standard Waveform
Viewer/Editor, Watch). In your further work with Active-HDL, you can choose the view that is
most suitable for you.
The Watch window after dragging in signals from the waveform window.
10. In the Hierarchy Viewer window (Structure tab) highlight the testbench (stimulusfromfile)
unit.
11. Click the Run Until button to advance simulation to 18us.
12. Set simulation time step to 4us and then navigate one step backward using the Move
backward button. Note that values of some signals have changed.
As you can see, the simulator remembers the history of signals during simulation. However, when
you end simulation, the history is no longer available. In other words, the current design settings
force you to use the simulator each time you want to access the signal(s) history. The solution to
this problem is the Post Simulation Debug mode, which uses simulation data stored in an
external file. Before you use this feature, however, you have to collect data for Post Simulation
Debug.
The Preserve file with signal history for Post Simulation Debug option in the Trace/Debug
category of the Design Settings dialog box
14. End simulation (Simulation | End Simulation) and start it again (Simulation | Initialize
Simulation).
15. Use the Run Until button to advance simulation to 20 us.
The signals you have selected in the Select Signals for PSD window
are now available (you can see the full history of their values). Select
them and drag to the waveform window (you may also drag some of
the unavailable signals for the comparison).
NOTE: The Simulator Resolution option in the Simulation category of the Design Settings
dialog box allows you to set the simulator's resolution. However, this option is useful only during
regular simulation. The PSD mode uses the same resolution that was set when you were
collecting data for the PSD.
Conclusion
The PSD mode provides a useful diagnosis tool. It allows you to browse values of signals read
from an external file and does not need a connection to the simulator. You can watch values of
signals in the following windows: Watch, Waveform Viewer, Hierarchy Viewer, Block Diagram
Editor, and HDL Editor. You perform only one regular simulation to collect the PSD data and then