35#include "c_main_neuron_common.h"
36#include "c_main_common.h"
38#include "dma_common.h"
50 PROVENANCE_DATA_REGION,
54 CURRENT_SOURCE_PARAMS_REGION,
55 NEURON_RECORDING_REGION,
63 .provenance = PROVENANCE_DATA_REGION,
64 .profiler = PROFILER_REGION,
65 .recording = RECORDING_REGION
80 .neuron_params = NEURON_PARAMS_REGION,
81 .current_source_params = CURRENT_SOURCE_PARAMS_REGION,
82 .neuron_recording = NEURON_RECORDING_REGION,
83 .initial_values = INITIAL_VALUES_REGION
98 uint32_t n_timer_overruns;
102#define N_SYNAPTIC_BUFFERS 2
140 store_neuron_provenance(prov);
162static inline void sum(weight_t *syns) {
164 const uint32_t *src = (
const uint32_t *) syns;
166 for (uint32_t i = n_words; i > 0; i--) {
177 profiler_write_entry_disable_irq_fiq(PROFILER_ENTER |
PROFILER_TIMER);
198 profiler_write_entry_disable_irq_fiq(PROFILER_EXIT |
PROFILER_TIMER);
210 uint32_t write_index = 0;
211 uint32_t read_index = 0;
216 write_index = !write_index;
220 wait_for_dma_to_complete();
227 write_index = !write_index;
232 read_index = !read_index;
241 if (end_time > start_time) {
245 profiler_write_entry_disable_irq_fiq(PROFILER_EXIT |
PROFILER_TIMER);
253 if (!initialise_common_regions(
261 uint32_t n_rec_regions_used;
262 if (!initialise_neuron_regions(
277 log_error(
"Could not allocate %d bytes for synaptic contributions %d",
281 for (uint32_t j = 0; j < n_weights; j++) {
287 log_error(
"Could not allocate %d bytes for all synaptic contributions",
291 for (uint32_t j = 0; j < n_words; j++) {
296 for (uint32_t j = 0; j < n_words; j++) {
static uint32_t simulation_ticks
The number of timer ticks to run for before being expected to exit.
void timer_callback(uint timer_count, uint unused)
Timer interrupt callback.
const struct neuron_regions NEURON_REGIONS
static void sum(weight_t *syns)
Add up all the synaptic contributions into a global buffer.
callback_priorities
values for the priority for each callback
static void store_provenance_data(address_t provenance_region)
Callback to store provenance data (format: neuron_provenance).
#define N_SYNAPTIC_BUFFERS
The number of buffers for synaptic data (one processing, one in progress)
static weight_t * synaptic_contributions[N_SYNAPTIC_BUFFERS]
The inputs from the various synapse cores.
void resume_callback(void)
the function to call when resuming a simulation
static union @7 all_synaptic_contributions
All the synaptic contributions for adding up in 2 formats.
static uint32_t recording_flags
The recording flags indicating if anything is recording.
static uint32_t infinite_run
Determines if this model should run for infinite time.
static struct sdram_config sdram_inputs
The SDRAM input configuration data.
void c_main(void)
The entry point for this model.
const struct common_priorities COMMON_PRIORITIES
Identify the priority of certain tasks.
static uint32_t timer_overruns
The timer overruns.
static bool initialise(void)
Initialises the model by reading in the regions and checking recording data.
static uint32_t timer_period
timer tick period (in microseconds)
const struct common_regions COMMON_REGIONS
From the regions, select those that are common.
uint32_t time
The current timer tick value.
Provenance for this specific core.
void log_error(const char *message,...)
void log_debug(const char *message,...)
void neuron_pause(void)
Perform steps needed before pausing a simulation.
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)
uint32_t size_in_bytes
The size of the input data to be transferred per core.
@ SDRAM_PARAMS_REGION
SDRAM transfer parameters region.
uint8_t * address
The start address of the input data to be transferred.
uint32_t n_synapse_cores
The number of synapse cores feeding into here.
A region of SDRAM used to transfer synapses.
void spin1_memcpy(void *dst, void const *src, uint len)
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.