sPyNNaker neural_modelling 7.1.1
Loading...
Searching...
No Matches
Data Structures | Macros
population_table.h File Reference

Master pop(ulation) table API. More...

#include <common/neuron-typedefs.h>
#include <filter_info.h>
#include <neuron/synapse_row.h>
#include <debug.h>

Go to the source code of this file.

Data Structures

struct  master_population_table_entry
 An entry in the master population table. More...
 
struct  address_list_entry
 A packed address and row length (note: same size as extra info) More...
 
struct  pop_table_config_t
 The memory layout in SDRAM of the first part of the population table configuration. Address list data (array of ::address_and_row_length) is packed on the end. More...
 
struct  pop_table_lookup_result_t
 A structure to hold a response to a population table lookup. More...
 

Macros

#define BITS_PER_WORD   32
 bits in a word More...
 
#define TOP_BIT_IN_WORD   31
 The highest bit within the word. More...
 
#define NOT_IN_MASTER_POP_TABLE_FLAG   -1
 The flag for when a spike isn't in the master pop table (so shouldn't happen) More...
 
#define N_ADDRESS_BITS   24
 The number of bits of address. This is a constant as it is used more than once below. More...
 
#define INDIRECT_ADDRESS_SHIFT   4
 The shift to apply to indirect addresses. The address is in units of four words, so this multiplies by 16 (= up shifts by 4) More...
 
#define INVALID_ADDRESS   ((1 << N_ADDRESS_BITS) - 1)
 An Invalid address and row length. More...
 

Support functions

uint32_t ghost_pop_table_searches
 the number of times a DMA resulted in 0 entries More...
 
uint32_t invalid_master_pop_hits
 the number of times packet isn't in the master pop table at all! More...
 
uint32_t failed_bit_field_reads
 The number of bit fields which were not able to be read in due to DTCM limits. More...
 
uint32_t bit_field_filtered_packets
 The number of packets dropped because the bitfield filter says they don't hit anything. More...
 
uint16_t items_to_go
 The number of addresses from the same spike left to process. More...
 
static uint32_t get_offset (address_list_entry entry)
 Get the standard address offset out of an entry. More...
 
static uint32_t get_address (address_list_entry entry, uint32_t addr)
 Get the standard address out of an entry. More...
 
static uint32_t get_row_length (address_list_entry entry)
 Get the length of the row from the entry. More...
 
static uint32_t get_core_index (master_population_table_entry entry, spike_t spike)
 Get the source core index from a spike. More...
 
static uint32_t get_core_sum (master_population_table_entry entry, spike_t spike)
 Get the total number of neurons on cores which come before this core. More...
 
static uint32_t get_neuron_id (master_population_table_entry entry, spike_t spike)
 Get the source neuron ID for a spike given its table entry (without extra info) More...
 
static uint32_t get_local_neuron_id (master_population_table_entry entry, spike_t spike)
 Get the neuron id of the neuron on the source core, for a spike with extra info. More...
 
static void get_row_addr_and_size (address_list_entry item, uint32_t synaptic_rows_base_address, uint32_t neuron_id, pop_table_lookup_result_t *result)
 Get the row address and size for a given neuron. More...
 
bool population_table_setup (address_t table_address, uint32_t *row_max_n_words, uint32_t *master_pop_table_length, master_population_table_entry **master_pop_table, address_list_entry **address_list)
 Set up and return the table for outside use. More...
 
bool population_table_initialise (address_t table_address, address_t synapse_rows_address, uint32_t *row_max_n_words)
 Set up the table. More...
 
bool population_table_load_bitfields (filter_region_t *filter_region)
 Initialise the bitfield filtering system. More...
 
bool population_table_get_first_address (spike_t spike, pop_table_lookup_result_t *result)
 Get the first row data for the given input spike. More...
 
static bool population_table_is_next (void)
 Determine if there are more items with the same key. More...
 
bool population_table_get_next_address (spike_t *spike, pop_table_lookup_result_t *result)
 Get the next row data for a previously given spike. If no spike has been given, return False. More...
 

Detailed Description

Master pop(ulation) table API.

Definition in file population_table.h.


Data Structure Documentation

◆ master_population_table_entry

struct master_population_table_entry

An entry in the master population table.

Definition at line 50 of file population_table.h.

