sPyNNaker neural_modelling 7.3.1
Loading...
Searching...
No Matches
Data Structures | Functions | Variables
synapses.c File Reference

Implementation of non-inlined API in synapses.h. More...

#include "synapses.h"
#include "spike_processing.h"
#include "neuron.h"
#include "plasticity/synapse_dynamics.h"
#include <profiler.h>
#include <debug.h>
#include <spin1_api.h>
#include <utils.h>

Go to the source code of this file.

Data Structures

struct  synapse_params
 The layout of the synapse parameters region. More...
 

Functions

static const char * get_type_char (uint32_t synapse_type)
 get the synapse type character
 
static void print_synaptic_row (synaptic_row_t synaptic_row)
 Print a synaptic row.
 
static void print_ring_buffers (uint32_t time)
 Print the contents of the ring buffers.
 
static bool process_fixed_synapses (synapse_row_fixed_part_t *fixed_region, uint32_t time, uint32_t colour_delay)
 The "inner loop" of the neural simulation.
 
bool synapses_initialise (address_t synapse_params_address, uint32_t *n_neurons_out, uint32_t *n_synapse_types_out, weight_t **ring_buffers_out, uint32_t **ring_buffer_to_input_buffer_left_shifts, bool *clear_input_buffers_of_late_packets_init, uint32_t *incoming_spike_buffer_size)
 Initialise the synapse processing.
 
void synapses_flush_ring_buffers (timer_t time)
 Reset the ring buffers to 0 at the given time.
 
bool synapses_process_synaptic_row (uint32_t time, uint32_t spike_colour, uint32_t colour_mask, synaptic_row_t row, bool *write_back)
 process a synaptic row
 
uint32_t synapses_get_pre_synaptic_events (void)
 returns the counters for plastic and fixed pre synaptic events based on (if the model was compiled with SYNAPSE_BENCHMARK parameter) or returns 0
 
void synapses_resume (timer_t time)
 Resume processing of synapses after a pause.
 

Variables

uint32_t num_fixed_pre_synaptic_events = 0
 if using profiler import profiler tags
 
static uint32_t n_neurons
 The number of neurons.
 
static uint32_t n_synapse_types
 The number of synapse types.
 
static weight_t * ring_buffers
 Ring buffers to handle delays between synapses and neurons.
 
static uint32_t ring_buffer_size
 Ring buffer size.
 
static uint32_t ring_buffer_mask
 Ring buffer mask.
 
static uint32_t * ring_buffer_to_input_left_shifts
 Amount to left shift the ring buffer by to make it an input.
 
uint32_t synapse_type_index_bits
 Number of bits needed for the synapse type and index.
 
uint32_t synapse_type_index_mask
 Mask to pick out the synapse type and index.
 
uint32_t synapse_index_bits
 Number of bits in the synapse index.
 
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.
 
uint32_t synapse_delay_bits
 Number of bits in the delay.
 
uint32_t synapse_delay_mask
 Mask to pick out the delay.
 
uint32_t synapses_saturation_count = 0
 Count of the number of times the ring buffers have saturated.
 
uint32_t skipped_synapses = 0
 
uint32_t late_spikes = 0
 Count of the spikes that are received late.
 
uint32_t max_late_spike = 0
 The maximum lateness of a spike.
 
static uint32_t n_neurons_peak
 Number of neurons.
 
static uint32_t synapse_delay_mask_shifted = 0
 The mask of the delay shifted into position i.e. pre-shift.
 

Detailed Description

Implementation of non-inlined API in synapses.h.

Definition in file synapses.c.


Data Structure Documentation

◆ synapse_params

struct synapse_params

The layout of the synapse parameters region.

Definition at line 256 of file synapses.c.

Data Fields
uint32_t n_neurons
uint32_t n_synapse_types
uint32_t log_n_neurons
uint32_t log_n_synapse_types
uint32_t log_max_delay
uint32_t drop_late_packets
uint32_t incoming_spike_buffer_size
uint32_t ring_buffer_shifts[]

