sPyNNaker neural_modelling 7.1.1
Loading...
Searching...
No Matches
synapse_types_dual_excitatory_exponential_impl.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2015 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
27#ifndef _SYNAPSE_TYPES_DUAL_EXCITATORY_EXPONENTIAL_IMPL_H_
28#define _SYNAPSE_TYPES_DUAL_EXCITATORY_EXPONENTIAL_IMPL_H_
29
30//---------------------------------------
31// Macros
32//---------------------------------------
35#define SYNAPSE_TYPE_BITS 2
38#define SYNAPSE_TYPE_COUNT 3
39
41#define NUM_EXCITATORY_RECEPTORS 2
43#define NUM_INHIBITORY_RECEPTORS 1
44
45#include <debug.h>
46#include "synapse_types.h"
47#include "exp_synapse_utils.h"
48
49//---------------------------------------
50// Synapse parameters
51//---------------------------------------
56 REAL time_step_ms;
57};
58
59struct synapse_types_t {
63};
64
71
72//---------------------------------------
73// Synapse shaping inline implementation
74//---------------------------------------
75
76static inline void synapse_types_initialise(synapse_types_t *state,
78 decay_and_init(&state->exc, &params->exc, params->time_step_ms, n_steps_per_timestep);
79 decay_and_init(&state->exc2, &params->exc2, params->time_step_ms, n_steps_per_timestep);
80 decay_and_init(&state->inh, &params->inh, params->time_step_ms, n_steps_per_timestep);
81}
82
83static void synapse_types_save_state(synapse_types_t *state, synapse_types_params_t *params) {
84 params->exc.init_input = state->exc.synaptic_input_value;
85 params->exc2.init_input = state->exc2.synaptic_input_value;
86 params->inh.init_input = state->inh.synaptic_input_value;
87}
88
97static inline void synapse_types_shape_input(synapse_types_t *parameters) {
98 exp_shaping(&parameters->exc);
99 exp_shaping(&parameters->exc2);
100 exp_shaping(&parameters->inh);
101}
102
110 index_t synapse_type_index, synapse_types_t *parameters,
111 input_t input) {
112 switch (synapse_type_index) {
113 case EXCITATORY_ONE:
114 add_input_exp(&parameters->exc, input);
115 break;
116 case EXCITATORY_TWO:
117 add_input_exp(&parameters->exc2, input);
118 break;
119 case INHIBITORY:
120 add_input_exp(&parameters->inh, input);
121 break;
122 }
123}
124
131 input_t *excitatory_response, synapse_types_t *parameters) {
132 excitatory_response[0] = parameters->exc.synaptic_input_value;
133 excitatory_response[1] = parameters->exc2.synaptic_input_value;
134 return &excitatory_response[0];
135}
136
143 input_t *inhibitory_response, synapse_types_t *parameters) {
144 inhibitory_response[0] = parameters->inh.synaptic_input_value;
145 return &inhibitory_response[0];
146}
147
153static inline const char *synapse_types_get_type_char(
154 index_t synapse_type_index) {
155 switch (synapse_type_index) {
156 case EXCITATORY_ONE:
157 return "X1";
158 case EXCITATORY_TWO:
159 return "X2";
160 case INHIBITORY:
161 return "I";
162 default:
163 log_debug("did not recognise synapse type %i", synapse_type_index);
164 return "?";
165 }
166}
167
172static inline void synapse_types_print_input(
173 synapse_types_t *parameters) {
174 io_printf(IO_BUF, "%12.6k + %12.6k - %12.6k",
175 parameters->exc.synaptic_input_value,
176 parameters->exc2.synaptic_input_value,
177 parameters->inh.synaptic_input_value);
178}
179
183 synapse_types_t *parameters) {
184 log_info("exc_decay = %11.4k\n", parameters->exc.decay);
185 log_info("exc_init = %11.4k\n", parameters->exc.init);
186 log_info("exc2_decay = %11.4k\n", parameters->exc2.decay);
187 log_info("exc2_init = %11.4k\n", parameters->exc2.init);
188 log_info("inh_decay = %11.4k\n", parameters->inh.decay);
189 log_info("inh_init = %11.4k\n", parameters->inh.init);
190 log_info("gsyn_excitatory_initial_value = %11.4k\n",
191 parameters->exc.synaptic_input_value);
192 log_info("gsyn_excitatory2_initial_value = %11.4k\n",
193 parameters->exc2.synaptic_input_value);
194 log_info("gsyn_inhibitory_initial_value = %11.4k\n",
195 parameters->inh.synaptic_input_value);
196}
197
198#endif // _SYNAPSE_TYPES_DUAL_EXCITATORY_EXPONENTIAL_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:89
REAL input_t
The type of an input.
static uint n_steps_per_timestep
The number of steps to run per timestep.
void io_printf(char *stream, char *format,...)
#define IO_BUF
static stdp_params params
Configuration parameters.
API for synaptic behaviour types (see also src/neuron/input_types)
decay_t decay
Exponential decay multiplier.
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
synapse_dual_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_add_neuron_input(index_t synapse_type_index, synapse_types_t *parameters, 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...
static void synapse_types_print_parameters(synapse_types_t *parameters)
printer call
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_params_t exc2
Second excitatory synaptic input.
exp_state_t inh
Inhibitory synaptic input.
exp_params_t exc
First excitatory synaptic input.
exp_state_t exc2
Second excitatory synaptic input.
exp_state_t exc
First excitatory synaptic input.
Delta synapses support just a single excitatory and inhibitory input each.