89 prov->timer_tic_has_overrun =
91 prov->max_num_timer_tic_overrun =
93 return prov->provenance_data_elements;
99 log_info(
"Starting basic provenance gathering");
102 log_info(
"running other provenance gathering");
146 spin1_send_sdp_msg(msg, 10);
189 uint16_t length = msg->
length;
193 log_info(
"Received exit signal. Program complete.");
200 log_info(
"Calling pre-exit function");
208 log_info(
"Setting the runtime of this model to %d starting at %d",
210 log_info(
"Setting the flag of infinite run for this model to %d",
219 uint32_t *
data = (uint32_t *) msg->
data;
229 log_info(
"Calling pre-resume function");
250 log_info(
"Forced provenance gathering");
257 log_info(
"Calling pre-exit function");
269 if (msg->
arg3 == 1) {
297 spin1_send_sdp_msg(msg, 10);
303 log_error(
"received packet with unknown command code %d",
325 log_error(
"Cannot allocate SDP callback on port %d as its already "
326 "been allocated.", sdp_port);
349 log_error(
"Cannot handle tag value above %d, please reduce the tag "
357 log_error(
"Cannot allocate DMA transfer callback on tag %d as its "
358 "already been allocated.", tag);
371 address_t address, uint32_t expected_app_magic_number,
372 uint32_t* timer_period, uint32_t *simulation_ticks_pointer,
373 uint32_t *infinite_run_pointer, uint32_t *time_pointer,
374 int sdp_packet_callback_priority,
375 int dma_transfer_done_callback_priority) {
379 if (
config->application_magic_number != expected_app_magic_number) {
380 log_error(
"Unexpected magic number 0x%08x instead of 0x%08x at 0x%08x",
381 config->application_magic_number, expected_app_magic_number,
382 &
config->application_magic_number);
386 if (sdp_packet_callback_priority < -1) {
387 log_error(
"The SDP callback priority should be set to a number greater "
388 "than or equal to -1. It is currently set to %d",
389 sdp_packet_callback_priority);
394 *timer_period =
config->timer_period;
402 sdp_packet_callback_priority);
405 if (dma_transfer_done_callback_priority >= -1) {
407 dma_transfer_done_callback_priority);
415 prov = (
void *) provenance_data_address;
422 prov = (
void *) provenance_data_address;
uint32_t * address_t
A generic pointer to a word.
static uint32_t data[ITEMS_PER_DATA_PACKET]
SpiNNaker debug header file.
void log_error(const char *message,...)
This function logs errors. Errors usually indicate a serious fault in the program,...
void log_debug(const char *message,...)
This function logs debugging messages. This level of message is normally not printed except when the ...
void log_info(const char *message,...)
This function logs informational messages. This is the lowest level of message normally printed.
The configuration parameters for the application.
void sark_msg_free(sdp_msg_t *msg)
void sark_cpu_state(cpu_state state)
void sark_io_buf_reset(void)
void simulation_handle_pause_resume(resume_callback_t callback)
cleans up the house keeping, falls into a sync state and handles the resetting up of states as requir...
void simulation_set_provenance_function(prov_callback_t provenance_function, address_t provenance_data_address)
Set an additional callback function to store extra provenance data.
void simulation_set_provenance_data_address(address_t provenance_data_address)
Set the address of the data region where provenance data is to be stored.
static uint32_t n_sync_steps
The number of steps to run before synchronisation.
static void wait_before_run(bool reset_event)
wait for a signal before running
static callback_t sdp_callback[NUM_SDP_PORTS]
the list of SDP callbacks for ports
static void * simulation_store_provenance_data(void)
Store basic provenance data.
static void simulation_control_scp_callback(uint mailbox, uint port)
Handle the new commands needed to resume the binary with a new runtime counter, as well as switching ...
void simulation_exit(void)
Exit the application.
void simulation_set_start_function(start_callback_t start_function)
Set an additional function to call before starting the binary.
void simulation_set_uses_timer(bool sim_uses_timer)
set whether the simulation uses the timer. By default it will be assumed that simulations use the tim...
static void simulation_sdp_callback_handler(uint mailbox, uint port)
handles the SDP callbacks interface.
static uint32_t * pointer_to_infinite_run
the pointer to the flag for if it is a infinite run
void simulation_set_exit_function(exit_callback_t exit_function)
Set an additional function to call before exiting the binary when running without a fixed duration of...
static void execute_provenance_storage(void)
Run the provenance data storage.
static exit_callback_t stored_exit_function
the function call to run when received a exit command.
static callback_t dma_complete_callbacks[MAX_DMA_CALLBACK_TAG]
the list of DMA callbacks for DMA complete callbacks
bool simulation_is_finished(void)
determine if the simulation is finished. Will also pause the simulation for resynchronisation if requ...
static void set_cpu_wait_state()
Set the CPU state depending on the event wait state.
bool simulation_initialise(address_t address, uint32_t expected_app_magic_number, uint32_t *timer_period, uint32_t *simulation_ticks_pointer, uint32_t *infinite_run_pointer, uint32_t *time_pointer, int sdp_packet_callback_priority, int dma_transfer_done_callback_priority)
initialises the simulation interface which involves:
static uint32_t next_sync_step
The number simulation timestep at the next synchronisation.
static void send_ok_response(sdp_msg_t *msg)
Send an OK response to the host when a command message is received.
static uint32_t * pointer_to_current_time
the pointer to the current simulation time
bool simulation_dma_transfer_done_callback_on(uint tag, callback_t callback)
registers a DMA transfer callback to the simulation system
void simulation_ready_to_read(void)
Indicates that all data has been written and the core is going idle, so any data can now be read.
static start_callback_t stored_start_function
the function call to run at the start of simulation
static struct simulation_provenance * prov
the region ID for storing provenance data from the chip
static prov_callback_t stored_provenance_function
the function call to run when extracting provenance data from the chip
static bool simulation_paused
Whether the simulation has been manually "paused".
static void simulation_dma_transfer_done_callback(uint unused, uint tag)
handles the DMA transfer done callbacks interface.
void simulation_sdp_callback_off(uint sdp_port)
disables SDP callbacks on the given port
void simulation_set_sync_steps(uint32_t n_steps)
sets the simulation to enter a synchronisation barrier repeatedly during the simulation....
bool simulation_sdp_callback_on(uint sdp_port, callback_t callback)
Registers an additional SDP callback on a given SDP port. This is required when using simulation_regi...
uint resume_wait(void)
Indicate whether the SYNC signal has been received.
static resume_callback_t stored_resume_function
the function call to run just before resuming a simulation
static void synchronise_start(uint unused0, uint unused1)
Callback when starting after synchronise.
static bool uses_timer
Whether the simulation uses the timer or not (default true)
void simulation_dma_transfer_done_callback_off(uint tag)
turns off a registered callback for a given DMA transfer done tag
void simulation_run(void)
Starts the simulation running, returning when it is complete,.
static uint32_t * pointer_to_simulation_time
the pointer to the simulation time used by application models
Simulation Functions Header File.
void(* resume_callback_t)(void)
the definition of the callback used by pause and resume
void(* exit_callback_t)(void)
#define MAX_DMA_CALLBACK_TAG
resume_callback_t start_callback_t
the definition of the callback used to call a function once at start
void(* prov_callback_t)(address_t)
the definition of the callback used by provenance data functions
@ CMD_STOP
Asks the simulation loop to stop as soon as possible.
@ CMD_GET_TIME
Get the current simulation time.
@ PROVENANCE_DATA_GATHERING
Asks the application to gather provenance data.
@ CMD_RUNTIME
Tells the simulation loop how long to run for.
@ IOBUF_CLEAR
Clears the IOBUF.
the position and human readable terms for each element from the region containing the timing details.
elements that are always grabbed for provenance if possible when requested
uint user_event_queue_full
uint total_times_tick_tic_callback_overran
diagnostics_t diagnostics
uint tx_packet_queue_full
uint spin1_schedule_callback(callback_t cback, uint arg0, uint arg1, uint priority)
void spin1_resume(sync_bool sync)
void(* callback_t)(uint, uint)
uint largest_number_of_concurrent_timer_tic_overruns
void spin1_exit(uint error)
uint spin1_start_paused(void)
void spin1_callback_on(uint event_id, callback_t cback, int priority)
cback_t callback[NUM_EVENTS]
static void wait_for_interrupt(void)
Wait for any interrupt to occur.