TEMU
2
The Terma Emulator
|
Go to the source code of this file.
Functions | |
TEMU_API void | temu_simSetQuanta (int64_t Ns) |
TEMU_API int64_t | temu_simGetTime (void) |
temu_CpuExitReason | temu_simRunNanos (int64_t Nanos, bool Detatched) |
temu_CpuExitReason | temu_simRunCycles (int Cpu, int64_t Cycles, bool Detatched) |
temu_CpuExitReason | temu_simRunSecs (double Secs, bool Detatched) |
int | temu_simIsRunning (void) |
TEMU_API temu_CpuExitReason | temu_simStep (int Cpu, uint64_t Steps) |
TEMU_API int | temu_simGetCurrentCpu (void) |
TEMU_API int | temu_simGetCpuCount (void) |
void | temu_simStop (void) |
void | temu_simRunCallback (void(*Func)(void *), void *Data) |
temu_CpuExitReason | temu_simGetExitReason () |
TEMU_API int temu_simGetCpuCount | ( | void | ) |
Get the number of CPUs in the simulator.
TEMU_API int temu_simGetCurrentCpu | ( | void | ) |
Get the id of the current CPU for the simulator.
temu_CpuExitReason temu_simGetExitReason | ( | ) |
Get the last exit reason for the simulator
This can be used to query the last exit result for the run and step functions.
TEMU_API int64_t temu_simGetTime | ( | void | ) |
Get current time of simulator in nanoseconds.
The simulator time will in normal cases be adjusted to be a multiple of the quanta, but as quantas are dynamically adjusted when executing synchronised events, and when the last quanta is executed, you cannot rely on the time being a multiple of the quanta.
int temu_simIsRunning | ( | void | ) |
Return 0 if sim is not running, non-zero otherwise.
void temu_simRunCallback | ( | void(*)(void *) | Func, |
void * | Data | ||
) |
Execute a callback
The function will run the callback in the current thread if the simulator is not running, otherwise it will post it as a thread-safe callback which will be called a bit later during emulator event processing.
Func | Function to invoke |
Data | Pointer to pass to Func |
temu_CpuExitReason temu_simRunCycles | ( | int | Cpu, |
int64_t | Cycles, | ||
bool | Detatched | ||
) |
temu_CpuExitReason temu_simRunNanos | ( | int64_t | Nanos, |
bool | Detatched | ||
) |
Run the simulator for the given amount of nanoseconds
Nanos | Nanoseconds to run the simulator |
Detatched | Set to true to run in a separate thread. |
temu_CpuExitReason temu_simRunSecs | ( | double | Secs, |
bool | Detatched | ||
) |
TEMU_API void temu_simSetQuanta | ( | int64_t | Ns | ) |
Set the quanta of the simulator in nanoseconds.
The quanta is used when scheduling processors. It is essentially identical to the machine class quanta property. Effectively, each processor in the system will synchronise with the other processors and ensure that their timers are identical (within a small tolerance, as a CPU will run until the quanta end plus the slack introduced by the last instruction). Note that the quantas are set in nanoseconds as cycles are inappropriate when multiple processors of different clocks frequencies are used. Note that runtime quantas are adapted based on when synchronised events occur, and for the last quanta when running the processor.
Ns | Nanoseconds of quanta |
TEMU_API temu_CpuExitReason temu_simStep | ( | int | Cpu, |
uint64_t | Steps | ||
) |
Step the CPU for a number of steps.
The function will step the CPU with the provided CPU number for a number of steps. A step is defined to be equal to one instruction, or one time advancement in case the CPU is in idle mode or halted.
Note that it is not necessarily so that the CPU id in question is still the current CPU when the function returns. Other CPUs may for example hit a breakpoint or enter halt/error-mode.
Cpu | CPU number to step |
Steps | Number of steps to run. |
void temu_simStop | ( | void | ) |
Stop the simulator.
Returns after the simulator has stopped.