sPyNNaker neural_modelling 7.3.1
Loading...
Searching...
No Matches
Data Structures | Macros | Functions | Variables
neuron_expander.c File Reference

The synapse expander for neuron cores. More...

#include "param_generator.h"
#include "rng.h"
#include "type_writers.h"
#include <spin1_api.h>
#include <data_specification.h>
#include <debug.h>
#include "common_mem.h"

Go to the source code of this file.

Data Structures

struct  neuron_param_item_t
 
struct  neuron_param_t
 
struct  neuron_params_struct_t
 The configuration of a struct. More...
 
struct  sdram_variable_recording_data_t
 
struct  sdram_bitfield_recording_data_t
 
struct  recording_index_t
 
struct  variable_recording_t
 
struct  bitfield_recording_t
 
struct  recording_params_t
 

Macros

#define REPEAT_PER_NEURON   0xFFFFFFFF
 
#define REPEAT_PER_NEURON_RECORDED   0x7FFFFFFF
 
#define MOD_4   0x3
 
#define FLOOR_TO_2   0xFFFFFFFE
 When bitwise anded with a number will floor to the nearest multiple of 2.
 
#define CEIL_TO_2   1
 Add to a number before applying floor to 2 to turn it into a ceil operation.
 

Functions

static uint32_t align_offset (uint32_t offset, uint32_t size)
 
static bool read_struct_builder_region (void **region, void **neuron_params_region, uint32_t n_neurons)
 Generate the synapses for a single connector.
 
static void read_index (uint32_t n_items, recording_index_t *items, uint32_t n_neurons, uint32_t n_neurons_max, uint32_t n_neurons_recording, uint16_t *sdram_out)
 
static void write_zero_index (uint32_t n_neurons_max, uint16_t *sdram_out)
 
static uint32_t get_n_recording (uint32_t n_recording, uint32_t n_neurons)
 
static void read_recorded_variable (void **region, void **recording_region, uint32_t n_neurons, uint32_t n_neurons_max)
 
static void read_recorded_bitfield (void **region, void **recording_region, uint32_t n_neurons, uint32_t n_neurons_max)
 
static bool run_neuron_expander (data_specification_metadata_t *ds_regions, void *params_address)
 Read the data for the expander.
 
void c_main (void)
 Entry point.
 

Variables

static const uint32_t ADD [4][3]
 
 expander_config_t
 
rng_tpopulation_rng
 An RNG that starts in the same place on every core of the Population.
 
rng_tcore_rng
 An RNG that is local to the current core.
 

Detailed Description

The synapse expander for neuron cores.

Definition in file neuron_expander.c.


Data Structure Documentation

◆ neuron_param_item_t

struct neuron_param_item_t

Definition at line 68 of file neuron_expander.c.

Data Fields
uint32_t n_repeats
uint32_t generator

◆ neuron_param_t

struct neuron_param_t

Definition at line 75 of file neuron_expander.c.

Data Fields
type param_type
uint32_t n_items
neuron_param_item_t item[]

◆ neuron_params_struct_t

struct neuron_params_struct_t

The configuration of a struct.

Definition at line 85 of file neuron_expander.c.

Data Fields
uint32_t bytes_per_repeat
uint32_t n_repeats_total
uint32_t struct_size_bytes
uint32_t n_params
neuron_param_t param[]

◆ sdram_variable_recording_data_t

struct sdram_variable_recording_data_t

Definition at line 100 of file neuron_expander.c.

Data Fields
uint32_t rate
uint32_t n_recording
uint32_t element_size
uint16_t indices[]

◆ sdram_bitfield_recording_data_t

struct sdram_bitfield_recording_data_t

Definition at line 107 of file neuron_expander.c.

Data Fields
uint32_t rate
uint32_t n_recording
uint16_t indices[]

◆ recording_index_t

struct recording_index_t

Definition at line 113 of file neuron_expander.c.

Data Fields
uint32_t n_repeats:31
uint32_t is_recording:1

◆ variable_recording_t

struct variable_recording_t

Definition at line 118 of file neuron_expander.c.

Data Fields
uint32_t rate
uint32_t element_size
uint32_t n_recording
uint32_t n_index_items
recording_index_t index_items[]

◆ bitfield_recording_t

struct bitfield_recording_t

Definition at line 126 of file neuron_expander.c.

