sPyNNaker neural_modelling 7.3.1
Loading...
Searching...
No Matches
Functions | Variables
in_spikes.h File Reference

Functions for immediate handling of incoming spikes. More...

#include "neuron-typedefs.h"
#include <circular_buffer.h>

Go to the source code of this file.

Functions

static bool in_spikes_initialize_spike_buffer (uint32_t size)
 This function initialises the input spike buffer.
 
static bool in_spikes_add_spike (spike_t spike)
 Adds a spike to the input spike buffer.
 
static bool in_spikes_get_next_spike (spike_t *spike)
 Retrieves a spike from the input spike buffer.
 
static bool in_spikes_is_next_spike_equal (spike_t spike)
 Skips the next spike in the buffer if it is equal to an existing spike.
 
static counter_t in_spikes_get_n_buffer_overflows (void)
 Get the number of times that the input spike buffer overflowed.
 
static counter_t in_spikes_get_n_buffer_underflows (void)
 Get the number of times that the input spike buffer underflowed.
 
static void in_spikes_print_buffer (void)
 Print the input spike buffer.
 
static uint32_t in_spikes_input_index (void)
 Get the index in the buffer of the point where the next insertion goes.
 
static uint32_t in_spikes_output_index (void)
 Get the index in the buffer of the point where the next removal comes from.
 
static uint32_t in_spikes_real_size (void)
 Get the size of the input spike buffer.
 
static uint32_t in_spikes_size (void)
 get the size of the input spike buffer
 
static void in_spikes_clear (void)
 clears the input spike buffer.
 
static spike_t in_spikes_value_at_index (uint32_t index)
 Get the spike at a specific index of the input spike buffer.
 

Variables

static circular_buffer buffer
 Buffer for quickly taking spikes received by a fast interrupt and queueing them for later processing by less critical code.
 

Detailed Description

Functions for immediate handling of incoming spikes.

Definition in file in_spikes.h.

Function Documentation

◆ in_spikes_initialize_spike_buffer()

static bool in_spikes_initialize_spike_buffer ( uint32_t  size)
inlinestatic

This function initialises the input spike buffer.

It configures:

buffer
the buffer to hold the spikes (initialised with size spaces)
input
index for next spike inserted into buffer
output
index for next spike extracted from buffer
overflows
a counter for the number of times the buffer overflows
underflows
a counter for the number of times the buffer underflows

If underflows is ever non-zero, then there is a problem with this code.

Parameters
[in]sizeThe number of spikes we expect to handle in the buffer; this should be a power of 2 (and will be increased to the next one up if it isn't).
Returns
True if the buffer was successfully initialised

Definition at line 51 of file in_spikes.h.

◆ in_spikes_add_spike()

static bool in_spikes_add_spike ( spike_t  spike)
inlinestatic

Adds a spike to the input spike buffer.

Parameters
[in]spikeThe spike to add
Returns
True if the spike was added

Definition at line 59 of file in_spikes.h.

◆ in_spikes_get_next_spike()

static bool in_spikes_get_next_spike ( spike_t spike)
inlinestatic

Retrieves a spike from the input spike buffer.

Parameters
[out]spikeThe spike that was retrieved.
Returns
True if a spike was retrieved, false if the buffer was empty.

Definition at line 66 of file in_spikes.h.

◆ in_spikes_is_next_spike_equal()

static bool in_spikes_is_next_spike_equal ( spike_t  spike)
inlinestatic

Skips the next spike in the buffer if it is equal to an existing spike.

Parameters
[in]spikeThe spike to compare against.
Returns
True if a spike was skipped over, false otherwise.

Definition at line 74 of file in_spikes.h.

◆ in_spikes_get_n_buffer_overflows()

static counter_t in_spikes_get_n_buffer_overflows ( void  )
inlinestatic

Get the number of times that the input spike buffer overflowed.

Returns
A count.

Definition at line 80 of file in_spikes.h.

◆ in_spikes_get_n_buffer_underflows()

static counter_t in_spikes_get_n_buffer_underflows ( void  )
inlinestatic

Get the number of times that the input spike buffer underflowed.

Returns
A count.

Definition at line 86 of file in_spikes.h.

◆ in_spikes_print_buffer()

static void in_spikes_print_buffer ( void  )
inlinestatic

Print the input spike buffer.

Expected to be mainly for debugging.

Definition at line 92 of file in_spikes.h.

◆ in_spikes_input_index()

static uint32_t in_spikes_input_index ( void  )
inlinestatic

Get the index in the buffer of the point where the next insertion goes.

Returns
An index.

Definition at line 102 of file in_spikes.h.

◆ in_spikes_output_index()

static uint32_t in_spikes_output_index ( void  )
inlinestatic

Get the index in the buffer of the point where the next removal comes from.

Returns
An index.

Definition at line 109 of file in_spikes.h.

◆ in_spikes_real_size()

static uint32_t in_spikes_real_size ( void  )
inlinestatic

Get the size of the input spike buffer.

Returns
The size of the buffer (a power of 2).

Definition at line 115 of file in_spikes.h.

◆ in_spikes_size()

static uint32_t in_spikes_size ( void  )
inlinestatic

get the size of the input spike buffer

Returns
The size of the buffer.

Definition at line 121 of file in_spikes.h.

◆ in_spikes_clear()

static void in_spikes_clear ( void  )
inlinestatic

clears the input spike buffer.

Definition at line 126 of file in_spikes.h.

◆ in_spikes_value_at_index()

static spike_t in_spikes_value_at_index ( uint32_t  index)
inlinestatic

Get the spike at a specific index of the input spike buffer.

Parameters
[in]indexThe index to retrieve from. Will be wrapped within the buffer.
Returns
The spike at the index. WARNING: if there is no spike at that index, the value returned may be arbitrary.

Definition at line 135 of file in_spikes.h.

Variable Documentation

◆ buffer

circular_buffer buffer
static

Buffer for quickly taking spikes received by a fast interrupt and queueing them for later processing by less critical code.

Definition at line 28 of file in_spikes.h.