Data Fields
uint32_t key The key to match against the incoming message.
uint32_t mask The mask to select the relevant bits of key for matching.
uint32_t start: 13 The index into address_list for this entry.
uint32_t n_colour_bits: 3 The number of bits of key used for colour (0 if no colour)
uint32_t count: 16 The number of entries in address_list for this entry.
uint32_t core_mask: 16 The mask to apply to the key once shifted to get the core index.
uint32_t mask_shift: 16 The shift to apply to the key to get the core part.
uint32_t n_neurons: 16 The number of neurons per core.
uint32_t n_words: 16 The number of words for n_neurons.

◆ address_list_entry

struct address_list_entry

A packed address and row length (note: same size as extra info)

Definition at line 72 of file population_table.h.

Data Fields
uint32_t row_length: 8 the length of the row
uint32_t address: N_ADDRESS_BITS the address

◆ pop_table_config_t

struct pop_table_config_t

The memory layout in SDRAM of the first part of the population table configuration. Address list data (array of ::address_and_row_length) is packed on the end.

Definition at line 86 of file population_table.h.

Data Fields
uint32_t table_length
uint32_t addr_list_length
master_population_table_entry data[]

◆ pop_table_lookup_result_t

struct pop_table_lookup_result_t

A structure to hold a response to a population table lookup.

Definition at line 93 of file population_table.h.

Data Fields
synaptic_row_t row_address
size_t n_bytes_to_transfer
uint32_t colour
uint32_t colour_mask

Macro Definition Documentation

◆ BITS_PER_WORD

#define BITS_PER_WORD   32

bits in a word

Definition at line 31 of file population_table.h.

◆ TOP_BIT_IN_WORD

#define TOP_BIT_IN_WORD   31

The highest bit within the word.

Definition at line 34 of file population_table.h.

◆ NOT_IN_MASTER_POP_TABLE_FLAG

#define NOT_IN_MASTER_POP_TABLE_FLAG   -1

The flag for when a spike isn't in the master pop table (so shouldn't happen)

Definition at line 38 of file population_table.h.

◆ N_ADDRESS_BITS

#define N_ADDRESS_BITS   24

The number of bits of address. This is a constant as it is used more than once below.

Definition at line 42 of file population_table.h.

◆ INDIRECT_ADDRESS_SHIFT

#define INDIRECT_ADDRESS_SHIFT   4

The shift to apply to indirect addresses. The address is in units of four words, so this multiplies by 16 (= up shifts by 4)

Definition at line 47 of file population_table.h.

◆ INVALID_ADDRESS

#define INVALID_ADDRESS   ((1 << N_ADDRESS_BITS) - 1)

An Invalid address and row length.

Used to keep indices aligned between delayed and undelayed tables

Definition at line 81 of file population_table.h.

Function Documentation

◆ get_offset()

static uint32_t get_offset ( address_list_entry  entry)
inlinestatic

Get the standard address offset out of an entry.

The address is in units of four words, so this multiplies by 16 (= up shifts by 4)

Parameters
[in]entrythe table entry
Returns
a row address (which is an offset)

Definition at line 115 of file population_table.h.

◆ get_address()

static uint32_t get_address ( address_list_entry  entry,
uint32_t  addr 
)
inlinestatic

Get the standard address out of an entry.

Parameters
[in]entrythe table entry
Returns
a row address

Definition at line 122 of file population_table.h.

◆ get_row_length()

static uint32_t get_row_length ( address_list_entry  entry)
inlinestatic

Get the length of the row from the entry.

Row lengths are stored offset by 1, to allow 1-256 length rows

Parameters
[in]entrythe table entry
Returns
the row length

Definition at line 132 of file population_table.h.

◆ get_core_index()

static uint32_t get_core_index ( master_population_table_entry  entry,
spike_t  spike 
)
inlinestatic

Get the source core index from a spike.

Parameters
[in]entryThe master pop table entry
[in]spikeThe spike received
Returns
the source core index in the list of source cores

Definition at line 140 of file population_table.h.

◆ get_core_sum()

static uint32_t get_core_sum ( master_population_table_entry  entry,
spike_t  spike 
)
inlinestatic

Get the total number of neurons on cores which come before this core.

Parameters
[in]entryThe master pop table entry
[in]spikeThe spike received
Returns
the base neuron number of this core

Definition at line 148 of file population_table.h.

◆ get_neuron_id()

static uint32_t get_neuron_id ( master_population_table_entry  entry,
spike_t  spike 
)
inlinestatic

Get the source neuron ID for a spike given its table entry (without extra info)

Parameters
[in]entrythe table entry
[in]spikethe spike
Returns
the neuron ID

