sPyNNaker neural_modelling 7.3.1
Loading...
Searching...
No Matches
Data Structures | Functions
matrix_generator_stdp.h File Reference

STDP synaptic matrix implementation. More...

#include <stdbool.h>
#include <spin1_api.h>
#include <debug.h>
#include <delay_extension/delay_extension.h>
#include "matrix_generator_common.h"
#include <synapse_expander/generator_types.h>
#include <utils.h>

Go to the source code of this file.

Data Structures

struct  row_plastic_t
 The layout of the initial plastic synapse part of the row. More...
 
struct  row_fixed_t
 The layout of the fixed synapse region of the row; the fixed-fixed region is empty. More...
 
struct  matrix_generator_stdp_data_t
 Data for the generator. More...
 
union  matrix_generator_stdp_data_t.__unnamed25__
 
union  matrix_generator_stdp_data_t.__unnamed27__
 

Functions

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.
 
static row_fixed_tget_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 size in number of synapses.
 
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.
 
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.
 
void * matrix_generator_stdp_initialize (void **region, void *synaptic_matrix)
 Initialise the STDP synaptic matrix generator.
 
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.
 

Detailed Description

STDP synaptic matrix implementation.

Definition in file matrix_generator_stdp.h.


Data Structure Documentation

◆ row_plastic_t

struct row_plastic_t

The layout of the initial plastic synapse part of the row.

Definition at line 32 of file matrix_generator_stdp.h.

Data Fields
uint32_t plastic_plastic_size the plastic-plastic size within the row
uint16_t plastic_plastic_data[] the plastic-plastic data within the row

◆ row_fixed_t

struct row_fixed_t

The layout of the fixed synapse region of the row; the fixed-fixed region is empty.

Definition at line 38 of file matrix_generator_stdp.h.

Data Fields
uint32_t fixed_fixed_size the fixed-fixed size within the fixed region
uint32_t fixed_plastic_size the fixed-plastic size within the fixed region
uint16_t fixed_plastic_data[] the fixed-plastic data within the fixed region

◆ matrix_generator_stdp_data_t

struct matrix_generator_stdp_data_t

Data for the generator.

Definition at line 45 of file matrix_generator_stdp.h.

Data Fields
union matrix_generator_stdp_data_t.__unnamed25__ __unnamed__
union matrix_generator_stdp_data_t.__unnamed27__ __unnamed__
uint32_t max_row_n_synapses The maximum number of synapses on a row.
uint32_t max_delayed_row_n_synapses The maximum number of synapses on a delayed row.
uint32_t max_row_n_words The maximum number of words on a row.
uint32_t max_delayed_row_n_words The maximum number of words on a delayed row.
uint32_t synapse_type The matrix synapse type.
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 max_stage The maximum delay stage, including 0 for no delay stage.
uint32_t max_delay_per_stage The maximum delay per delay stage in time steps.
uint32_t delay_bits The number of bits needed to represent the maximum delay per stage.
uint32_t n_pre_neurons The number of pre-synaptic neurons.
uint32_t n_pre_neurons_per_core The number of pre-synaptic neurons per core.
uint32_t n_half_words_per_pp_row_header The number of half-words in a plastic-plastic row header.
uint32_t n_half_words_per_pp_synapse The number of half-words in each plastic-plastic synapse.
uint32_t weight_half_word The index of the half-word that will contain the weight.
uint32_t first_word_is_row_index

Whether to write the pre-neuron index in the first word of the header space (used for externally changeable synapses)

uint32_t row_offset The offset of the row index to use.

◆ matrix_generator_stdp_data_t.__unnamed25__

union matrix_generator_stdp_data_t.__unnamed25__

Definition at line 46 of file matrix_generator_stdp.h.

Data Fields
uint32_t * synaptic_matrix The address of the synaptic matrix (once initialised)
uint32_t synaptic_matrix_offset The offset of the synaptic matrix (as read from SDRAM)

◆ matrix_generator_stdp_data_t.__unnamed27__

union matrix_generator_stdp_data_t.__unnamed27__

Definition at line 52 of file matrix_generator_stdp.h.

Data Fields
uint32_t * delayed_synaptic_matrix The address of the delayed synaptic matrix (once initialised)
uint32_t delayed_matrix_offset The offset of the delayed synaptic matrix (as read from SDRAM)

Function Documentation

◆ plastic_half_words()

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 
)
static

Get the maximum number of plastic half-words in a row.

Parameters
[in]n_half_words_per_pp_headerthe number of half-words at the start of each row
[in]n_half_words_per_pp_synapsethe number of half-words used by each synapse
[in]max_row_n_synapsesthe maximum number of synapses in a row
Returns
the number of plastic half-words in a maximum length row

Definition at line 104 of file matrix_generator_stdp.h.

◆ get_stdp_fixed_row()

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 
)
static

Get the fixed part of a row that comes after the plastic part. Note that this assumes the max row size in number of synapses.

Parameters
[in]plastic_rowA pointer to the row to find the fixed part of
[in]n_half_words_per_pp_headerthe (even) number of header words at the start of the plastic data
[in]n_half_words_per_pp_synapsethe number of half-words in each synapse, not necessarily even
[in]max_row_n_synapsesthe maximum number of synapses in the row
Returns
A pointer to the fixed part of the row assuming all synapses used

Definition at line 125 of file matrix_generator_stdp.h.

◆ setup_stdp_rows()

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 
)
static

Set up the rows so that they are ready for writing to.

Parameters
[in]matrixThe base address of the matrix to set up
[in]n_rowsThe number of rows in the matrix
[in]n_half_words_per_pp_headerThe number of half-words at the start of each row
[in]n_half_words_per_pp_synapseThe number of half-words used by each synapse
[in]max_row_n_synapsesThe maximum number of synapses in a row
[in]max_row_n_wordsThe maximum number of words used by a row

Definition at line 144 of file matrix_generator_stdp.h.

◆ build_fixed_plastic_half_word()

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 
)
static

Build a fixed-plastic half-word from its components.

Parameters
[in]delayThe delay of the synapse
[in]typeThe synapse type
[in]post_indexThe core-relative index of the target neuron
[in]synapse_type_bitsThe number of bits for the synapse type
[in]synapse_index_bitsThe number of bits for the target neuron id
[in]delay_bitsThe number of bits for the synaptic delay
Returns
A half-word fixed-plastic synapse

Definition at line 183 of file matrix_generator_stdp.h.

◆ matrix_generator_stdp_initialize()

void * matrix_generator_stdp_initialize ( void **  region,
void *  synaptic_matrix 
)

Initialise the STDP synaptic matrix generator.

Parameters
[in,out]regionRegion to read parameters from. Should be updated to position just after parameters after calling.
[in]synaptic_matrixThe base address of the synaptic matrix
Returns
A data item to be passed in to other functions later on

Definition at line 207 of file matrix_generator_stdp.h.

◆ matrix_generator_stdp_free()

void matrix_generator_stdp_free ( void *  generator)

Free any data for the STDP synaptic matrix generator.

Parameters
[in]generatorThe generator to free

Definition at line 249 of file matrix_generator_stdp.h.

◆ matrix_generator_stdp_write_synapse()

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 
)
static

How to write a synapse to a matrix.

Parameters
[in]generatorThe generator data
[in]pre_indexThe index of the pre-neuron relative to the start of the matrix
[in]post_indexThe index of the post-neuron on this core
[in]weightThe weight of the synapse in raw form
[in]delayThe delay of the synapse in time steps
[in]weight_scaleThe scale to apply to the weight if needed

Definition at line 263 of file matrix_generator_stdp.h.