Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VOR related models and provenance #1152

Open
wants to merge 159 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
159 commits
Select commit Hold shift + click to select a range
17735ff
changes to compile code on Chiara's MAC
ChiaraBartolozzi Oct 8, 2018
6e6d5bc
Sketched out cerebellum neuron model and plasticity update
oliverrhodes Oct 9, 2018
c4385e8
add logging to timing initialisation
oliverrhodes Oct 10, 2018
e0e03c4
Add potentiation on PF spike
oliverrhodes Oct 10, 2018
1bc6fdc
added look up table for PFPC learning rule
ChiaraBartolozzi Oct 10, 2018
f1b0060
Configure to use exp_sin_lookup
oliverrhodes Oct 10, 2018
67f3ecd
add back dt printing
oliverrhodes Oct 10, 2018
7efaf58
add missing variable initialisation
oliverrhodes Oct 10, 2018
58a3f2b
Sorry Chiara - this extra variable misaligned things!
oliverrhodes Oct 10, 2018
5d335c9
Add logging of exp_sin table lookup
oliverrhodes Oct 10, 2018
ea065da
Tweak logging and reading of exp_sin_lut
oliverrhodes Oct 10, 2018
99f7d3a
added prints
ChiaraBartolozzi Oct 11, 2018
21d40c8
Merge branch 'icub_vor' of
ChiaraBartolozzi Oct 11, 2018
a2af197
Implemented depression for single spike cases
oliverrhodes Oct 11, 2018
fa3e30a
It works!!
oliverrhodes Oct 11, 2018
cc5b5e9
add template code for vn neurons
oliverrhodes Oct 12, 2018
a8fa4f3
Merge remote-tracking branch 'origin/master' into icub_vor
oliverrhodes Dec 10, 2018
17881a6
Update to separate synapse dynamics for cerebellum neurons
oliverrhodes Dec 10, 2018
080f877
Add template code for Mossy-Fibre/Vestibular Nuclei plasticity
oliverrhodes Dec 11, 2018
2b88adb
Correct naming mismatch
oliverrhodes Dec 11, 2018
4ad4207
Tidy PFPC LUT generation
oliverrhodes Dec 11, 2018
f31196e
Add MFVN LUT generation and configuration code
oliverrhodes Dec 11, 2018
56d0318
Add mossy fibre plasticity
oliverrhodes Dec 11, 2018
d02781d
Add forward processing of mfvn spikes
oliverrhodes Dec 12, 2018
55798ba
Bubble down kernel/plasticity config params
oliverrhodes Dec 12, 2018
32cdb96
Simplify PFPC LUT generation
oliverrhodes Dec 12, 2018
2b4ea00
Updates to logging for testing in real network
oliverrhodes Feb 6, 2019
602e726
Merge remote-tracking branch 'origin/master' into icub_vor
ChiaraBartolozzi Apr 29, 2019
d506885
run forever working and correct addresses as output
ChiaraBartolozzi Apr 29, 2019
04f3298
Merge remote-tracking branch 'origin/master' into icub_vor
oliverrhodes Aug 29, 2019
0dce290
Merge master and bring up to date
oliverrhodes Sep 1, 2019
6294aa5
Get models working inside cerebellum_tb.py (reduced to 128 neurons per
Sep 6, 2019
fdb8a30
Check under python 2
oliverrhodes Sep 6, 2019
a29b1c1
make poisson source able to change rate without re-map
oliverrhodes Jan 22, 2020
9b141b9
Merge branch 'master' into icub_vor_OR_dev
pabogdan Sep 1, 2020
784adc3
master merged in and tested
pabogdan Sep 2, 2020
a980f55
removing some unnecessary log infos
pabogdan Sep 2, 2020
7fb8e09
Merge branch 'master' into icub_vor_OR_dev
pabogdan Nov 11, 2020
26720ba
can set custom RB LS once again
pabogdan Dec 8, 2020
3c3e208
removed del from dict. now can pass same dict to multiple pops
pabogdan Dec 9, 2020
f3ae48c
better saving of figures and returning of variables from plasticity c…
pabogdan Dec 9, 2020
f4eb254
correct use of LUTs using old-style functions
pabogdan Dec 10, 2020
9a8baa2
longer running example of cerebellum + spinngym. more optimisations a…
pabogdan Dec 14, 2020
f527571
resolving weird behaviour with RandomDelays and FromListconnector
pabogdan Dec 16, 2020
e933e78
added ability to scale the kernels via the alpha parameter
pabogdan Jan 15, 2021
dd06842
[PF-PC and MF-VN] added ability to scale LUT kernels
pabogdan Jan 18, 2021
c1a0b59
no TDMA or tx_offset. Everything is as fast as possible
pabogdan Feb 22, 2021
a7a01ba
Neuron, then synapse with disabled IRQs
pabogdan Feb 22, 2021
e03d736
no flushing of spikes
pabogdan Feb 22, 2021
d5e726b
added SpiNNCer-style custom provenance gathering
pabogdan Feb 22, 2021
c5de292
added code for spike flushing, but not doing any flushing in this state
pabogdan Feb 22, 2021
a2cdd9c
going back to irq disable. int disabling would also disable fiqs
pabogdan Mar 5, 2021
b429c03
Merge remote-tracking branch 'origin/master' into icub_vor_update
andrewgait Nov 15, 2021
8f972bd
Merge correctly and make MFVN and PFPC STDP (single-neuron) models work
andrewgait Nov 18, 2021
0534e0d
Tidy up C code (vera)
andrewgait Nov 18, 2021
8965040
more tidying (vera)
andrewgait Nov 18, 2021
5be7fa4
Add pandas to requirements here too?
andrewgait Nov 18, 2021
ab90b4f
unused parameter
andrewgait Nov 18, 2021
3292e75
flake8 various
andrewgait Nov 18, 2021
21f9ab7
pylint various
andrewgait Nov 19, 2021
e60e84f
Add copyright statements to new files
andrewgait Nov 19, 2021
c8648ab
Reinstate user-specified ring buffer left shifts
andrewgait Nov 23, 2021
62ae442
Turn off plasticity printing
andrewgait Nov 24, 2021
99df1e0
Add rb_left_shifts argument in tests
andrewgait Nov 24, 2021
0152806
Missed adding rb_left_shifts in this vertex
andrewgait Nov 24, 2021
7b16c9f
Merge remote-tracking branch 'origin/master' into icub_vor_update
andrewgait Nov 24, 2021
04f58e7
Move to use spynnaker rather than spynnaker8 locations for imports
andrewgait Nov 25, 2021
caa7c39
Don't need pandas any more
andrewgait Nov 29, 2021
f4e8fb2
Fix to make packets-per-timestep recording work again; move provenance
andrewgait Nov 29, 2021
f6462af
Repeat after me: "the order in Python must be the same as in C"
andrewgait Nov 29, 2021
c7617fe
Merge remote-tracking branch 'origin/master' into icub_vor_update
andrewgait Jan 20, 2022
8daf108
Merge remote-tracking branch 'origin/master' into icub_vor_update
andrewgait Jan 28, 2022
4f53b06
Merge remote-tracking branch 'origin/master' into icub_vor_update
andrewgait Feb 4, 2022
90941d9
Reinstate all binaries; remove model-specific hacking
andrewgait Feb 4, 2022
ffdcc40
Actually use the neuron model that includes t_last
andrewgait Feb 10, 2022
b4eda92
Put the flushed spikes counters under debug flags
andrewgait Feb 10, 2022
38ea81d
Spike flushing only in debug mode
andrewgait Feb 10, 2022
0e6e96b
Tidy up and add some documentation
andrewgait Feb 10, 2022
0bf6bc8
Turn tdma back on again
andrewgait Feb 11, 2022
20836c8
More tidying up of python code this time
andrewgait Feb 11, 2022
dad8812
Merge remote-tracking branch 'origin/master' into icub_vor_update
andrewgait Feb 25, 2022
e779fff
Remove unused old structural plasticity code
andrewgait Feb 25, 2022
dfcbe44
No extra fields in this set of provenance any more
andrewgait Feb 25, 2022
d6ff389
remove unnecessary SSP changes
andrewgait Feb 25, 2022
32c6516
Add reference to paper for MF-VN and PF-PC implementation
andrewgait Mar 2, 2022
fed4eea
Merge branch 'master' into icub_vor_update
andrewgait Mar 11, 2022
b3fe0ab
Merge branch 'master' into icub_vor_update
andrewgait Mar 28, 2022
427488b
Merge branch 'master' into icub_vor_update
andrewgait Apr 14, 2022
5443d9f
Merge remote-tracking branch 'origin/master' into icub_vor_update
andrewgait Jun 17, 2022
de67a3e
Add current source argument to state update; reduce large binaries
andrewgait Jun 17, 2022
c3710e9
Move models to correct location
andrewgait Jun 17, 2022
acbe35d
Merge remote-tracking branch 'origin/master' into icub_vor_update
andrewgait Jul 11, 2022
ee468b4
missed in merge
andrewgait Jul 11, 2022
540e066
reduce binary size
andrewgait Jul 11, 2022
38c14f3
Merge remote-tracking branch 'origin/master' into icub_vor_update
andrewgait Jul 22, 2022
5226284
Merge remote-tracking branch 'origin/master' into icub_vor_update
andrewgait Jul 29, 2022
351c3f5
If SSP is being controlled from another vertex then add control edge
andrewgait Jul 29, 2022
96e7e75
circular_buffer size is 2^n-1, not 2^n; also modify while condition
andrewgait Aug 3, 2022
7644b18
Merge branch 'master' into icub_vor_update
andrewgait Aug 3, 2022
18fe525
Merge branch 'master' into icub_vor_update
andrewgait Aug 4, 2022
ce0b133
Match changes
andrewgait Aug 4, 2022
57ada7a
Merge branch 'master' into icub_vor_update
andrewgait Aug 4, 2022
aaa4e12
Merge branch 'master' into icub_vor_update
andrewgait Aug 22, 2022
9050ddb
Merge branch 'master' into icub_vor_update
andrewgait Aug 31, 2022
05c41a6
Merge remote-tracking branch 'origin/master' into icub_vor_update
andrewgait Sep 14, 2022
14c409a
Merge branch 'master' into icub_vor_update
andrewgait Sep 14, 2022
1f80d1c
Merge remote-tracking branch 'origin/master' into icub_vor_update
andrewgait Sep 16, 2022
6a308b9
Try to fit standard builds into ITCM
andrewgait Sep 16, 2022
836b5c9
Use a current source impl that exists..
andrewgait Sep 20, 2022
9b9be03
Merge remote-tracking branch 'origin/master' into icub_vor_update
andrewgait Sep 23, 2022
da5cad3
No argument required here
andrewgait Sep 23, 2022
31f3a8c
Merge remote-tracking branch 'origin/master' into icub_vor_update
andrewgait Sep 26, 2022
b0502bb
Refactor code and add test
andrewgait Sep 28, 2022
ecd35be
Merge remote-tracking branch 'origin/master' into icub_vor_update
andrewgait Sep 28, 2022
f30761a
merge properly - no more constraints
andrewgait Sep 28, 2022
d669838
Missed an argument
andrewgait Sep 28, 2022
e0c8527
flake8
andrewgait Sep 28, 2022
d713387
Merge branch 'master' into icub_vor_update
andrewgait Sep 28, 2022
1041a74
Merge remote-tracking branch 'origin/master' into icub_vor_update
andrewgait Nov 16, 2022
114ab37
Update neuron model to match others
andrewgait Nov 16, 2022
9333363
Match changes elsewhere, fix builds and runs for new plasticity rules
andrewgait Nov 17, 2022
7f18a56
Merge remote-tracking branch 'origin/master' into icub_vor_update
andrewgait Nov 17, 2022
60de6f4
pylint, vera
andrewgait Nov 18, 2022
55963ac
Move new provenance to split models only
andrewgait Nov 18, 2022
6eaebd3
vera remove empty line
andrewgait Nov 18, 2022
a0122e3
Actually copy everything across properly
andrewgait Nov 18, 2022
c154aeb
Merge remote-tracking branch 'origin/master' into icub_vor_update
andrewgait Jan 12, 2023
ff03fa8
pylint is now more strict
andrewgait Jan 12, 2023
aa10c41
Merge remote-tracking branch 'origin/master' into icub_vor_update
andrewgait Jan 25, 2023
968acfc
Merge branch 'master' into icub_vor_update
andrewgait Jan 27, 2023
af83ea5
Merge remote-tracking branch 'origin/master' into icub_vor_update
andrewgait Feb 6, 2023
49aba30
Provenance not under debug; make STDP naming more consistent
andrewgait Feb 6, 2023
617be97
Merge remote-tracking branch 'origin/master' into icub_vor_update
andrewgait Feb 10, 2023
02c5eeb
Merge branch 'master' into icub_vor_update
andrewgait Feb 20, 2023
741a51a
Update license on new files
andrewgait Feb 20, 2023
f7a2d53
Update license
andrewgait Feb 20, 2023
bbd42f5
Update license on new file
andrewgait Feb 20, 2023
f1289b0
Update licenses
andrewgait Feb 20, 2023
f4d4175
Merge branch 'master' into icub_vor_update
andrewgait Mar 1, 2023
50a34d9
Merge remote-tracking branch 'origin/master' into icub_vor_update
andrewgait Apr 21, 2023
13aba6e
Merge branch 'master' into icub_vor_update
andrewgait May 15, 2023
ccf8772
Merge branch 'master' into icub_vor_update
andrewgait May 17, 2023
379331e
Merge remote-tracking branch 'origin/master' into icub_vor_update
andrewgait Jun 23, 2023
cb27cfb
DataType has moved
andrewgait Jun 26, 2023
e9f5c85
Update OS to use newer compiler
andrewgait Jun 26, 2023
35c3d27
Remove unneeded print statements
andrewgait Jun 26, 2023
4e45004
Merge remote-tracking branch 'origin/master' into icub_vor_update
andrewgait Jul 6, 2023
0064270
Merge branch 'master' into icub_vor_update
andrewgait Jul 18, 2023
32df07a
Tidy up C code
andrewgait Jul 20, 2023
f8d7701
Merge remote-tracking branch 'origin/master' into icub_vor_update
andrewgait Jul 20, 2023
32535ef
Tidy up python code
andrewgait Jul 26, 2023
6cfe9e5
flake8
andrewgait Jul 26, 2023
5101db1
Merge remote-tracking branch 'origin/master' into icub_vor_update
andrewgait Jul 28, 2023
69cc5af
Merge branch 'master' into icub_vor_update
andrewgait Sep 18, 2023
b570da6
Better match changes in standard STDP dynamics code
andrewgait Sep 18, 2023
2451f72
Setting delay_dendritic to zero is unnecessary
andrewgait Sep 18, 2023
e75c1f8
Remove model no longer needed and tidy up code
andrewgait Sep 19, 2023
bb2c8f6
Merge remote-tracking branch 'origin/master' into icub_vor_update
andrewgait Sep 26, 2023
32692be
Merge remote-tracking branch 'origin/master' into icub_vor_update
andrewgait Sep 29, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright (c) 2017-2021 The University of Manchester
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

APP = $(notdir $(CURDIR))

NEURON_MODEL_H = $(NEURON_DIR)/neuron/models/neuron_model_lif_impl.h
INPUT_TYPE_H = $(NEURON_DIR)/neuron/input_types/input_type_conductance.h
NEURON_IMPL_H = $(NEURON_DIR)/neuron/implementations/neuron_impl_standard.h
THRESHOLD_TYPE_H = $(NEURON_DIR)/neuron/threshold_types/threshold_type_static.h
SYNAPSE_TYPE_H = $(NEURON_DIR)/neuron/synapse_types/synapse_types_exponential_impl.h
SYNAPSE_DYNAMICS = $(NEURON_DIR)/neuron/plasticity/stdp/synapse_dynamics_stdp_mad_mfvn_impl.c
TIMING_DEPENDENCE = $(NEURON_DIR)/neuron/plasticity/stdp/timing_dependence/timing_mfvn_impl.c
TIMING_DEPENDENCE_H = $(NEURON_DIR)/neuron/plasticity/stdp/timing_dependence/timing_mfvn_impl.h
WEIGHT_DEPENDENCE = $(NEURON_DIR)/neuron/plasticity/stdp/weight_dependence/weight_mfvn_impl.c
WEIGHT_DEPENDENCE_H = $(NEURON_DIR)/neuron/plasticity/stdp/weight_dependence/weight_mfvn_impl.h

include ../neural_build.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright (c) 2017-2021 The University of Manchester
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

APP = $(notdir $(CURDIR))

NEURON_MODEL_H = $(NEURON_DIR)/neuron/models/neuron_model_lif_impl.h
INPUT_TYPE_H = $(NEURON_DIR)/neuron/input_types/input_type_conductance.h
NEURON_IMPL_H = $(NEURON_DIR)/neuron/implementations/neuron_impl_standard.h
THRESHOLD_TYPE_H = $(NEURON_DIR)/neuron/threshold_types/threshold_type_static.h
SYNAPSE_TYPE_H = $(NEURON_DIR)/neuron/synapse_types/synapse_types_exponential_impl.h
SYNAPSE_DYNAMICS = $(NEURON_DIR)/neuron/plasticity/stdp/synapse_dynamics_stdp_mad_pfpc_impl.c
TIMING_DEPENDENCE = $(NEURON_DIR)/neuron/plasticity/stdp/timing_dependence/timing_pfpc_impl.c
TIMING_DEPENDENCE_H = $(NEURON_DIR)/neuron/plasticity/stdp/timing_dependence/timing_pfpc_impl.h
WEIGHT_DEPENDENCE = $(NEURON_DIR)/neuron/plasticity/stdp/weight_dependence/weight_pfpc_impl.c
WEIGHT_DEPENDENCE_H = $(NEURON_DIR)/neuron/plasticity/stdp/weight_dependence/weight_pfpc_impl.h

include ../neural_build.mk
4 changes: 3 additions & 1 deletion neural_modelling/makefiles/synapse_only/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ MODELS = synapses\
synapses_stdp_mad_pair_additive_structural_random_distance_weight\
synapses_stdp_mad_pair_additive_structural_last_neuron_distance_weight\
synapses_stdp_mad_nearest_pair_additive_structural_random_distance_weight\
synapses_stdp_izhikevich_neuromodulation_pair_additive
synapses_stdp_izhikevich_neuromodulation_pair_additive\
synapses_stdp_mad_mfvn_mfvn\
synapses_stdp_mad_pfpc_pfpc

ifneq ($(SPYNNAKER_DEBUG), DEBUG)
MODELS += synapses_stdp_izhikevich_neuromodulation_pair_multiplicative\
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright (c) 2017-2019 The University of Manchester
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

APP = $(notdir $(CURDIR))

SYNAPSE_DYNAMICS = $(NEURON_DIR)/neuron/plasticity/stdp/synapse_dynamics_stdp_mad_mfvn_impl.c
TIMING_DEPENDENCE = $(NEURON_DIR)/neuron/plasticity/stdp/timing_dependence/timing_mfvn_impl.c
TIMING_DEPENDENCE_H = $(NEURON_DIR)/neuron/plasticity/stdp/timing_dependence/timing_mfvn_impl.h
WEIGHT_DEPENDENCE = $(NEURON_DIR)/neuron/plasticity/stdp/weight_dependence/weight_mfvn_impl.c
WEIGHT_DEPENDENCE_H = $(NEURON_DIR)/neuron/plasticity/stdp/weight_dependence/weight_mfvn_impl.h

include ../synapse_build.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright (c) 2017-2019 The University of Manchester
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

APP = $(notdir $(CURDIR))

SYNAPSE_DYNAMICS = $(NEURON_DIR)/neuron/plasticity/stdp/synapse_dynamics_stdp_mad_pfpc_impl.c
TIMING_DEPENDENCE = $(NEURON_DIR)/neuron/plasticity/stdp/timing_dependence/timing_pfpc_impl.c
TIMING_DEPENDENCE_H = $(NEURON_DIR)/neuron/plasticity/stdp/timing_dependence/timing_pfpc_impl.h
WEIGHT_DEPENDENCE = $(NEURON_DIR)/neuron/plasticity/stdp/weight_dependence/weight_pfpc_impl.c
WEIGHT_DEPENDENCE_H = $(NEURON_DIR)/neuron/plasticity/stdp/weight_dependence/weight_pfpc_impl.h

include ../synapse_build.mk
12 changes: 12 additions & 0 deletions neural_modelling/src/common/in_spikes.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,16 @@ static inline void in_spikes_clear(void) {
static inline spike_t in_spikes_value_at_index(uint32_t index) {
return circular_buffer_value_at_index(buffer, index);
}

#if LOG_LEVEL >= LOG_DEBUG
// FLUSH SPIKES
static inline uint32_t in_spikes_flush_buffer(void) {

uint32_t num_spikes_left = circular_buffer_size(buffer);
circular_buffer_clear(buffer);

return num_spikes_left;
}
#endif

#endif // _IN_SPIKES_H_
11 changes: 10 additions & 1 deletion neural_modelling/src/neuron/c_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
#include "profile_tags.h"
#include "spike_processing.h"

// FLUSH SPIKES
//bool timer_callback_active = false;
//extern volatile bool dma_busy;

//! The combined provenance from synapses and neurons
struct combined_provenance {
struct neuron_provenance neuron_provenance;
Expand Down Expand Up @@ -179,7 +183,12 @@ void background_callback(uint timer_count, uint local_time) {
//! executed since start of simulation
//! \param[in] unused: unused parameter kept for API consistency
void timer_callback(uint timer_count, UNUSED uint unused) {
// Disable interrupts to stop DMAs and MC getting in the way of this bit
// // Get number of spikes in last tick, and reset spike counter
// spike_processing_get_and_reset_spikes_this_tick();
// spike_processing_get_and_reset_dmas_this_tick();
// spike_processing_get_and_reset_pipeline_restarts_this_tick();

// Disable interrupts to stop DMAs and MC getting in the way of this bit
uint32_t state = spin1_int_disable();

// Increment time step
Expand Down
25 changes: 24 additions & 1 deletion neural_modelling/src/neuron/c_main_synapses.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,14 @@
#include "c_main_synapse_common.h"
#include "c_main_common.h"
#include "spike_processing_fast.h"
#include "spike_profiling.h"
#include "structural_plasticity/synaptogenesis_dynamics.h"
#include <spin1_api_params.h>

// FLUSH SPIKES
bool timer_callback_active = false;
extern volatile bool dma_busy;

//! values for the priority for each callback
typedef enum callback_priorities {
MC = -1, DMA = -2, TIMER = 0, SDP = 0
Expand Down Expand Up @@ -90,6 +95,12 @@ const struct synapse_regions SYNAPSE_REGIONS = {
.bitfield_filter = BIT_FIELD_FILTER_REGION
};

//! spike profiling
struct spike_holder_t spike_counter;
struct spike_holder_t spike_cache;
struct spike_holder_t spike_counter_inh;
struct spike_holder_t spike_cache_inh;

//! The current timer tick value.
// the timer tick callback returning the same value.
uint32_t time;
Expand Down Expand Up @@ -129,7 +140,19 @@ void resume_callback(void) {
//! \param[in] unused0: unused
//! \param[in] unused1: unused
void timer_callback(UNUSED uint unused0, UNUSED uint unused1) {
time++;
// Get number of spikes in last tick, and reset spike counter
spike_processing_get_and_reset_spikes_this_tick();
spike_processing_get_and_reset_dmas_this_tick();
spike_processing_get_and_reset_pipeline_restarts_this_tick();

// cache and flush spike counters
// functions in file neural_modelling/src/neuron/spike_profiling.h
spike_profiling_cache_and_flush_spike_holder(&spike_counter,
&spike_cache);
spike_profiling_cache_and_flush_spike_holder(&spike_counter_inh,
&spike_cache_inh);

time++;
if (simulation_is_finished()) {
// Enter pause and resume state to avoid another tick
simulation_handle_pause_resume(resume_callback);
Expand Down
16 changes: 8 additions & 8 deletions neural_modelling/src/neuron/models/neuron_model_lif_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,20 +189,20 @@ static inline state_t neuron_model_get_membrane_voltage(const neuron_t *neuron)
}

static inline void neuron_model_print_state_variables(const neuron_t *neuron) {
log_info("V membrane = %11.4k mv", neuron->V_membrane);
log_info("Refract timer = %u timesteps", neuron->refract_timer);
log_debug("V membrane = %11.4k mv", neuron->V_membrane);
log_debug("Refract timer = %u timesteps", neuron->refract_timer);
}

static inline void neuron_model_print_parameters(const neuron_t *neuron) {
log_info("V reset = %11.4k mv", neuron->V_reset);
log_info("V rest = %11.4k mv", neuron->V_rest);
log_debug("V reset = %11.4k mv", neuron->V_reset);
log_debug("V rest = %11.4k mv", neuron->V_rest);

log_info("I offset = %11.4k nA", neuron->I_offset);
log_info("R membrane = %11.4k Mohm", neuron->R_membrane);
log_debug("I offset = %11.4k nA", neuron->I_offset);
log_debug("R membrane = %11.4k Mohm", neuron->R_membrane);

log_info("exp(-ms/(RC)) = %11.4k [.]", neuron->exp_TC);
log_debug("exp(-ms/(RC)) = %11.4k [.]", neuron->exp_TC);

log_info("T refract = %u timesteps", neuron->T_refract);
log_debug("T refract = %u timesteps", neuron->T_refract);
}


Expand Down
17 changes: 16 additions & 1 deletion neural_modelling/src/neuron/plasticity/stdp/maths.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ static inline int16_lut *maths_copy_int16_lut(address_t *address) {
int16_lut *sdram_lut = (int16_lut *) *address;
uint32_t size = sizeof(int16_lut) + (sdram_lut->size * sizeof(int16_t));
int16_lut *lut = spin1_malloc(size);
log_debug("lut size %d sdram_lut size %d", size, sdram_lut->size);
if (lut == NULL) {
log_error("Not enough space to allocate LUT. Try reducing the timestep,"
" the number of neurons per core, or the tau value; size = %u", size);
Expand All @@ -77,14 +78,28 @@ static inline int16_lut *maths_copy_int16_lut(address_t *address) {
//! \param[in] lut: The lookup table (result of maths_copy_int16_lut())
//! \return The value from the LUT, or zero if out of range
static inline int32_t maths_lut_exponential_decay(
uint32_t time, const int16_lut *lut) {
const uint32_t time, const int16_lut *lut) {
// Calculate lut index
uint32_t lut_index = time >> lut->shift;

// Return value from LUT
return (lut_index < lut->size) ? lut->values[lut_index] : 0;
}

//! \brief Get value from lookup table, time shifted
//! \param[in] time: The time that we are mapping
//! \param[in] time_shift: The time shift value
//! \param[in] lut: The lookup table (result of maths_copy_int16_lut())
//! \return The value from the LUT, or zero if out of range
static inline int32_t maths_lut_exponential_decay_time_shifted(
const uint32_t time, const uint32_t time_shift, const int16_lut *lut) {
// Calculate lut index
uint32_t lut_index = (time >> lut->shift) >> time_shift;

// Return value from LUT
return (lut_index < lut->size) ? lut->values[lut_index] : 0;
}

//! \brief Clamp to fit in number of bits
//! \param[in] x: The value to clamp
//! \param[in] shift: Width of the field to clamp the value to fit in
Expand Down
2 changes: 2 additions & 0 deletions neural_modelling/src/neuron/plasticity/stdp/post_events.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ static inline post_event_history_t *post_events_init_buffers(
uint32_t n_neurons) {
post_event_history_t *post_event_history =
spin1_malloc(n_neurons * sizeof(post_event_history_t));

// Check allocations succeeded
if (post_event_history == NULL) {
log_error("Unable to allocate global STDP structures - Out of DTCM: Try "
Expand Down Expand Up @@ -111,6 +112,7 @@ static inline post_event_history_t *post_events_init_buffers(
static inline post_event_window_t post_events_get_window_delayed(
const post_event_history_t *events, uint32_t begin_time,
uint32_t end_time) {

// Start at end event - beyond end of post-event history
const uint32_t count = events->count_minus_one + 1;
const uint32_t *end_event_time = events->times + count;
Expand Down
2 changes: 2 additions & 0 deletions neural_modelling/src/neuron/plasticity/stdp/stdp_typedefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
//! \return The product
#define STDP_FIXED_MUL_16X16(a, b) maths_fixed_mul16(a, b, STDP_FIXED_POINT)

//#define print_plasticity false

//! The amount of right shift required to take a weight from s1615 format
//! to STDP_FIXED_POINT format (s4,11)
#define S1615_TO_STDP_RIGHT_SHIFT 4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,6 @@
//---------------------------------------
// Structures
//---------------------------------------
//! \brief The type of history data of pre-events
//!
//! This data is stored in SDRAM in the plastic part of the synaptic matrix
typedef struct {
//! The event time
uint32_t prev_time;
//! The event trace
pre_trace_t prev_trace;
} pre_event_history_t;

//! The type of configuration parameters in SDRAM (written by host)
typedef struct stdp_params {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ typedef struct nm_final_state_t {
final_state_t final_state;
} nm_final_state_t;

//! \brief The type of history data of pre-events
//!
//! This data is stored in SDRAM in the plastic part of the synaptic matrix
typedef struct {
//! The event time
uint32_t prev_time;
//! The event trace
pre_trace_t prev_trace;
} pre_event_history_t;

struct synapse_row_plastic_data_t {
union {
struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@
#include "post_events.h"
#include "synapse_dynamics_stdp_common.h"

//! \brief The type of history data of pre-events
//!
//! This data is stored in SDRAM in the plastic part of the synaptic matrix
typedef struct {
//! The event time
uint32_t prev_time;
//! The event trace
pre_trace_t prev_trace;
} pre_event_history_t;

//! The format of the plastic data region of a synaptic row
struct synapse_row_plastic_data_t {
//! The pre-event history
Expand Down
Loading