Profiling Simulation Independent Services
API Reference Manual  /  Simulator API  /  Simulator API Functions  / 

Simulation Control

SIM_break_message

Name

SIM_break_message — stop the simulation

Synopsis

C and DML

#include <simics/simulator-api.h> // in C
import "simics/simulator-api.dml"; // in DML

void
SIM_break_message(const char *msg);

Python

import simics

simics.SIM_break_message(...)

Description

Display the reason why Simics will stop simulation.

This is similar to SIM_break_simulation, with the difference that it doesn’t actually break the simulation. It can be used by code that wants to display a break message and stop the simulation by some other means.

Execution Context

Cell Context

See Also

SIM_break_simulation

SIM_break_simulation

Name

SIM_break_simulation — stop the simulation

Synopsis

C and DML

#include <simics/simulator-api.h> // in C
import "simics/simulator-api.dml"; // in DML

void
SIM_break_simulation(const char *msg);

Python

import simics

simics.SIM_break_simulation(...)

Description

Ask Simics to stop the simulation as soon as possible, displaying the supplied message.

Simics will normally stop before the next instruction is executed. If this function is called when an instruction has started executing, and the instruction can be aborted, it will rewind to before the instruction. This might leave the simulation in a state where some repeatable part of the instruction is already executed.

Execution Context

Cell Context

See Also

SIM_break_message

SIM_continue

Name

SIM_continue — run the simulation

Synopsis

C and DML

#include <simics/simulator-api.h> // in C
import "simics/simulator-api.dml"; // in DML

pc_step_t
SIM_continue(int64 steps);

Python

import simics

simics.SIM_continue(...)

Description

Run the simulation. In typical usage with steps being 0, the simulation will run forward until it is stopped, either by a breakpoint, internal event, or through the user interface.

With a non-zero steps, Simics will make sure that at least one processor runs steps steps and then stop the simulation. As with steps being 0, the function can also return early if other break criteria are met.

In order to properly control when simulation stops in time, it is advisable to use step or cycle breakpoints on one or more objects.

The function returns non-zero if the simulation was started, and 0 otherwise.

Exceptions

SimExc_General Thrown if the simulation could not be started. Check the exception message for more information.

Execution Context

Global Context

SIM_current_clock

Name

SIM_current_clock — return current clock

Synopsis

C and DML

#include <simics/simulator-api.h> // in C
import "simics/simulator-api.dml"; // in DML

conf_object_t *
SIM_current_clock();

Python

import simics

simics.SIM_current_clock(...)

Description

Returns the clock (an object implementing the cycle interface) that is driving the simulation in the current cell and current thread. In Global Context, NULL is returned.

Please note that typically model code would use SIM_object_clock to obtain the clock used for posting events. Another alternative for models is to get the initiator of a memory transaction from the memory transaction itself with the functions like SIM_transaction_initiator and SIM_get_mem_op_initiator and use that for event posting.

The currently running clock returned by this function can be used, for example, to post events right after the current instruction finishes. But, as it is pointed out above, there are other alternatives for getting a clock for posting events. The use of this function is generally discouraged.

Execution Context

Cell Context

See Also

SIM_object_clock, SIM_transaction_initiator, SIM_get_mem_op_initiator

SIM_simics_is_running

Name

SIM_simics_is_running — check if simulation is running

Synopsis

C and DML

#include <simics/simulator-api.h> // in C
import "simics/simulator-api.dml"; // in DML

bool
SIM_simics_is_running();

Python

import simics

simics.SIM_simics_is_running(...)

Description

Returns true if the simulation is running, e.g. if it has been started using SIM_continue, or false otherwise. It also returns true when the simulation is reversing.

Execution Context

Cell Context

Profiling Simulation Independent Services