sPyNNaker neural_modelling  development
synapse_structure_weight_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 
19 #ifndef _SYNAPSE_STRUCUTRE_WEIGHT_IMPL_H_
20 #define _SYNAPSE_STRUCUTRE_WEIGHT_IMPL_H_
21 
22 //---------------------------------------
23 // Structures
24 //---------------------------------------
26 typedef weight_t plastic_synapse_t;
27 
30 
31 // The final state is just a weight as this is
33 typedef weight_t final_state_t;
34 
35 #include "synapse_structure.h"
36 
37 //---------------------------------------
38 // Synapse interface functions
39 //---------------------------------------
45  plastic_synapse_t synaptic_word, index_t synapse_type) {
46  return weight_get_initial(synaptic_word, synapse_type);
47 }
48 
49 //---------------------------------------
54  update_state_t state) {
55  return weight_get_final(state);
56 }
57 
58 //---------------------------------------
62 static inline weight_t synapse_structure_get_final_weight(
63  final_state_t final_state) {
64  return final_state;
65 }
66 
67 //---------------------------------------
72  final_state_t final_state) {
73  return final_state;
74 }
75 
76 //---------------------------------------
81  weight_t weight) {
82  return weight;
83 }
84 
85 //---------------------------------------
89 static inline weight_t synapse_structure_get_weight(
90  plastic_synapse_t synaptic_word) {
91  return synaptic_word;
92 }
93 
94 static inline void synapse_structure_decay_weight(
95  update_state_t *state, uint32_t decay) {
96  return weight_decay(state, decay);
97 }
98 
99 static inline accum synapse_structure_get_update_weight(update_state_t state) {
100  return weight_get_update(state);
101 }
102 
103 #endif // _SYNAPSE_STRUCUTRE_WEIGHT_IMPL_H_
#define decay(x, d)
This is a type-generic decay "function".
Definition: decay.h:118
API for synaptic state.
static accum synapse_structure_get_update_weight(update_state_t state)
Get the current synaptic weight stored in the update state.
static void synapse_structure_decay_weight(update_state_t *state, uint32_t decay)
Decay the synaptic weight value stored by multiplication.
static plastic_synapse_t synapse_structure_get_final_synaptic_word(final_state_t final_state)
Get the final plastic synapse data from the final state.
weight_t final_state_t
Both the weight and the synaptic word.
static plastic_synapse_t synapse_structure_create_synapse(weight_t weight)
Create the initial plastic synapse data.
static update_state_t synapse_structure_get_update_state(plastic_synapse_t synaptic_word, index_t synapse_type)
Get the update state from the synapse structure.
static weight_t synapse_structure_get_final_weight(final_state_t final_state)
Get the final weight from the final state.
weight_t plastic_synapse_t
Plastic synapse types are just weights;.
weight_state_t update_state_t
The update state is purely a weight state.
static final_state_t synapse_structure_get_final_state(update_state_t state)
Get the final state from the update state.
static weight_t synapse_structure_get_weight(plastic_synapse_t synaptic_word)
Get the current synaptic weight from the plastic synapse data.
Plastic synapse contains normal 16-bit weight and an accumulator.
static weight_t weight_get_final(weight_state_t new_state)
Gets the final weight.
static weight_state_t weight_get_initial(weight_t weight, index_t synapse_type)
Gets the initial weight state.
static void weight_decay(weight_state_t *state, int32_t decay)
Decay the weight inside the state by multiplication.
static accum weight_get_update(weight_state_t state)
Get the weight inside during update in STDP fixed point format.
The current state data for the rule.