34 uint16_t plastic_plastic_data[];
41 uint16_t fixed_plastic_data[];
45typedef struct matrix_generator_stdp {
48 uint32_t *synaptic_matrix;
50 uint32_t synaptic_matrix_offset;
54 uint32_t *delayed_synaptic_matrix;
56 uint32_t delayed_matrix_offset;
105 uint32_t n_half_words_per_pp_synapse, uint32_t max_row_n_synapses) {
106 uint32_t n_half_words = n_half_words_per_pp_header
107 + (n_half_words_per_pp_synapse * max_row_n_synapses);
108 if (n_half_words & 0x1) {
126 uint32_t n_half_words_per_pp_header, uint32_t n_half_words_per_pp_synapse,
127 uint32_t max_row_n_synapses) {
129 n_half_words_per_pp_synapse, max_row_n_synapses);
145 uint32_t n_half_words_per_pp_header, uint32_t n_half_words_per_pp_synapse,
146 uint32_t max_row_n_synapses, uint32_t max_row_n_words,
147 uint32_t first_header_word_is_row_index, uint32_t row_offset) {
151 n_half_words_per_pp_synapse, max_row_n_synapses) >> 1;
152 for (uint32_t i = 0; i < n_rows; i++) {
156 if (first_header_word_is_row_index) {
157 data[0] = i + row_offset;
161 for (uint32_t j = 1; j < plastic_words; j++) {
166 n_half_words_per_pp_synapse, max_row_n_synapses);
184 uint16_t delay, uint32_t type,
189 uint16_t delay_mask = (1 << delay_bits) - 1;
193 wrd |= (delay & delay_mask) <<
214 *obj = *params_sdram;
215 *
region = ¶ms_sdram[1];
218 uint32_t *syn_mat = synaptic_matrix;
219 if (obj->synaptic_matrix_offset != 0xFFFFFFFF) {
220 obj->synaptic_matrix = &(syn_mat[obj->synaptic_matrix_offset]);
227 obj->synaptic_matrix =
NULL;
230 if (obj->delayed_matrix_offset != 0xFFFFFFFF) {
231 obj->delayed_synaptic_matrix = &(syn_mat[obj->delayed_matrix_offset]);
239 obj->delayed_synaptic_matrix =
NULL;
264 uint32_t pre_index, uint16_t post_index, accum weight, uint16_t delay,
265 unsigned long accum weight_scale) {
272 if (delay_and_stage.stage == 0) {
280 log_warning(
"Row %u at 0x%08x, 0x%08x of matrix 0x%08x is already full (%u of %u)",
281 pre_index, plastic_row, fixed_row, data->synaptic_matrix, pos,
294 log_warning(
"Row %u at 0x%08x, 0x%08x of matrix 0x%08x is already full (%u of %u)",
295 pre_index, plastic_row, fixed_row, data->synaptic_matrix, pos,
void log_warning(const char *message,...)
Declarations for delay extensions.
General types associated with generators.
static uint16_t rescale_weight(accum weight, unsigned long accum weight_scale)
Rescales a weight to account for weight granularity and type-converts it.
uint32_t synapse_index_bits
The number of bits used by just the post-neuron index.
Common functions for matrix generation.
static struct delay_value get_delay(uint16_t delay_value, uint32_t max_stage, uint32_t max_delay_per_stage)
Get a converted delay value and stage.
static void * get_delay_row(uint32_t *delayed_synaptic_matrix, uint32_t max_delayed_row_n_words, uint32_t pre_index, uint32_t delay_stage, uint32_t n_pre_neurons_per_core, uint32_t max_delay_stage, uint32_t n_pre_neurons)
Get a delayed synaptic row for a given neuron and delay stage.
static void * get_row(uint32_t *synaptic_matrix, uint32_t max_row_n_words, uint32_t pre_index)
Get a synaptic row for a given neuron.
A converted final delay value and delay stage.
uint32_t synapse_type
The matrix synapse type.
void * matrix_generator_stdp_initialize(void **region, void *synaptic_matrix)
Initialise the STDP synaptic matrix generator.
uint32_t max_stage
The maximum delay stage, including 0 for no delay stage.
uint16_t plastic_plastic_data[]
the plastic-plastic data within the row
static uint32_t plastic_half_words(uint32_t n_half_words_per_pp_header, uint32_t n_half_words_per_pp_synapse, uint32_t max_row_n_synapses)
Get the maximum number of plastic half-words in a row.
uint32_t first_word_is_row_index
uint32_t n_pre_neurons
The number of pre-synaptic neurons.
uint32_t max_delayed_row_n_words
The maximum number of words on a delayed row.
uint32_t fixed_fixed_size
the fixed-fixed size within the fixed region
uint32_t max_row_n_synapses
The maximum number of synapses on a row.
uint16_t fixed_plastic_data[]
the fixed-plastic data within the fixed region
uint32_t delay_bits
The number of bits needed to represent the maximum delay per stage.
static row_fixed_t * get_stdp_fixed_row(row_plastic_t *plastic_row, uint32_t n_half_words_per_pp_header, uint32_t n_half_words_per_pp_synapse, uint32_t max_row_n_synapses)
Get the fixed part of a row that comes after the plastic part. Note that this assumes the max row siz...
uint32_t n_half_words_per_pp_synapse
The number of half-words in each plastic-plastic synapse.
void matrix_generator_stdp_free(void *generator)
Free any data for the STDP synaptic matrix generator.
static bool matrix_generator_stdp_write_synapse(void *generator, uint32_t pre_index, uint16_t post_index, accum weight, uint16_t delay, unsigned long accum weight_scale)
How to write a synapse to a matrix.
uint32_t n_half_words_per_pp_row_header
The number of half-words in a plastic-plastic row header.
uint32_t plastic_plastic_size
the plastic-plastic size within the row
uint32_t max_row_n_words
The maximum number of words on a row.
uint32_t n_pre_neurons_per_core
The number of pre-synaptic neurons per core.
static void setup_stdp_rows(uint32_t *matrix, uint32_t n_rows, uint32_t n_half_words_per_pp_header, uint32_t n_half_words_per_pp_synapse, uint32_t max_row_n_synapses, uint32_t max_row_n_words, uint32_t first_header_word_is_row_index, uint32_t row_offset)
Set up the rows so that they are ready for writing to.
uint32_t weight_half_word
The index of the half-word that will contain the weight.
uint32_t fixed_plastic_size
the fixed-plastic size within the fixed region
uint32_t max_delay_per_stage
The maximum delay per delay stage in time steps.
static uint16_t build_fixed_plastic_half_word(uint16_t delay, uint32_t type, uint32_t post_index, uint32_t synapse_type_bits, uint32_t synapse_index_bits, uint32_t delay_bits)
Build a fixed-plastic half-word from its components.
uint32_t max_delayed_row_n_synapses
The maximum number of synapses on a delayed row.
uint32_t synapse_type_bits
The number of bits needed to represent the synapse type.
uint32_t synapse_index_bits
The number of bits needed to represent the synapse neuron id.
uint32_t row_offset
The offset of the row index to use.
The layout of the fixed synapse region of the row; the fixed-fixed region is empty.
The layout of the initial plastic synapse part of the row.
void sark_free(void *ptr)
region
spike source array region IDs in human readable form
uint32_t synapse_index_mask
Mask to pick out the synapse index.
uint32_t synapse_type_bits
Number of bits in the synapse type.
uint32_t synapse_type_mask
Mask to pick out the synapse type.