Function Documentation

◆ get_type_char()

static const char * get_type_char ( uint32_t  synapse_type)
inlinestatic

get the synapse type character

Parameters
[in]synapse_typethe synapse type
Returns
a single character string describing the synapse type

Definition at line 105 of file synapses.c.

◆ print_synaptic_row()

static void print_synaptic_row ( synaptic_row_t  synaptic_row)
inlinestatic

Print a synaptic row.

Only does anything when debugging.

Parameters
[in]synaptic_rowThe synaptic row to print

Definition at line 114 of file synapses.c.

◆ print_ring_buffers()

static void print_ring_buffers ( uint32_t  time)
inlinestatic

Print the contents of the ring buffers.

Only does anything when debugging.

Parameters
[in]timeThe current timestamp

Definition at line 165 of file synapses.c.

◆ process_fixed_synapses()

static bool process_fixed_synapses ( synapse_row_fixed_part_t fixed_region,
uint32_t  time,
uint32_t  colour_delay 
)
inlinestatic

The "inner loop" of the neural simulation.

Every spike event could cause up to 256 different weights to be put into the ring buffer.

Parameters
[in]fixed_regionThe fixed region of the synaptic matrix
[in]timeThe current simulation time
Returns
Always true

Definition at line 206 of file synapses.c.

◆ synapses_initialise()

bool synapses_initialise ( address_t  synapse_params_address,
uint32_t *  n_neurons,
uint32_t *  n_synapse_types,
weight_t **  ring_buffers,
uint32_t **  ring_buffer_to_input_buffer_left_shifts,
bool *  clear_input_buffers_of_late_packets_init,
uint32_t *  incoming_spike_buffer_size 
)

Initialise the synapse processing.

Parameters
[in]synapse_params_addressSynapse configuration in SDRAM
[out]n_neuronsNumber of neurons that will be simulated
[out]n_synapse_typesNumber of synapse types that will be simulated
[out]ring_buffersThe ring buffers that will be used
[out]ring_buffer_to_input_buffer_left_shiftsArray of shifts to use when converting from ring buffer values to input buffer values
[out]clear_input_buffers_of_late_packets_initInicates whether to clear the input buffers each time step
[out]incoming_spike_buffer_sizeThe number of spikes to support in the incoming spike circular buffer
Returns
True if successfully initialised. False otherwise.

Definition at line 268 of file synapses.c.

◆ synapses_flush_ring_buffers()

void synapses_flush_ring_buffers ( timer_t  time)

Reset the ring buffers to 0 at the given time.

Parameters
[in]timethe simulated time to reset the buffers at

Definition at line 336 of file synapses.c.

◆ synapses_process_synaptic_row()

bool synapses_process_synaptic_row ( uint32_t  time,
uint32_t  spike_colour,
uint32_t  colour_mask,
synaptic_row_t  row,
bool *  write_back 
)

process a synaptic row

Parameters
[in]timethe simulated time
[in]spike_colourthe colour extracted from the spike key
[in]colour_maskthe colour mask extracted from the pop table
[in]rowthe synaptic row in question
[out]write_backwhether to write back to SDRAM
Returns
True if successful

Definition at line 351 of file synapses.c.

◆ synapses_get_pre_synaptic_events()

uint32_t synapses_get_pre_synaptic_events ( void  )

returns the counters for plastic and fixed pre synaptic events based on (if the model was compiled with SYNAPSE_BENCHMARK parameter) or returns 0

Returns
the counter for plastic and fixed pre synaptic events or 0

Definition at line 405 of file synapses.c.

◆ synapses_resume()

void synapses_resume ( timer_t  time)

Resume processing of synapses after a pause.

Parameters
[in]timeThe time at which the simulation is to start

Definition at line 410 of file synapses.c.

