Simulation control tasks allow you to stop or quit simulation.
$stop [(n)] ;
$finish [(n)] ;
The $stop system task is used to suspend simulation. When invoked it suspends simulation, prints simulation time and prints location. Optional expressions can determine the type of printed message:
Simulation time and location
Simulation time, location, memory consumption and CPU time used in simulation
By default the value 1 is used.
The $finish system task ends the simulation, exits the simulator and passes control back to the operating system. It can be invoked with the same arguments as the $stop system task and has the same default value.
Suspend simulation and print message (default argument = 1)
#150 $finish(2) ;
Exits simulator after 150 time units from the last executed statement and prints message (argument == 2).
- Remember that $finish control system task makes the simulator exit, however $stop simply suspends simulation.