sPyNNaker neural_modelling  development
c_main_synapse_common.h
1 /*
2  * Copyright (c) 2017 The University of Manchester
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * https://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include <stdbool.h>
18 #include <stdint.h>
19 
20 #include <data_specification.h>
21 #include <common/in_spikes.h>
22 #include "synapses.h"
26 
30  uint32_t synapse_params;
32  uint32_t pop_table;
34  uint32_t synaptic_matrix;
36  uint32_t synapse_dynamics;
40  uint32_t bitfield_filter;
41 };
42 
62  uint32_t n_late_spikes;
64  uint32_t max_late_spike;
65 };
66 
69 static inline void store_synapse_provenance(struct synapse_provenance *prov) {
70 
71  // store the data into the provenance data region
81  prov->n_late_spikes = late_spikes;
83 }
84 
100 static inline bool initialise_synapse_regions(
101  data_specification_metadata_t *ds_regions,
102  struct synapse_regions regions, weight_t **ring_buffers,
103  uint32_t *row_max_n_words,
104  uint32_t *incoming_spike_buffer_size,
105  bool *clear_input_buffer_of_late_packets,
106  uint32_t *n_recording_regions_used) {
107  // Set up the synapses
108  uint32_t *ring_buffer_to_input_buffer_left_shifts;
109  uint32_t n_neurons;
110  uint32_t n_synapse_types;
111  if (!synapses_initialise(
112  data_specification_get_region(regions.synapse_params, ds_regions),
114  &ring_buffer_to_input_buffer_left_shifts,
115  clear_input_buffer_of_late_packets,
116  incoming_spike_buffer_size)) {
117  return false;
118  }
119 
120  // Set up the population table
122  data_specification_get_region(regions.pop_table, ds_regions),
123  data_specification_get_region(regions.synaptic_matrix, ds_regions),
124  row_max_n_words)) {
125  return false;
126  }
127  // Set up the synapse dynamics
129  data_specification_get_region(regions.synapse_dynamics, ds_regions),
130  n_neurons, n_synapse_types, ring_buffer_to_input_buffer_left_shifts)) {
131  return false;
132  }
133 
134  // Set up structural plasticity dynamics
135  if (!synaptogenesis_dynamics_initialise(data_specification_get_region(
136  regions.structural_dynamics, ds_regions), n_recording_regions_used)) {
137  return false;
138  }
139 
140  return true;
141 }
static weight_t * ring_buffers
The ring buffers to be used in the simulation.
Definition: c_main.c:118
Functions for immediate handling of incoming spikes.
static uint32_t n_neurons
The number of neurons on the core.
Definition: neuron.c:45
static uint32_t n_synapse_types
The number of synapse types.
Definition: neuron.c:51
Master pop(ulation) table API.
uint32_t failed_bit_field_reads
The number of bit fields which were not able to be read in due to DTCM limits.
uint32_t invalid_master_pop_hits
the number of times packet isn't in the master pop table at all!
uint32_t bit_field_filtered_packets
The number of packets dropped because the bitfield filter says they don't hit anything.
uint32_t ghost_pop_table_searches
the number of times a DMA resulted in 0 entries
bool population_table_initialise(address_t table_address, address_t synapse_rows_address, uint32_t *row_max_n_words)
Set up the table.
The provenance information for synaptic processing.
uint32_t n_plastic_synaptic_weight_saturations
The number of STDP weight saturations.
uint32_t n_synapses_skipped
The number of synapses that were skipped due to late spikes.
uint32_t n_filtered_by_bitfield
The number of spikes that a bit field filtered, stopping a DMA.
uint32_t n_invalid_master_pop_table_hits
The number of population table searches that found an "invalid" entry.
uint32_t n_synaptic_weight_saturations
A count of synaptic saturations.
uint32_t n_failed_bitfield_reads
The number of bit field reads that couldn't be read in due to DTCM limits.
uint32_t n_ghost_pop_table_searches
The number of population table searches that had no match.
uint32_t n_pre_synaptic_events
A count of presynaptic events.
uint32_t max_late_spike
The maximum lateness of a spike.
uint32_t n_late_spikes
The number of spikes that were detected as late.
The region IDs used by synapse processing.
uint32_t structural_dynamics
Configuration for structural plasticity.
uint32_t pop_table
The table to map from keys to memory addresses.
uint32_t synaptic_matrix
The SDRAM-based matrix of source spikes to target neurons.
uint32_t bitfield_filter
The filters to avoid DMA transfers of empty rows.
uint32_t synapse_dynamics
Configuration for STDP.
uint32_t synapse_params
The parameters of the synapse processing.
API for synapse dynamics.
uint32_t synapse_dynamics_get_plastic_saturation_count(void)
Get the number of ring buffer saturation events due to adding plastic weights.
bool synapse_dynamics_initialise(address_t address, uint32_t n_neurons, uint32_t n_synapse_types, uint32_t *ring_buffer_to_input_buffer_left_shifts)
Initialise the synapse dynamics.
uint32_t skipped_synapses
Definition: synapses.c:84
uint32_t max_late_spike
The maximum lateness of a spike.
Definition: synapses.c:90
uint32_t synapses_saturation_count
Count of the number of times the ring buffers have saturated.
Definition: synapses.c:80
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 wi...
Definition: synapses.c:405
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.
Definition: synapses.c:268
uint32_t late_spikes
Count of the spikes that are received late.
Definition: synapses.c:87
Operations on synapses.
This file contains the main interface for structural plasticity.
bool synaptogenesis_dynamics_initialise(address_t sdram_sp_address, uint32_t *recording_regions_used)
Initialisation of synaptic rewiring (synaptogenesis) parameters (random seed, spread of receptive fie...