39 uint32_t pre_spike: 31;
40 uint32_t is_update: 1;
50 uint32_t ring_buffer_index;
68 UNUSED uint32_t *ring_buffer_to_input_buffer_left_shifts) {
72 params = spin1_malloc(size);
74 log_error(
"Unable to allocate memory for params");
79 log_info(
"Synapse type %u: min = %d, max = %d", i,
80 params->weight_limits[i].min,
params->weight_limits[i].max);
85 log_error(
"Failed to allocate post_event_history");
94 UNUSED uint32_t time, UNUSED
index_t neuron_index) {
99 uint32_t control_word, uint32_t time, uint32_t colour_delay) {
115 (delay + time) - colour_delay, type_index,
120static inline void synapse_dynamics_stdp_update_ring_buffers(
122 uint32_t accumulation =
ring_buffers[s.ring_buffer_index] + weight;
124 uint32_t sat_test = accumulation & 0xFFFF0000;
126 accumulation = 0xFFFF;
135 uint32_t pre_spike, uint32_t control_word, weight_t *
ring_buffers,
144 weight_t min_weight =
params->weight_limits[s.type].min;
145 weight_t max_weight =
params->weight_limits[s.type].max;
146 log_debug(
" Looking at change weight history 0x%08x of %u items to post"
147 " neuron index %u", history, history->
count, s.index);
148 for (uint32_t i = 0; i < history->
count; i++) {
151 " Checking history item %u, weight change %d for"
152 " pre-neuron %u, synapse_type = %u",
156 if (new_weight < min_weight) {
157 synapse.weight = min_weight;
158 }
else if (new_weight > max_weight) {
159 synapse.weight = max_weight;
161 synapse.weight = (weight_t) new_weight;
163 log_debug(
" Weight now %d", synapse.weight);
168 if (post_events_remove(history, i)) {
175 if (s.delay > colour_delay) {
176 synapse_dynamics_stdp_update_ring_buffers(
ring_buffers, s,
185static inline int16_t change_sign(weight_t weight) {
190 converter.weight = weight;
191 return converter.value;
194static inline void process_weight_update(
199 uint32_t pre_spike = plastic_region_address->pre_spike;
201 log_debug(
"Weight change update for pre-neuron %u", pre_spike);
204 for (; n_synapses > 0; n_synapses--) {
206 uint32_t word = *words++;
213 log_debug(
" Adding weight change %d to post-neuron %u",
214 weight_change, neuron_index);
227 weight_t *
ring_buffers, uint32_t time, uint32_t colour_delay,
231 if (plastic_region_address->is_update) {
232 process_weight_update(plastic_region_address, fixed_region);
244 uint32_t pre_spike = plastic_region_address->pre_spike;
246 log_debug(
"Checking for weight changes for pre-neuron %u", pre_spike);
249 for (; n_plastic_synapses > 0; n_plastic_synapses--) {
251 uint32_t control_word = *control_words++;
252 uint32_t changed = 0;
253 plastic_words[0] = process_plastic_synapse(pre_spike, control_word,
263input_t synapse_dynamics_get_intrinsic_bias(
264 UNUSED uint32_t time, UNUSED
index_t neuron_index) {
static weight_t * ring_buffers
The ring buffers to be used in the simulation.
uint32_t time
The current timer tick value.
void log_error(const char *message,...)
void log_debug(const char *message,...)
void log_info(const char *message,...)
uint32_t synapse_delay_mask
The mask to get the synaptic delay from a "synapse".
uint32_t synapse_type_index_bits
The number of bits used by the synapse type and post-neuron index.
uint32_t synapse_index_bits
The number of bits used by just the post-neuron index.
REAL input_t
The type of an input.
static uint32_t n_neurons
The number of neurons on the core.
static uint32_t n_synapse_types
The number of synapse types.
static post_event_history_t * post_events_init_buffers(uint32_t n_neurons)
Initialise an array of post-synaptic event histories.
static void post_events_add(uint32_t time, post_event_history_t *events, post_trace_t trace)
Add a post-synaptic event to the history.
uint16_t synapse_type
The synapse type.
uint32_t count
Number of events stored.
int16_t weight_change
The amount to change the weight by (positive or negative)
uint32_t pre_spike
The pre-spike to look out for in doing the update.
post_trace_t traces[MAX_POST_SYNAPTIC_EVENTS]
Event traces.
Trace history of post-synaptic events.
void spin1_memcpy(void *dst, void const *src, uint len)
API for synapse dynamics.
uint32_t synapse_dynamics_get_plastic_pre_synaptic_events(void)
Get the counters for plastic pre synaptic events based on (if the model was compiled with SYNAPSE_BEN...
bool synapse_dynamics_initialise(address_t address, uint32_t n_neurons, uint32_t n_synapse_types, uint32_t *ring_buffer_to_input_buffer_left_shifts)
Initialise the synapse dynamics.
void synapse_dynamics_process_post_synaptic_event(uint32_t time, index_t neuron_index)
Inform the synapses that the neuron fired.
uint32_t synapse_dynamics_get_plastic_saturation_count(void)
Get the number of ring buffer saturation events due to adding plastic weights.
static uint32_t plastic_saturation_count
Count of times that the plastic math became saturated.
plastic_synapse_t synapses[]
The per-synapse information.
static post_event_history_t * post_event_history
The history data of post-events.
static uint32_t num_plastic_pre_synaptic_events
Count of pre-synaptic events relevant to plastic processing.
static change_params * params
Parameters.
bool synapse_dynamics_process_plastic_synapses(synapse_row_plastic_data_t *plastic_region_address, synapse_row_fixed_part_t *fixed_region, weight_t *ring_buffers, uint32_t time, uint32_t colour_delay, bool *write_back)
Process the dynamics of the synapses.
The format of the plastic data region of a synaptic row.
uint32_t skipped_synapses
static size_t synapse_row_num_plastic_controls(const synapse_row_fixed_part_t *fixed)
Get the number of plastic controls in the row.
static control_t * synapse_row_plastic_controls(synapse_row_fixed_part_t *fixed)
Get the array of plastic controls in the row.
static index_t synapse_row_sparse_type(uint32_t x, uint32_t synapse_index_bits, uint32_t synapse_type_mask)
Get the type code.
static index_t synapse_row_get_ring_buffer_index_combined(uint32_t simulation_timestep, uint32_t combined_synapse_neuron_index, uint32_t synapse_type_index_bits, uint32_t synapse_delay_mask)
Get the index of the ring buffer for a given timestep and combined synapse type and neuron index (as ...
static index_t synapse_row_sparse_index(uint32_t x, uint32_t synapse_index_mask)
Get the index.
static index_t synapse_row_sparse_delay(uint32_t x, uint32_t synapse_type_index_bits, uint32_t synapse_delay_mask)
Get the delay from an encoded synapse descriptor.
static index_t synapse_row_sparse_type_index(uint32_t x, uint32_t synapse_type_index_mask)
Get the type and index.
uint16_t control_t
Define the type of the control data.
static weight_t synapse_row_sparse_weight(uint32_t x)
Get the weight from an encoded synapse descriptor.
The type of the fixed part of the row. The fixed-plastic part follows.
uint32_t synapse_index_mask
Mask to pick out the synapse index.
uint32_t synapse_type_index_mask
Mask to pick out the synapse type and index.
uint32_t synapse_type_mask
Mask to pick out the synapse type.