sPyNNaker neural_modelling  development
timing_recurrent_pre_stochastic_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 
19 #ifndef _TIMING_RECURRENT_PRE_STOCHASTIC_IMPL_H_
20 #define _TIMING_RECURRENT_PRE_STOCHASTIC_IMPL_H_
21 
22 typedef struct post_trace_t {
23 } post_trace_t;
24 
25 typedef struct pre_trace_t {
26 } pre_trace_t;
27 
29 typedef struct {
31  int32_t accumulator_depression_plus_one;
33  int32_t accumulator_potentiation_minus_one;
35 
36 #define _STRUCTURE_PATH(file) <neuron/plasticity/stdp/synapse_structure/file>
37 #include _STRUCTURE_PATH(synapse_structure_weight_state_accumulator_window_impl.h)
39 
44 static inline bool timing_recurrent_in_pre_window(
45  uint32_t time_since_last_event, update_state_t previous_state) {
46  return time_since_last_event < previous_state.window_length;
47 }
48 
54  uint32_t time_since_last_event, update_state_t previous_state) {
55  return time_since_last_event < previous_state.window_length;
56 }
57 
62  update_state_t previous_state) {
64 
65  // Pick random number and use to draw from exponential distribution
66  int32_t random = mars_kiss_fixed_point();
67  previous_state.window_length = pre_exp_dist_lookup[random];
68  log_debug("\t\tRandom=%d, Exp dist=%u",
69  random, previous_state.window_length);
70 
71  return previous_state;
72 }
73 
78  update_state_t previous_state) {
80 
81  // Pick random number and use to draw from exponential distribution
82  int32_t random = mars_kiss_fixed_point();
83  previous_state.window_length = post_exp_dist_lookup[random];
84  log_debug("\t\tRandom=%d, Exp dist=%u",
85  random, previous_state.window_length);
86 
87  return previous_state;
88 }
89 
90 #endif // _TIMING_RECURRENT_PRE_STOCHASTIC_IMPL_H_
#define STDP_FIXED_POINT_ONE
The number 1.0 in the fixed point math used by STDP.
Definition: stdp_typedefs.h:31
int16_t post_trace_t
The type of post-spike traces.
int16_t pre_trace_t
The type of pre-spike traces.
Common code for recurrent timing rules.
uint16_t pre_exp_dist_lookup[STDP_FIXED_POINT_ONE]
Lookup table for picking exponentially distributed random value for pre-traces.
uint16_t post_exp_dist_lookup[STDP_FIXED_POINT_ONE]
Lookup table for picking exponentially distributed random value for post-traces.
static update_state_t timing_recurrent_calculate_post_window(update_state_t previous_state)
Update the state with the post-window information.
static update_state_t timing_recurrent_calculate_pre_window(update_state_t previous_state)
Update the state with the pre-window information.
static bool timing_recurrent_in_pre_window(uint32_t time_since_last_event, update_state_t previous_state)
Check if there was an event in the pre-window.
static bool timing_recurrent_in_post_window(uint32_t time_since_last_event, update_state_t previous_state)
Check if there was an event in the post-window.
The type of post-spike traces.
The type of pre-spike traces.
Configuration information about plasticity traces.