sPyNNaker neural_modelling 7.3.1
Loading...
Searching...
No Matches
last_neuron_selection_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 _LAST_NEURON_SELECTION_IMPL_H_
20#define _LAST_NEURON_SELECTION_IMPL_H_
21
22#include "partner.h"
24
30extern uint32_t n_spikes[2];
31
36static inline void partner_spike_received(uint32_t time, spike_t spike) {
37 extern uint32_t last_spikes_buffer_size;
38 extern uint32_t last_time;
39
40 uint32_t buffer = time & 0x1;
41 if (time != last_time) {
43 n_spikes[buffer] = 0;
44 }
47 }
48}
49
62 uint32_t time, uint32_t *restrict population_id,
63 uint32_t *restrict sub_population_id, uint32_t *restrict neuron_id,
64 spike_t *restrict spike, uint32_t *restrict m_pop_index) {
67
68 uint32_t buffer = (time - 1) & 0x1;
69 if (!n_spikes[buffer]) {
70 return false;
71 }
72 uint32_t offset = rand_int(n_spikes[buffer], rewiring_data.local_seed);
73 *spike = last_spikes_buffer[buffer][offset];
74 return sp_structs_find_by_spike(&pre_info, *spike, neuron_id,
75 population_id, sub_population_id, m_pop_index);
76}
77
78#endif // _LAST_NEURON_SELECTION_IMPL_H_
uint32_t time
The current timer tick value.
Definition c_main.c:94
static circular_buffer buffer
Buffer for quickly taking spikes received by a fast interrupt and queueing them for later processing ...
Definition in_spikes.h:28
uint32_t last_spikes_buffer_size
Size of each sub-array within last_spikes_buffer.
uint32_t last_time
The time of the most recently-considered spike.
spike_t * last_spikes_buffer[2]
Spike accumulation buffers.
uint32_t n_spikes[2]
Spike buffer counters.
static void partner_spike_received(uint32_t time, spike_t spike)
Notifies the rule that a spike has been received.
static bool potential_presynaptic_partner(uint32_t time, uint32_t *restrict population_id, uint32_t *restrict sub_population_id, uint32_t *restrict neuron_id, spike_t *restrict spike, uint32_t *restrict m_pop_index)
Choose the potential (remote) synaptic partner.
uint32_t spike_t
The type of a spike.
Partner selection rule common API.
static uint32_t rand_int(uint32_t max, mars_kiss64_seed_t seed)
Definition sp_structs.h:123
static bool sp_structs_find_by_spike(const pre_pop_info_table_t *pre_pop_info_table, spike_t spike, uint32_t *restrict neuron_id, uint32_t *restrict population_id, uint32_t *restrict sub_population_id, uint32_t *restrict m_pop_index)
unpack the spike into key and identifying information for the neuron; Identify pop,...
Definition sp_structs.h:136
table of individual pre-synaptic information
Definition sp_structs.h:70
parameters of the synaptic rewiring model
Definition sp_structs.h:76
Spike processing API.
rewiring_data_t rewiring_data
the instantiation of the rewiring data
pre_pop_info_table_t pre_info
pre-population information table