103 uint32_t n_elements =
106 for (uint32_t i=0; i < n_elements; i++) {
107 log_debug(
"index %d, pop index %d, sub pop index %d, neuron_index %d",
118 if (__builtin_expect(
120 log_error(
"Could not add state (0x%08x) to queued states", state);
127 if (__builtin_expect(
137 if (__builtin_expect(
138 !circular_buffer_add(
free_states, (uint32_t) state), 0)) {
139 log_error(
"Could not add state (0x%08x) to free states", state);
146 if (__builtin_expect(
147 !circular_buffer_get_next(
free_states, (uint32_t *) &state), 0)) {
159 address_t sdram_sp_address, uint32_t *recording_regions_used) {
164 uint32_t n_states = 1;
168 log_debug(
"Rewiring period %u, fast=%u, n_states=%u",
173 log_error(
"Could not allocate current state queue");
179 log_error(
"Could not allocate free state queue");
182 if (states ==
NULL) {
186 for (uint32_t i = 0; i < n_states; i++) {
187 _free_state(&states[i]);
195 log_error(
"Could not initialise formation parameters");
205 log_error(
"Could not initialise elimination parameters");
238 uint32_t total_offset = row_offset + column_offset;
240 uint32_t pre_app_pop = 0, pre_sub_pop = 0, m_pop_index = 0, neuron_id = 0;
241 if (entry.neuron_index == 0xFFFF) {
243 &neuron_id, spike, &m_pop_index)) {
247 pre_app_pop = entry.pop_index;
248 pre_sub_pop = entry.sub_pop_index;
249 neuron_id = entry.neuron_index;
252 key_atom_info_t *key_atom_info = &prepop_info->key_atom_info[pre_sub_pop];
253 if (entry.neuron_index != 0xFFFF) {
254 *spike = key_atom_info->key | (neuron_id << key_atom_info->n_colour_bits);
255 m_pop_index = key_atom_info->m_pop_index;
263 while (index < m_pop_index) {
265 log_error(
"FAIL@key %d, index %d (failed at %d)",
266 *spike, m_pop_index, index);
274 current_state->pre_syn_id = neuron_id;
275 current_state->post_syn_id = post_id;
278 current_state->pre_population_info = prepop_info;
279 current_state->key_atom_info = key_atom_info;
280 current_state->post_to_pre.neuron_index = neuron_id;
281 current_state->post_to_pre.pop_index = pre_app_pop;
282 current_state->post_to_pre.sub_pop_index = pre_sub_pop;
285 current_state->with_replacement =
rewiring_data.with_replacement;
286 _queue_state(current_state);
290static bool do_formation(uint32_t time,
synaptic_row_t restrict row,
296 uint32_t pre_id = current_state->key_atom_info->lo_atom
297 + current_state->pre_syn_id;
298 uint32_t
id = current_state->post_syn_id;
322 if (current_state->element_exists) {
325 current_state->post_syn_id, row,
326 ¤t_state->weight, ¤t_state->delay,
327 ¤t_state->offset, ¤t_state->synapse_type)) {
328 log_debug(
"Post neuron %u not in row", current_state->post_syn_id);
337 uint32_t pre_id = current_state->key_atom_info->lo_atom + current_state->pre_syn_id;
338 uint32_t
id = current_state->post_syn_id;
357 if (current_state->with_replacement) {
359 return do_formation(
time, row, current_state);
363 current_state->post_syn_id, row,
364 &(current_state->weight), &(current_state->delay),
365 &(current_state->offset), &(current_state->synapse_type))) {
366 return do_formation(
time, row, current_state);
368 log_debug(
"Post neuron %u already in row", current_state->post_syn_id);
379 _free_state(current_state);
uint32_t time
The current timer tick value.
circular_buffer circular_buffer_initialize(uint32_t size)
void log_error(const char *message,...)
void log_debug(const char *message,...)
API for synapse elimination.
elimination_params_t * synaptogenesis_elimination_init(uint8_t **data)
Read and return an elimination parameter data structure from the data stream.
static bool synaptogenesis_elimination_rule(current_state_t *current_state, const elimination_params_t *params, uint32_t time, synaptic_row_t row)
Elimination rule for synaptogenesis.
Configuration of synapse elimination rule.
void partner_init(uint8_t **data)
Initialise the partner selection rule.
static void partner_spike_received(uint32_t time, spike_t spike)
Notifies the rule that a spike has been received.
static bool potential_presynaptic_partner(uint32_t time, uint32_t *restrict population_id, uint32_t *restrict sub_population_id, uint32_t *restrict neuron_id, spike_t *restrict spike, uint32_t *restrict m_pop_index)
Choose the potential (remote) synaptic partner.
maths-util.h - first created 7/10/2013 version 0.1
struct synaptic_row * synaptic_row_t
The type of a synaptic row.
uint32_t spike_t
The type of a spike.
Partner selection rule common API.
Master pop(ulation) table API.
bool population_table_get_next_address(spike_t *spike, pop_table_lookup_result_t *result)
Get the next row data for a previously given spike. If no spike has been given, return False.
bool population_table_get_first_address(spike_t spike, pop_table_lookup_result_t *result)
Get the first row data for the given input spike.
A structure to hold a response to a population table lookup.
bool recording_record(channel_index_t channel, void *data, size_t size_bytes)
void rt_error(uint code,...)
uint32_t element_exists
does the connection already exist
static uint8_t * sp_structs_read_in_common(address_t sdram_sp_address, rewiring_data_t *rewiring_data, pre_pop_info_table_t *pre_info, post_to_pre_entry **post_to_pre_table)
Common code for structural plasticity initialisation.
uint32_t post_low_atom
Low atom copied from rewiring data.
mars_kiss64_seed_t * local_seed
Seed referenced from rewiring data.
static uint32_t rand_int(uint32_t max, mars_kiss64_seed_t seed)
struct representing the current state of rewiring
Entry of map from post-connection to pre-connection neural indices.
individual pre-synaptic sub-population information
table of individual pre-synaptic information
parameters of the synaptic rewiring model
uint32_t synapse_dynamics_n_connections_in_row(synapse_row_fixed_part_t *fixed)
Get the number of connections in the given row.
bool synapse_dynamics_find_neuron(uint32_t id, synaptic_row_t row, weight_t *weight, uint16_t *delay, uint32_t *offset, uint32_t *synapse_type)
Search the synaptic row for the the connection with the specified post-synaptic ID.
implementation for handling the processing of synapse rows.
static synapse_row_fixed_part_t * synapse_row_fixed_region(synaptic_row_t row)
Get the address of the non-plastic (or fixed) region.
This file contains the main interface for structural plasticity.
bool synaptogenesis_dynamics_rewire(uint32_t time, spike_t *spike, pop_table_lookup_result_t *result)
Trigger the process of synaptic rewiring.
#define ID_SHIFT
How much to shift post-IDs by.
rewiring_data_t rewiring_data
the instantiation of the rewiring data
pre_pop_info_table_t pre_info
pre-population information table
uint32_t rewiring_recording_index
The recording region for the structural events.
void synaptogenesis_spike_received(uint32_t time, spike_t spike)
Indicates that a spike has been received.
static circular_buffer current_state_queue
Current states in use.
structural_recording_values_t structural_recording_values
Working buffer for the recording of structural changes.
uint32_t synaptogenesis_n_updates(void)
Number of updates to do of synaptogenesis this time step.
static formation_params_t ** formation_params
The formation parameters per pre-population.
static bool row_restructure(uint32_t time, synaptic_row_t restrict row, current_state_t *restrict current_state)
Performs the actual restructuring of a row.
static uint32_t last_rewiring_time
Timer callbacks since last rewiring.
void print_post_to_pre_entry(void)
Print a certain data object.
static elimination_params_t ** elimination_params
The elimination parameters per pre-population.
static post_to_pre_entry * post_to_pre_table
inverse of synaptic matrix
@ FORM_FLAG
Formation flag.
@ ELIM_FLAG
Elimination flag.
static circular_buffer free_states
Free current states.
#define PRE_ID_SHIFT
How much to shift pre-IDs by.
bool synaptogenesis_row_restructure(uint32_t time, synaptic_row_t row)
Perform the actual restructuring of a row.
bool synaptogenesis_dynamics_initialise(address_t sdram_sp_address, uint32_t *recording_regions_used)
Initialisation of synaptic rewiring (synaptogenesis) parameters (random seed, spread of receptive fie...
Struct for structural recording data.