sPyNNaker neural_modelling 7.2.2
Loading...
Searching...
No Matches
timing_vogels_2011_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
26#ifndef VOGELS_2011_IMPL_H
27#define VOGELS_2011_IMPL_H
28
29//---------------------------------------
30// Typedefines
31//---------------------------------------
33typedef int16_t post_trace_t;
35typedef int16_t pre_trace_t;
36
38#include "timing.h"
40
41// Include debug header for log_info etc
42#include <debug.h>
43
44// Include generic plasticity maths functions
47
48//---------------------------------------
49// Structures
50//---------------------------------------
51typedef struct {
52 int32_t alpha;
54
55//---------------------------------------
56// Externals
57//---------------------------------------
58extern int16_lut *tau_lookup;
59
60//---------------------------------------
61// Timing dependence inline functions
62//---------------------------------------
63
64static inline int16_t timing_decay_post(
65 uint32_t time, uint32_t last_time, post_trace_t last_trace) {
66 // Get time since last spike
67 uint32_t delta_time = time - last_time;
68
69 // Decay previous trace
70 int32_t decayed_trace = STDP_FIXED_MUL_16X16(last_trace,
72
73 return (uint16_t) decayed_trace;
74
75}
76
82static inline int16_t timing_add_spike(
83 uint32_t time, uint32_t last_time, int16_t last_trace) {
84
85 // Decay previous trace
86 int32_t decayed_trace = timing_decay_post(time, last_time, last_trace);
87
88 // Add new spike to trace
89 int32_t new_trace = decayed_trace + STDP_FIXED_POINT_ONE;
90
91 return (int16_t)new_trace;
92}
93
94//---------------------------------------
95// Timing dependence inline functions
96//---------------------------------------
100 return 0;
101}
102//---------------------------------------
109 uint32_t time, uint32_t last_time, post_trace_t last_trace) {
110 return timing_add_spike(time, last_time, last_trace);
111}
112//---------------------------------------
119 uint32_t time, uint32_t last_time, pre_trace_t last_trace) {
120 return timing_add_spike(time, last_time, last_trace);
121}
122//---------------------------------------
133 uint32_t time, UNUSED pre_trace_t trace, UNUSED uint32_t last_pre_time,
134 UNUSED pre_trace_t last_pre_trace, uint32_t last_post_time,
135 post_trace_t last_post_trace, update_state_t previous_state) {
137
138 // Get time of event relative to last post-synaptic event
139 uint32_t time_since_last_post = time - last_post_time;
140 int32_t exponential_decay = maths_lut_exponential_decay(
141 time_since_last_post, tau_lookup);
142 int32_t decayed_o1 = STDP_FIXED_MUL_16X16(last_post_trace, exponential_decay)
144
145 log_debug("\t\t\ttime_since_last_post_event=%u, decayed_o1=%d\n",
146 time_since_last_post, decayed_o1);
147
148 // Apply potentiation to state (which is a weight_state)
149 return weight_one_term_apply_potentiation(previous_state, decayed_o1);
150
151}
152//---------------------------------------
163 uint32_t time, UNUSED post_trace_t trace, uint32_t last_pre_time,
164 pre_trace_t last_pre_trace, UNUSED uint32_t last_post_time,
165 UNUSED post_trace_t last_post_trace, update_state_t previous_state) {
166 // Get time of event relative to last pre-synaptic event
167 uint32_t time_since_last_pre = time - last_pre_time;
168 int32_t exponential_decay = maths_lut_exponential_decay(
169 time_since_last_pre, tau_lookup);
170 int32_t decayed_r1 = STDP_FIXED_MUL_16X16(last_pre_trace, exponential_decay);
171
172 log_debug("\t\t\ttime_since_last_pre_event=%u, decayed_r1=%d\n",
173 time_since_last_pre, decayed_r1);
174
175 // Apply potentiation to state (which is a weight_state)
176 return weight_one_term_apply_potentiation(previous_state, decayed_r1);
177}
178
179#endif // VOGELS_2011_IMPL_H
uint32_t time
The current timer tick value.
Definition c_main.c:94
void log_debug(const char *message,...)
uint32_t last_time
The time of the most recently-considered spike.
Support functions for STDP.
static int32_t maths_lut_exponential_decay(uint32_t time, const int16_lut *lut)
Get value from lookup table.
Definition maths.h:79
Lookup Table of 16-bit integers.
Definition maths.h:44
Basic definitions for STDP.
#define STDP_FIXED_POINT_ONE
The number 1.0 in the fixed point math used by STDP.
#define STDP_FIXED_MUL_16X16(a, b)
Multiply two STDP fixed point numbers.
Synapses just hold weight.
API for timing rules.
plasticity_trace_region_data_t plasticity_trace_region_data
Global plasticity parameter data.
The type of post-spike traces.
The type of pre-spike traces.
static post_trace_t timing_add_post_spike(uint32_t time, uint32_t last_time, post_trace_t last_trace)
Add a post spike to the post trace.
static update_state_t timing_apply_pre_spike(uint32_t time, pre_trace_t trace, uint32_t last_pre_time, pre_trace_t last_pre_trace, uint32_t last_post_time, post_trace_t last_post_trace, update_state_t previous_state)
Apply a pre-spike timing rule state update.
static int16_t timing_add_spike(uint32_t time, uint32_t last_time, int16_t last_trace)
Common code for adding a spike to the trace.
static pre_trace_t timing_add_pre_spike(uint32_t time, uint32_t last_time, pre_trace_t last_trace)
Add a pre spike to the pre trace.
int16_t post_trace_t
Type of post-traces.
int16_t pre_trace_t
Type of pre-traces.
static update_state_t timing_apply_post_spike(uint32_t time, post_trace_t trace, uint32_t last_pre_time, pre_trace_t last_pre_trace, uint32_t last_post_time, post_trace_t last_post_trace, update_state_t previous_state)
Apply a post-spike timing rule state update.
static post_trace_t timing_get_initial_post_trace(void)
Get an initial post-synaptic timing trace.
int16_lut * tau_lookup
Lookup table for pre-computed τ
Configuration information about plasticity traces.
static weight_state_t weight_one_term_apply_potentiation(weight_state_t state, int32_t a2_plus)
Apply the potentiation rule to the weight state.
API for single-term weight dependence rules.