34#define IS_CONNECTION_LAT 1
36#ifndef SOMETIMES_UNUSED
37#define SOMETIMES_UNUSED __attribute__((unused))
43 uint8_t sub_pop_index;
44 uint16_t neuron_index;
59 uint16_t no_pre_vertices;
64 uint32_t connection_type;
65 uint32_t total_no_atoms;
80 uint32_t app_no_atoms;
81 uint32_t machine_no_atoms;
84 uint32_t with_replacement;
98 uint32_t with_replacement;
101 uint32_t post_syn_id;
123static inline uint32_t
rand_int(uint32_t max, mars_kiss64_seed_t
seed) {
138 uint32_t *restrict neuron_id, uint32_t *restrict population_id,
139 uint32_t *restrict sub_population_id, uint32_t *restrict m_pop_index) {
142 for (uint32_t i = 0; i < pre_pop_info_table->no_pre_pops; i++) {
143 const pre_info_t *pre_pop_info = pre_pop_info_table->prepop_info[i];
147 for (
int j = 0; j < pre_pop_info->no_pre_vertices; j++) {
149 if ((spike & kai->mask) == kai->key) {
151 *sub_population_id = j;
152 *neuron_id = (spike & ~kai->mask) >> kai->n_colour_bits;
153 *m_pop_index = kai->m_pop_index;
173 uint32_t pop_neuron_id, uint32_t *restrict sub_population_id,
174 uint32_t *restrict sub_pop_neuron_id, uint32_t *restrict spike) {
176 pre_pop_info_table->prepop_info[population_id];
177 uint32_t neuron_id = pop_neuron_id;
178 for (uint32_t i = 0; i < app_pop_info->no_pre_vertices; i++) {
180 uint32_t n_atoms = kai->n_atoms;
181 if (neuron_id < n_atoms) {
182 *sub_population_id = i;
183 *sub_pop_neuron_id = neuron_id;
184 *spike = kai->key | (neuron_id << kai->n_colour_bits);
187 neuron_id -= n_atoms;
202 current_state->post_to_pre_table_entry->neuron_index = 0xFFFF;
212 uint32_t appr_scaled_weight = current_state->pre_population_info->weight;
214 uint32_t actual_delay;
215 uint32_t offset = current_state->pre_population_info->delay_hi -
216 current_state->pre_population_info->delay_lo;
217 actual_delay =
rand_int(offset, *(current_state->local_seed)) +
218 current_state->pre_population_info->delay_lo;
221 current_state->post_syn_id, row, appr_scaled_weight, actual_delay,
222 current_state->pre_population_info->connection_type)) {
230 current_state->post_to_pre_table_entry, 4);
231 *ppentry = current_state->post_to_pre;
249 uint8_t *data = (uint8_t *) sdram_sp_address;
254 pre_info->prepop_info = spin1_malloc(
257 log_error(
"Could not initialise pre population info");
262 uint32_t pre_size = (
pre_info->prepop_info[i]->no_pre_vertices
264 pre_info->prepop_info[i] = spin1_malloc(pre_size);
266 log_error(
"Could not initialise pre population info %d", i);
272 "delay lo %u, delay hi %u, weight %d",
273 pre_info->prepop_info[i]->no_pre_vertices,
274 pre_info->prepop_info[i]->sp_control,
278 log_debug(
"connection_type = %d, total_no_atoms=%d",
279 pre_info->prepop_info[i]->connection_type,
280 pre_info->prepop_info[i]->total_no_atoms);
285 uint32_t n_elements =
288 for (uint32_t i=0; i < n_elements; i++){
289 log_debug(
"index %d, pop index %d, sub pop index %d, neuron_index %d",
295 return (uint8_t *) data;
void log_error(const char *message,...)
void log_debug(const char *message,...)
static uint32_t key
Base multicast key for sending messages.
static uint32_t n_colour_bits
The number of colour bits (both from source and to send)
Configuration of synapse elimination rule.
struct synaptic_row * synaptic_row_t
The type of a synaptic row.
uint32_t spike_t
The type of a spike.
uint32_t mars_kiss64_seed(mars_kiss64_seed_t seed)
uint32_t mars_kiss64_seed_t[4]
static mars_kiss64_seed_t seed
YUCK copy and pasted RNG to allow inlining and also to avoid horrific executable bloat.
void rt_error(uint code,...)
uint32_t offset
offset in synaptic row (if exists)
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 synapse_type
synapse type
static bool sp_structs_add_synapse(current_state_t *restrict current_state, synaptic_row_t restrict row)
Adds a synapse to the relevant structures.
uint32_t post_low_atom
Low atom copied from rewiring data.
static bool sp_structs_remove_synapse(current_state_t *restrict current_state, synaptic_row_t restrict row)
Removes a synapse from the relevant structures.
uint16_t weight
current weight (if exists)
mars_kiss64_seed_t * local_seed
Seed referenced from rewiring data.
static uint32_t rand_int(uint32_t max, mars_kiss64_seed_t seed)
uint16_t delay
current delay (if exists)
static bool sp_structs_find_by_spike(const pre_pop_info_table_t *pre_pop_info_table, spike_t spike, uint32_t *restrict neuron_id, uint32_t *restrict population_id, uint32_t *restrict sub_population_id, uint32_t *restrict m_pop_index)
unpack the spike into key and identifying information for the neuron; Identify pop,...
static bool sp_structs_get_sub_pop_info(const pre_pop_info_table_t *pre_pop_info_table, uint32_t population_id, uint32_t pop_neuron_id, uint32_t *restrict sub_population_id, uint32_t *restrict sub_pop_neuron_id, uint32_t *restrict spike)
Get the sub-population id and sub-population-based neuron id given the population id and the populati...
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
void spin1_memcpy(void *dst, void const *src, uint len)
API for synapse dynamics.
bool synapse_dynamics_add_neuron(uint32_t id, synaptic_row_t row, weight_t weight, uint32_t delay, uint32_t type)
Add an entry in the synaptic row.
bool synapse_dynamics_remove_neuron(uint32_t offset, synaptic_row_t row)
Remove the entry at the specified offset in the synaptic row.
implementation for handling the processing of synapse rows.
rewiring_data_t rewiring_data
the instantiation of the rewiring data
pre_pop_info_table_t pre_info
pre-population information table
static post_to_pre_entry * post_to_pre_table
inverse of synaptic matrix