17#include "c_main_neuron_common.h"
18#include "c_main_common.h"
20#include "local_only/local_only_impl.h"
44 PROVENANCE_DATA_REGION,
49 CURRENT_SOURCE_PARAMS_REGION,
50 NEURON_RECORDING_REGION,
52 LOCAL_ONLY_PARAMS_REGION,
53 NEURON_BUILDER_REGION,
60 .provenance = PROVENANCE_DATA_REGION,
61 .profiler = PROFILER_REGION,
62 .recording = RECORDING_REGION
75 .neuron_params = NEURON_PARAMS_REGION,
76 .current_source_params = CURRENT_SOURCE_PARAMS_REGION,
77 .neuron_recording = NEURON_RECORDING_REGION,
78 .initial_values = INITIAL_VALUES_REGION
89static uint32_t simulation_ticks = 0;
92static uint32_t infinite_run;
95static uint32_t recording_flags = 0;
109void synapse_dynamics_process_post_synaptic_event(
110 UNUSED uint32_t time, UNUSED
index_t neuron_index) {
119 store_neuron_provenance(&prov->neuron_provenance);
137static inline void process_ring_buffers(
void) {
143 #if LOG_LEVEL >= LOG_DEBUG
154 profiler_write_entry_disable_irq_fiq(PROFILER_ENTER |
PROFILER_TIMER);
161 profiler_write_entry_disable_irq_fiq(PROFILER_EXIT |
PROFILER_TIMER);
162 n_backgrounds_queued--;
183 process_ring_buffers();
196 common_pause(recording_flags);
209 n_background_overloads++;
211 n_backgrounds_queued++;
221static bool initialise(
void) {
225 if (!initialise_common_regions(
226 &timer_period, &simulation_ticks, &infinite_run, &time,
227 &recording_flags, c_main_store_provenance_data, timer_callback,
228 COMMON_REGIONS, COMMON_PRIORITIES, &ds_regions)) {
233 uint32_t n_rec_regions_used;
234 if (!initialise_neuron_regions(
235 ds_regions, NEURON_REGIONS, &n_rec_regions_used)) {
240 data_specification_get_region(LOCAL_ONLY_REGION, ds_regions),
241 data_specification_get_region(LOCAL_ONLY_PARAMS_REGION, ds_regions),
242 n_rec_regions_used, &ring_buffers)) {
247 log_debug(
"setting timer tick callback for %d microseconds", timer_period);
248 spin1_set_timer_tick(timer_period);
static void c_main_store_provenance_data(address_t provenance_region)
Callback to store provenance data (format: neuron_provenance).
void timer_callback(uint timer_count, uint unused)
Timer interrupt callback.
const struct neuron_regions NEURON_REGIONS
From the regions, extract those that are neuron-specific.
void resume_callback(void)
the function to call when resuming a simulation
static weight_t * ring_buffers
The ring buffers to be used in the simulation.
void background_callback(uint timer_count, uint local_time)
Background activities called from timer.
const struct common_priorities COMMON_PRIORITIES
Identify the priorities of the common tasks.
const struct common_regions COMMON_REGIONS
From the regions, extract those that are common.
uint32_t time
The current timer tick value.
void log_error(const char *message,...)
void log_debug(const char *message,...)
@ BACKGROUND
Background processing.
static uint32_t n_backgrounds_queued
The number of background tasks queued / running.
static uint32_t timer_period
Used for configuring the timer hardware.
static uint32_t max_backgrounds_queued
The maximum number of background tasks queued.
static uint32_t n_background_overloads
The number of times the background couldn't be added.
uint32_t synapse_delay_mask
The mask to get the synaptic delay from a "synapse".
void local_only_clear_input(uint32_t time)
Clear the spikes for the last time step.
uint32_t synapse_type_index_bits
The number of bits used by the synapse type and post-neuron index.
static uint32_t local_time
The local time step counter.
void local_only_store_provenance(struct local_only_provenance *prov)
Store provenance gathered during run.
bool local_only_initialise(void *local_only_addr, void *local_only_params_addr, uint32_t n_rec_regions_used, uint16_t **ring_buffers_ptr)
Set up local-only processing of spikes.
Defines the "local-only" processing of spikes, that is, the processing of spikes without using transf...
void neuron_pause(void)
Perform steps needed before pausing a simulation.
void neuron_print_inputs(void)
Print the inputs to the neurons.
bool neuron_resume(uint32_t time)
Prepare to resume simulation of the neurons.
void neuron_transfer(weight_t *syns)
Add inputs to the neurons.
void neuron_do_timestep_update(timer_t time, uint timer_count)
executes all the updates to neural parameters when a given timer period has occurred.
void recording_reset(void)
void rt_error(uint code,...)
void simulation_handle_pause_resume(resume_callback_t callback)
bool simulation_is_finished(void)
void simulation_ready_to_read(void)
void simulation_run(void)
uint spin1_schedule_callback(callback_t cback, uint arg0, uint arg1, uint priority)
uint spin1_int_disable(void)
void spin1_mode_restore(uint value)
The combined provenance from synapses and neurons.
uint32_t max_backgrounds_queued
Maximum backgrounds queued.
uint32_t n_background_queue_overloads
Background queue overloads.
The callback priorities used by all simulation cores.
uint32_t sdp
The SDP callback priority.
The identifiers of the regions used by all simulation cores.
uint32_t system
Data for general simulation setup.
The provenance information provided by neurons.
The region IDs used by the neuron processing.
uint32_t core_params
The core parameters.
implementation for handling the processing of synapse rows.
static index_t synapse_row_get_first_ring_buffer_index(uint32_t simulation_timestep, uint32_t synapse_type_index_bits, int32_t synapse_delay_mask)
Get the index of the first ring buffer for a given timestep.