Data Fields
uint32_t rate
uint32_t n_recording
uint32_t n_index_items
recording_index_t index_items[]

◆ recording_params_t

struct recording_params_t

Definition at line 133 of file neuron_expander.c.

Data Fields
uint32_t n_recordable_variables
uint32_t n_recordable_bit_fields

Macro Definition Documentation

◆ REPEAT_PER_NEURON

#define REPEAT_PER_NEURON   0xFFFFFFFF

Definition at line 32 of file neuron_expander.c.

◆ REPEAT_PER_NEURON_RECORDED

#define REPEAT_PER_NEURON_RECORDED   0x7FFFFFFF

Definition at line 34 of file neuron_expander.c.

◆ MOD_4

#define MOD_4   0x3

Definition at line 37 of file neuron_expander.c.

◆ FLOOR_TO_2

#define FLOOR_TO_2   0xFFFFFFFE

When bitwise anded with a number will floor to the nearest multiple of 2.

Definition at line 40 of file neuron_expander.c.

◆ CEIL_TO_2

#define CEIL_TO_2   1

Add to a number before applying floor to 2 to turn it into a ceil operation.

Definition at line 43 of file neuron_expander.c.

Function Documentation

◆ align_offset()

static uint32_t align_offset ( uint32_t  offset,
uint32_t  size 
)
inlinestatic

Definition at line 56 of file neuron_expander.c.

◆ read_struct_builder_region()

static bool read_struct_builder_region ( void **  region,
void **  neuron_params_region,
uint32_t  n_neurons 
)
static

Generate the synapses for a single connector.

Parameters
[in,out]in_regionThe address to read the parameters from. Should be updated to the position just after the parameters after calling.
[in]synaptic_matrix_regionThe address of the synaptic matrices
[in]post_slice_startThe start of the slice of the post-population to generate for
[in]post_slice_countThe number of neurons to generate for
[in]n_synapse_type_bitsThe number of bits in the synapse type
[in]n_synapse_index_bitsThe number of bits for the neuron index id
[in]weight_scalesAn array of weight scales, one for each synapse type
Returns
true on success, false on failure

Definition at line 169 of file neuron_expander.c.

◆ read_index()

static void read_index ( uint32_t  n_items,
recording_index_t items,
uint32_t  n_neurons,
uint32_t  n_neurons_max,
uint32_t  n_neurons_recording,
uint16_t *  sdram_out 
)
inlinestatic

Definition at line 252 of file neuron_expander.c.

◆ write_zero_index()

static void write_zero_index ( uint32_t  n_neurons_max,
uint16_t *  sdram_out 
)
static

Definition at line 293 of file neuron_expander.c.

◆ get_n_recording()

static uint32_t get_n_recording ( uint32_t  n_recording,
uint32_t  n_neurons 
)
inlinestatic

Definition at line 300 of file neuron_expander.c.

◆ read_recorded_variable()

static void read_recorded_variable ( void **  region,
void **  recording_region,
uint32_t  n_neurons,
uint32_t  n_neurons_max 
)
static

Definition at line 307 of file neuron_expander.c.

◆ read_recorded_bitfield()

static void read_recorded_bitfield ( void **  region,
void **  recording_region,
uint32_t  n_neurons,
uint32_t  n_neurons_max 
)
static

Definition at line 333 of file neuron_expander.c.

◆ run_neuron_expander()

static bool run_neuron_expander ( data_specification_metadata_t ds_regions,
void *  params_address 
)
static

Read the data for the expander.

Parameters
[in]ds_regionsThe data specification regions
[in]params_addressThe address of the expander parameters
Returns
True if the expander finished correctly, False if there was an error

Definition at line 365 of file neuron_expander.c.

◆ c_main()

void c_main ( void  )

Entry point.

Definition at line 438 of file neuron_expander.c.

Variable Documentation

◆ ADD

const uint32_t ADD[4][3]
static
Initial value:
= {
{0, 0, 0},
{3, 0, 1},
{2, 0, 0},
{1, 0, 1}
}

Definition at line 49 of file neuron_expander.c.

◆ expander_config_t

expander_config_t

Definition at line 149 of file neuron_expander.c.

◆ population_rng

rng_t* population_rng

An RNG that starts in the same place on every core of the Population.

Definition at line 151 of file neuron_expander.c.

◆ core_rng

rng_t* core_rng

An RNG that is local to the current core.

Definition at line 152 of file neuron_expander.c.