Variable Documentation

◆ num_fixed_pre_synaptic_events

uint32_t num_fixed_pre_synaptic_events = 0

if using profiler import profiler tags

Globals required for synapse benchmarking to work.

Definition at line 34 of file synapses.c.

◆ n_neurons

uint32_t n_neurons
static

The number of neurons.

Definition at line 37 of file synapses.c.

◆ n_synapse_types

uint32_t n_synapse_types
static

The number of synapse types.

Definition at line 40 of file synapses.c.

◆ ring_buffers

weight_t* ring_buffers
static

Ring buffers to handle delays between synapses and neurons.

Definition at line 43 of file synapses.c.

◆ ring_buffer_size

uint32_t ring_buffer_size
static

Ring buffer size.

Definition at line 46 of file synapses.c.

◆ ring_buffer_mask

uint32_t ring_buffer_mask
static

Ring buffer mask.

Definition at line 49 of file synapses.c.

◆ ring_buffer_to_input_left_shifts

uint32_t* ring_buffer_to_input_left_shifts
static

Amount to left shift the ring buffer by to make it an input.

Definition at line 52 of file synapses.c.

◆ synapse_type_index_bits

uint32_t synapse_type_index_bits

Number of bits needed for the synapse type and index.

The number of bits used by the synapse type and post-neuron index.

uint32_t synapse_index_bits
The number of bits used by just the post-neuron index.
Definition local_only.c:77
uint32_t synapse_type_bits
Number of bits in the synapse type.
Definition synapses.c:71

Definition at line 59 of file synapses.c.

◆ synapse_type_index_mask

uint32_t synapse_type_index_mask

Mask to pick out the synapse type and index.

uint32_t synapse_index_mask
Mask to pick out the synapse index.
Definition synapses.c:69
uint32_t synapse_type_mask
Mask to pick out the synapse type.
Definition synapses.c:73

Definition at line 65 of file synapses.c.

◆ synapse_index_bits

uint32_t synapse_index_bits

Number of bits in the synapse index.

The number of bits used by just the post-neuron index.

Definition at line 67 of file synapses.c.

◆ synapse_index_mask

uint32_t synapse_index_mask

Mask to pick out the synapse index.

Definition at line 69 of file synapses.c.

◆ synapse_type_bits

uint32_t synapse_type_bits

Number of bits in the synapse type.

Definition at line 71 of file synapses.c.

◆ synapse_type_mask

uint32_t synapse_type_mask

Mask to pick out the synapse type.

Definition at line 73 of file synapses.c.

◆ synapse_delay_bits

uint32_t synapse_delay_bits

Number of bits in the delay.

Definition at line 75 of file synapses.c.

◆ synapse_delay_mask

uint32_t synapse_delay_mask

Mask to pick out the delay.

The mask to get the synaptic delay from a "synapse".

Definition at line 77 of file synapses.c.

◆ synapses_saturation_count

uint32_t synapses_saturation_count = 0

Count of the number of times the ring buffers have saturated.

Count of the number of times the synapses have saturated their weights.

Definition at line 80 of file synapses.c.

◆ skipped_synapses

uint32_t skipped_synapses = 0

Count of the synapses that have been skipped because the delay wasn't big enough given how long the spike took to arrive

Definition at line 84 of file synapses.c.

◆ late_spikes

uint32_t late_spikes = 0

Count of the spikes that are received late.

Definition at line 87 of file synapses.c.

◆ max_late_spike

uint32_t max_late_spike = 0

The maximum lateness of a spike.

Definition at line 90 of file synapses.c.

◆ n_neurons_peak

uint32_t n_neurons_peak
static

Number of neurons.

Definition at line 93 of file synapses.c.

◆ synapse_delay_mask_shifted

uint32_t synapse_delay_mask_shifted = 0
static

The mask of the delay shifted into position i.e. pre-shift.

Definition at line 96 of file synapses.c.