sPyNNaker neural_modelling 7.3.1
Loading...
Searching...
No Matches
synapse_types_semd_impl.h
Go to the documentation of this file.
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
24#ifndef _SYNAPSE_TYPES_SEMD_IMPL_H_
25#define _SYNAPSE_TYPES_SEMD_IMPL_H_
26
27//---------------------------------------
28// Macros
29//---------------------------------------
32#define SYNAPSE_TYPE_BITS 2
35#define SYNAPSE_TYPE_COUNT 3
36
38#define NUM_EXCITATORY_RECEPTORS 2
40#define NUM_INHIBITORY_RECEPTORS 1
41
42#include <debug.h>
43#include "synapse_types.h"
44#include "exp_synapse_utils.h"
45
46//---------------------------------------
47// Synapse parameters
48//---------------------------------------
49
62};
63
64struct synapse_types_t {
74};
75
82
83
84//---------------------------------------
85// Synapse shaping inline implementation
86//---------------------------------------
87
88static inline void synapse_types_initialise(synapse_types_t *state,
90 decay_and_init(&state->exc, &params->exc, params->timestep_ms, n_steps_per_timestep);
91 decay_and_init(&state->exc2, &params->exc2, params->timestep_ms, n_steps_per_timestep);
92 decay_and_init(&state->inh, &params->inh, params->timestep_ms, n_steps_per_timestep);
93 state->multiplicator = params->multiplicator_init;
94 state->exc2_old = params->exc2_old_init;
95 state->scaling_factor = params->scaling_factor;
96}
97
98static void synapse_types_save_state(synapse_types_t *state, synapse_types_params_t *params) {
99 params->exc.init_input = state->exc.synaptic_input_value;
100 params->exc2.init_input = state->exc2.synaptic_input_value;
101 params->inh.init_input = state->inh.synaptic_input_value;
102 params->multiplicator_init = state->multiplicator;
103 params->exc2_old_init = state->exc2_old;
104}
105
114static inline void synapse_types_shape_input(synapse_types_t *parameters) {
115 exp_shaping(&parameters->exc);
116 exp_shaping(&parameters->exc2);
117 exp_shaping(&parameters->inh);
118}
119
127 index_t synapse_type_index, synapse_types_t *parameter,
128 input_t input) {
129 switch (synapse_type_index) {
130 case EXCITATORY_ONE:
131 add_input_exp(&parameter->exc, input);
132 break;
133 case EXCITATORY_TWO:
134 add_input_exp(&parameter->exc2, input);
135 break;
136 case INHIBITORY:
137 add_input_exp(&parameter->inh, input);
138 break;
139 }
140}
141
148 input_t *excitatory_response, synapse_types_t *parameters) {
149 if (parameters->exc2.synaptic_input_value >= 0.001k
150 && parameters->multiplicator == ZERO
151 && parameters->exc2_old == ZERO) {
152 parameters->multiplicator = parameters->exc.synaptic_input_value;
153 } else if (parameters->exc2.synaptic_input_value < 0.001k) {
154 parameters->multiplicator = ZERO;
155 }
156
157 parameters->exc2_old = parameters->exc2.synaptic_input_value;
158
159 excitatory_response[0] = ZERO;
160 excitatory_response[1] =
161 parameters->exc2.synaptic_input_value * parameters->multiplicator
162 * parameters->scaling_factor;
163 return &excitatory_response[0];
164}
165
172 input_t *inhibitory_response, synapse_types_t *parameters) {
173 inhibitory_response[0] = parameters->inh.synaptic_input_value;
174 return &inhibitory_response[0];
175}
176
182static inline const char *synapse_types_get_type_char(
183 index_t synapse_type_index) {
184 switch (synapse_type_index) {
185 case EXCITATORY_ONE:
186 return "X1";
187 case EXCITATORY_TWO:
188 return "X2";
189 case INHIBITORY:
190 return "I";
191 default:
192 log_debug("did not recognise synapse type %i", synapse_type_index);
193 return "?";
194 }
195}
196
201static inline void synapse_types_print_input(synapse_types_t *parameters) {
202 log_info("%12.6k + %12.6k - %12.6k",
203 parameters->exc.synaptic_input_value,
204 parameters->exc2.synaptic_input_value,
205 parameters->inh.synaptic_input_value);
206 log_info("multiplicator = %11.4k\n", parameters->multiplicator);
207 log_info("exc2_old = %11.4k\n", parameters->exc2_old);
208}
209
212static inline void synapse_types_print_parameters(synapse_types_t *parameters) {
213 log_info("exc_decay = %11.4k\n", parameters->exc.decay);
214 log_info("exc_init = %11.4k\n", parameters->exc.init);
215 log_info("exc2_decay = %11.4k\n", parameters->exc2.decay);
216 log_info("exc2_init = %11.4k\n", parameters->exc2.init);
217 log_info("inh_decay = %11.4k\n", parameters->inh.decay);
218 log_info("inh_init = %11.4k\n", parameters->inh.init);
219 log_info("gsyn_excitatory_initial_value = %11.4k\n",
220 parameters->exc.synaptic_input_value);
221 log_info("gsyn_excitatory2_initial_value = %11.4k\n",
222 parameters->exc2.synaptic_input_value);
223 log_info("gsyn_inhibitory_initial_value = %11.4k\n",
224 parameters->inh.synaptic_input_value);
225 log_info("scaling_factor = %11.4k\n", parameters->scaling_factor);
226}
227
228#endif // _SYNAPSE_TYPES_SEMD_IMPL_H_
uint32_t index_t
void log_debug(const char *message,...)
void log_info(const char *message,...)
Utilities for synapse types with exponential decays.
decay_t decay
Decay multiplier per timestep.
input_t synaptic_input_value
The actual synaptic contribution.
decay_t init
Initial decay factor.
static void decay_and_init(exp_state_t *state, exp_params_t *params, REAL time_step_ms, uint32_t n_steps_per_timestep)
Calculate the exponential state from the exponential parameters.
static void exp_shaping(exp_state_t *exp_param)
Shapes a single parameter.
static void add_input_exp(exp_state_t *parameter, input_t input)
helper function to add input for a given timer period to a given neuron
The type of exponential decay parameters.
The type of exponential decay state.
accum REAL
Type used for "real" numbers.
Definition maths-util.h:91
#define ZERO
A REAL 0.0.
Definition maths-util.h:123
REAL input_t
The type of an input.
static uint n_steps_per_timestep
The number of steps to run per timestep.
static stdp_params params
Configuration parameters.
API for synaptic behaviour types (see also src/neuron/input_types)
decay_t decay
Exponential decay multiplier.
input_t exc2_old
History storage used to reset synaptic state.
static const char * synapse_types_get_type_char(index_t synapse_type_index)
returns a human readable character for the type of synapse. examples would be X = excitatory types,...
static input_t * synapse_types_get_excitatory_input(input_t *excitatory_response, synapse_types_t *parameters)
extracts the excitatory input buffers from the buffers available for a given parameter set
input_t scaling_factor
Scaling factor for the secondary response.
input_t exc2_old_init
History storage used to reset synaptic state.
input_t scaling_factor
Scaling factor for the secondary response.
exp_params_t exc2
Second excitatory synaptic input.
input_t multiplicator_init
Output scaling factor derived from first excitatory input.
input_t multiplicator
Output scaling factor derived from first excitatory input.
static void synapse_types_add_neuron_input(index_t synapse_type_index, synapse_types_t *parameter, input_t input)
adds the inputs for a give timer period to a given neuron that is being simulated by this model
static void synapse_types_print_input(synapse_types_t *parameters)
prints the input for a neuron ID given the available inputs currently only executed when the models a...
alpha_state_t inh
Inhibitory synaptic input.
REAL timestep_ms
The time step in milliseconds.
synapse_semd_input_buffer_regions
The supported synapse type indices.
@ INHIBITORY
Inhibitory synaptic input.
@ EXCITATORY_TWO
Second excitatory synaptic input.
@ EXCITATORY_ONE
First excitatory synaptic input.
static void synapse_types_print_parameters(synapse_types_t *parameters)
printer call
alpha_params_t exc
First excitatory synaptic input.
static void synapse_types_shape_input(synapse_types_t *parameters)
decays the stuff thats sitting in the input buffers as these have not yet been processed and applied ...
static input_t * synapse_types_get_inhibitory_input(input_t *inhibitory_response, synapse_types_t *parameters)
extracts the inhibitory input buffers from the buffers available for a given parameter set
exp_state_t exc2
Second excitatory synaptic input.
alpha_state_t exc
Excitatory synaptic input.
Delta synapses support just a single excitatory and inhibitory input each.