19#ifndef _POST_EVENTS_H_
20#define _POST_EVENTS_H_
33#define MAX_POST_SYNAPTIC_EVENTS 16
36 int16_t dopamine_trace;
46 uint32_t count_minus_one;
64 const uint32_t *next_time;
68 uint32_t prev_time_valid;
77#if LOG_LEVEL >= LOG_DEBUG
81 log_debug(
" ## printing entire post event history ##");
83 log_debug(
"post event: %u, time: %u, trace: %u",
98 log_error(
"Unable to allocate global STDP structures - Out of DTCM: Try "
99 "reducing the number of neurons per core to fix this problem ");
104 for (uint32_t n = 0; n <
n_neurons; n++) {
128 const uint32_t *end_event_time = events->
times + count;
129 const uint32_t *event_time = end_event_time;
135 if (*event_time > end_time) {
136 end_event_time = event_time;
147 }
while (*event_time > begin_time && event_time != events->
times);
191static inline bool post_events_next_is_dopamine(
203 int16_t dopamine_trace,
bool dopamine) {
209 events->
traces[new_index].post_trace = post_trace;
210 events->
traces[new_index].dopamine_trace = dopamine_trace;
239#if LOG_LEVEL >= LOG_DEBUG
247 uint32_t begin_time, uint32_t end_time, uint32_t delay_dendritic) {
248 log_info(
" ## printing post window ##");
253 const uint32_t delayed_post_time =
254 *post_window.
next_time + delay_dendritic;
255 log_info(
"post spike: %u, time: %u, trace: %u, dop_trace: %u",
uint32_t time
The current timer tick value.
void log_error(const char *message,...)
void log_debug(const char *message,...)
void log_info(const char *message,...)
static uint32_t n_neurons
The number of neurons on the core.
nm_post_trace_t prev_trace
The previous post-synaptic event trace.
#define MAX_POST_SYNAPTIC_EVENTS
Maximum number of post-synaptic events supported.
static post_event_history_t * post_events_init_buffers(uint32_t n_neurons)
Initialise an array of post-synaptic event histories.
uint32_t num_events
The number of events.
static void print_event_history(const post_event_history_t *events)
Print a post-synaptic event history.
static post_event_window_t post_events_next(post_event_window_t window)
Advance a post-synaptic event window to the next event.
static void post_events_add(uint32_t time, post_event_history_t *events, post_trace_t post_trace, int16_t dopamine_trace, bool dopamine)
Add a post-synaptic event to the history.
post_trace_t prev_trace
The previous post-synaptic event trace.
const uint32_t * next_time
The next post-synaptic event time.
uint32_t prev_time
The previous post-synaptic event time.
const post_trace_t * next_trace
The next post-synaptic event trace.
static post_event_window_t post_events_get_window_delayed(const post_event_history_t *events, uint32_t begin_time, uint32_t end_time)
Get the post-synaptic event window.
uint32_t dopamine_trace_markers
Bit field to indicate whether a trace is dopamine or not.
uint32_t prev_time_valid
Whether the previous post-synaptic event is valid (based on time)
const nm_post_trace_t * next_trace
The next post-synaptic event trace.
static void print_delayed_window_events(const post_event_history_t *post_event_history, uint32_t begin_time, uint32_t end_time, uint32_t delay_dendritic)
Print the post-synaptic event history.
Post event window description.
uint32_t dopamine_trace_markers
Bit field to indicate whether a trace is dopamine or not.
uint32_t count_minus_one
Number of events stored (minus one)
uint32_t times[MAX_POST_SYNAPTIC_EVENTS]
Event times.
post_trace_t traces[MAX_POST_SYNAPTIC_EVENTS]
Event traces.
Trace history of post-synaptic events.
static post_event_history_t * post_event_history
The history data of post-events.
static post_trace_t timing_get_initial_post_trace(void)
Get an initial post-synaptic timing trace.
The type of post-spike traces.