37#define NUM_RANDOM_BITS 12
121 for (uint32_t i = 0 ; i <
NUM_CPUS ; i++) {
130 log_info(
"resume total_sim_ticks = %d timer %d sample_frequency %d time %d",
137 if (
time == UINT32_MAX) {
138 log_debug(
"resume_skipped as time still zero");
147 log_info(
"resume total_sim_ticks = %d timer %d sample_frequency %d time %d",
161 for (uint32_t i = 0, j = 1 ; i <
NUM_CPUS ; i++, j <<= 1) {
197 while (offset --> 0) {
239 void *recording_region =
static bool initialize(void)
Initialises the program.
@ TIMER
The timer callback is highest priority.
@ DMA
DMA processing is lowest priority.
@ SDP
Responding to communications from host is next highest.
static void sample_in_slot(uint unused0, uint unused1)
Called to actually record a sample.
static uint32_t timer
The main simulation time period.
static uint32_t sample_count
How many samples have we done so far within this aggregate step?
static uint32_t simulation_ticks
The main simulation tick.
static uint32_t get_random_busy(void)
Computes a random value used to break up chance periodicities in sampling.
static uint32_t sample_count_limit
The number of samples to aggregate per recording entry.
static bool read_parameters(struct sample_params *sample_params)
Reads the configuration of the application out of the configuration region.
static void reset_core_counters(void)
Resets the state of the core_counters and the sample_count variables to zero.
static uint32_t sample_frequency
The frequency with which we sample the execution state of all cores.
@ SYSTEM
The system data region ID.
@ CONFIG
The configuration region ID.
@ RECORDING
The recorded data region ID.
static uint32_t get_sample(void)
Read which cores on the chip are asleep right now.
static void rescale_sim_ticks(void)
Change simulation ticks to be a number related to sampling frequency.
static uint32_t recording_flags
General recording flags. (Unused by this code.)
uint32_t count_limit
The number of samples to aggregate per recording entry.
static uint32_t infinite_run
Whether we are running "forever".
void c_main(void)
The application entry point.
uint32_t frequency
The fundamental sampling frequency.
static void count_core_states(void)
Accumulate a count of how active each core on the current chip is. The counter for the core is increm...
static const uint32_t RECORDING_CHANNEL_ID
The recording channel we use.
static void record_aggregate_sample(void)
Synchronously records the current contents of the core_counters to the recording region.
static uint32_t time
Our internal notion of time.
static void resume_callback(void)
The function to call when resuming a simulation.
Describes the format of the configuration region.
Data Specification region access API.
data_specification_metadata_t * data_specification_get_data_address(void)
Gets the location of the data for this core using the user0 entry of the SARK VCPU structure.
bool data_specification_read_header(data_specification_metadata_t *ds_regions)
Reads the header from the address given and checks if the parameters are of the correct values.
static void * data_specification_get_region(uint32_t region, data_specification_metadata_t *ds_regions)
Gets the address of a region.
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.
interface for recording data into "channels" on the SDRAM in a standard way, and storing buffers to b...
bool recording_initialize(void **recording_data_address, uint32_t *recording_flags)
initialises the recording of data
void recording_finalise(void)
Finishes recording - should only be called if recording_flags is not 0.
bool recording_record(channel_index_t channel, void *data, size_t size_bytes)
records some data into a specific recording channel.
void recording_reset(void)
resets recording to the state just after initialisation
void rt_error(uint code,...)
Simulation Functions Header File.
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...
bool simulation_is_finished(void)
determine if the simulation is finished. Will also pause the simulation for resynchronisation if requ...
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.
void simulation_run(void)
Starts the simulation running, returning when it is complete,.
bool simulation_initialise(address_t address, uint32_t expected_application_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_complete_priority)
initialises the simulation interface which involves:
void spin1_callback_on(uint event_id, callback_t cback, int priority)