Definition at line 156 of file population_table.h.

◆ get_local_neuron_id()

static uint32_t get_local_neuron_id ( master_population_table_entry  entry,
spike_t  spike 
)
inlinestatic

Get the neuron id of the neuron on the source core, for a spike with extra info.

Parameters
[in]entrythe table entry
[in]spikethe spike received
Returns
the source neuron id local to the core

Definition at line 166 of file population_table.h.

◆ get_row_addr_and_size()

static void get_row_addr_and_size ( address_list_entry  item,
uint32_t  synaptic_rows_base_address,
uint32_t  neuron_id,
pop_table_lookup_result_t result 
)
inlinestatic

Get the row address and size for a given neuron.

Parameters
[in]itemThe address list item
[in]synaptic_rows_based_addressThe address of all synaptic rows
[in]neuron_idThe incoming neuron to get the address of
[out]resultThe place to write results to

Definition at line 176 of file population_table.h.

◆ population_table_setup()

bool population_table_setup ( address_t  table_address,
uint32_t *  row_max_n_words,
uint32_t *  master_pop_table_length,
master_population_table_entry **  master_pop_table,
address_list_entry **  address_list 
)

Set up and return the table for outside use.

Parameters
[in]table_addressThe address of the start of the table data
[out]row_max_n_wordsUpdated with the maximum length of any row in the table in words
[out]master_pop_table_lengthUpdated with the length of the table
[out]master_pop_tableUpdated with the table entries
[out]address_listUpdated with the address list
Returns
True if the table was setup successfully, False otherwise

Definition at line 203 of file population_table_binary_search_impl.c.

◆ population_table_initialise()

bool population_table_initialise ( address_t  table_address,
address_t  synapse_rows_address,
uint32_t *  row_max_n_words 
)

Set up the table.

Parameters
[in]table_addressThe address of the start of the table data
[in]synapse_rows_addressThe address of the start of the synapse data
[out]row_max_n_wordsUpdated with the maximum length of any row in the table in words
Returns
True if the table was initialised successfully, False otherwise

Definition at line 250 of file population_table_binary_search_impl.c.

◆ population_table_load_bitfields()

bool population_table_load_bitfields ( filter_region_t filter_region)

Initialise the bitfield filtering system.

Parameters
[in]filter_regionWhere the bitfield configuration is
Returns
True on success

Definition at line 118 of file population_table_binary_search_impl.c.

◆ population_table_get_first_address()

bool population_table_get_first_address ( spike_t  spike,
pop_table_lookup_result_t result 
)

Get the first row data for the given input spike.

Parameters
[in]spikeThe spike received
[out]resultUpdated with the lookup details
Returns
True if there is a row to read, False if not

Definition at line 264 of file population_table_binary_search_impl.c.

◆ population_table_is_next()

static bool population_table_is_next ( void  )
inlinestatic

Determine if there are more items with the same key.

Returns
Whether there are more items

Definition at line 248 of file population_table.h.

◆ population_table_get_next_address()

bool population_table_get_next_address ( spike_t spike,
pop_table_lookup_result_t result 
)

Get the next row data for a previously given spike. If no spike has been given, return False.

Parameters
[out]spikeThe initiating spike
[out]resultUpdated with the lookup details
Returns
True if there is a row to read, False if not

Definition at line 315 of file population_table_binary_search_impl.c.

Variable Documentation

◆ ghost_pop_table_searches

uint32_t ghost_pop_table_searches
extern

the number of times a DMA resulted in 0 entries

Definition at line 60 of file population_table_binary_search_impl.c.

◆ invalid_master_pop_hits

uint32_t invalid_master_pop_hits
extern

the number of times packet isn't in the master pop table at all!

the number of times packet isn't in the master pop table at all!

Definition at line 63 of file population_table_binary_search_impl.c.

◆ failed_bit_field_reads

uint32_t failed_bit_field_reads
extern

The number of bit fields which were not able to be read in due to DTCM limits.

Definition at line 67 of file population_table_binary_search_impl.c.

◆ bit_field_filtered_packets

uint32_t bit_field_filtered_packets
extern

The number of packets dropped because the bitfield filter says they don't hit anything.

Definition at line 71 of file population_table_binary_search_impl.c.

◆ items_to_go

uint16_t items_to_go
extern

The number of addresses from the same spike left to process.

The number of relevant items remaining in the address_list NOTE: Exported for speed of check

Definition at line 54 of file population_table_binary_search_impl.c.