![]() |
![]() |
![]() |
![]() |
Running the simulation
We will start the simulation by applying stimulus to the clock input.
- Click in the Main window and enter the following command at the VSIM prompt:
force clk 1 50, 0 100 -repeat 100(MENU: Signals > Edit > Clock)
ModelSim interprets this force command as follows:
- force clk to the value 1 at 50 ns after the current time
- then to 0 at 100 ns after the current time
- repeat this cycle every 100 ns
- Now you will exercise two different Run functions from the toolbar buttons on either the Main or Wave window. (The Run functions are identical in the Main and Wave windows.) Select the Run button first. When the run is complete, select Run All.
Run. This causes the simulation to run and then stop after 100 ns.
(PROMPT: run 100) (MENU: Run > Run 100ns)![]()
Run -All. This causes the simulator to run forever. To stop the run, go on to the next step.
(PROMPT: run -all) (MENU: Run > Run -All)![]()
- Select the Break button on either the Main or Wave toolbar to interrupt the run. The simulator will stop running as soon as it gets to an acceptable stopping point.
The arrow in the Source window points to the next HDL statement to be executed. (If the simulator is not evaluating a process at the time the Break occurs, no arrow will be displayed in the Source window.)
Next, you will set a breakpoint in the function on line 18.
- Move the pointer to the Source window. Scroll the window vertically until line 18 is visible. Click on or near line number 18 to set the breakpoint. You should see a red dot next to the line number where the breakpoint is set. The breakpoint can be toggled between enabled and disabled by clicking it. When a breakpoint is disabled, the circle appears open. To delete the breakpoint, click the line number with your right mouse button and select Remove Breakpoint 18.
![]()
Note: Breakpoints can be set only on executable lines - denoted by green line numbers.- Select the Continue Run button to resume the run that you interrupted. ModelSim will hit the breakpoint, as shown by an arrow in the Source window and by a Break message in the Main window.
(PROMPT: run -continue) (MENU: Run > Continue)
- Click the Step button to single-step through the simulation. Notice that the values change in the Variables window. You can keep clicking Step if you wish.
(PROMPT: run -step) (PROMPT: step)
- When you're done, quit the simulator by entering the command:
quit -forceThis command exits ModelSim without asking for confirmation.
![]() Model Technology Incorporated Voice: (503) 641-1340 Fax: (503)526-5410 www.model.com sales@model.com |
![]() |
![]() |
![]() |
![]() |