34 uint32_t fixed_fixed_data[];
40#define SYNAPSE_WEIGHT_SHIFT 16
45#define SYNAPSE_WEIGHT_MASK 0xFFFF
48typedef struct matrix_generator_static_data {
51 uint32_t *synaptic_matrix;
53 uint32_t synaptic_matrix_offset;
57 uint32_t *delayed_synaptic_matrix;
59 uint32_t delayed_matrix_offset;
89static void setup_rows(uint32_t *matrix, uint32_t n_rows, uint32_t max_row_n_words) {
90 for (uint32_t i = 0; i < n_rows; i++) {
92 log_debug(
"Setting up row %u at 0x%08x with %u max words", i, row, max_row_n_words);
111 uint16_t weight, uint16_t delay, uint32_t type,
134 void *synaptic_matrix) {
142 uint32_t *syn_mat = synaptic_matrix;
143 if (data->synaptic_matrix_offset != 0xFFFFFFFF) {
144 data->synaptic_matrix = &(syn_mat[data->synaptic_matrix_offset]);
148 data->synaptic_matrix =
NULL;
150 if (data->delayed_matrix_offset != 0xFFFFFFFF) {
151 data->delayed_synaptic_matrix = &(syn_mat[data->delayed_matrix_offset]);
156 data->delayed_synaptic_matrix =
NULL;
182 uint32_t pre_index, uint16_t post_index, accum weight, uint16_t delay,
183 unsigned long accum weight_scale) {
189 if (delay_and_stage.stage == 0) {
193 log_warning(
"Row %u at 0x%08x of matrix 0x%08x is already full (%u of %u)",
203 log_warning(
"Row %u, stage %u at 0x%08x of delayed matrix 0x%08x"
204 "is already full (%u of %u)",
205 pre_index, delay_and_stage.stage, row,
void log_warning(const char *message,...)
void log_debug(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_delay_mask
The mask to get the synaptic delay from a "synapse".
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.
uint32_t synapse_index_bits
The number of bits needed to represent the synapse neuron id.
uint32_t max_delayed_row_n_words
The maximum number of words (excluding headers) on a delayed row.
static bool matrix_generator_static_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_pre_neurons_per_core
The number of pre-synaptic neurons per core.
static void matrix_generator_static_free(void *generator)
How to free any data for the static synaptic matrix generator.
uint32_t max_stage
The maximum delay stage, including 0 for no delay stage.
uint32_t fixed_fixed_size
the fixed-fixed size within a row
uint32_t fixed_plastic_size
the fixed-plastic size within a row
uint32_t plastic_plastic_size
the plastic-plastic size within a row
#define SYNAPSE_WEIGHT_MASK
The mask of a weight before shifting.
uint32_t delay_bits
The number of bits needed to represent the maximum delay per stage.
#define SYNAPSE_WEIGHT_SHIFT
The shift of the weight within a synaptic word.
uint32_t fixed_fixed_data[]
the fixed-fixed data within a row
static uint32_t build_static_word(uint16_t weight, uint16_t delay, uint32_t type, uint16_t post_index, uint32_t synapse_type_bits, uint32_t synapse_index_bits, uint32_t delay_bits)
Build a static synaptic word from components.
static void * matrix_generator_static_initialize(void **region, void *synaptic_matrix)
How to initialise the static synaptic matrix generator.
uint32_t n_pre_neurons
The number of pre-synaptic neurons.
uint32_t max_row_n_words
The maximum number of words (excluding headers) on a row.
uint32_t max_delay_per_stage
The maximum delay per delay stage in time steps.
uint32_t synapse_type_bits
The number of bits needed to represent the synapse type.
static void setup_rows(uint32_t *matrix, uint32_t n_rows, uint32_t max_row_n_words)
Set up the rows so that they are ready for writing to.
The stored data used to generate rows.
The layout of a purely static row of a synaptic matrix.
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.