![]() |
![]() |
![]() |
![]() |
Running and debugging the simulation
- Now you will run the simulator. Select the Run button on the Main window toolbar.
A message in the Main window will notify you that there was an assertion error.
![]()
Let's find out what's wrong. Perform the following steps to track down the assertion message.
- First, change the simulation assertion options. Select Options > Simulation from the Main window menu.
![]()
- Select the Assertions page. Change the selection for Break on Assertion to Error and click OK. This will cause the simulator to stop at the HDL assertion statement.
- To restart the simulation select the Restart button on the Main toolbar.
![]()
(Main MENU: File > Restart) (PROMPT: restart)
Make sure all items in the Restart dialog box are selected, then click Restart.
![]()
- From the Main window toolbar select the Run button.
![]()
(Main MENU: Run > Run 1000 ns) (PROMPT: run)
Notice that the arrow in the Source window is pointing to the assertion statement.
![]()
- If you look at the Variables window now, you can see that i = 6. This indicates that the simulation stopped in the sixth iteration of the test pattern's loop.
![]()
- Expand the variable named test_patterns by clicking the [+]. (You may need to resize the window for a better view.)
- Also expand the sixth record in the array test_patterns(6), by clicking the [+]. The Variables window should be similar to the one below.
![]()
The assertion shows that the Signal sum does not equal the sum field in the Variables window. Note that the sum of the inputs a, b, and cin should be equal to the output sum. But there is an error in the test vectors. To correct this error, you need to restart the simulation and modify the initial value of the test vectors.
The -f option causes ModelSim to restart without popping up the confirmation dialog.
- Update the Variables window by selecting the testbench process in the test Process window.
- In the Variables window, expand test_patterns and test_pattern(6) again. Then highlight the .sum record by clicking on the variable name (not the box before the name) and then use the Edit > Change menu selection.
![]()
- Select the last four bits (1000) in the value field by dragging the pointer across them. Then replace them with 0111, and click Change. (Note that this is a temporary edit, you must use your text editor to permanently change the source code.)
- Select the Run button from the Main window toolbar.
![]()
(Main MENU: Run > Run 1 us) (PROMPT: run)
At this point, the simulation will run without errors.
![]()
![]() Model Technology Incorporated Voice: (503) 641-1340 Fax: (503)526-5410 www.model.com sales@model.com |
![]() |
![]() |
![]() |
![]() |