35#define INVALID_REGION_ID 0xFFFFFFFF
38typedef struct connection_builder_config {
44 uint32_t synapse_type;
47 uint32_t connector_type;
53__attribute__((aligned(4)))
54typedef struct expander_config {
55 uint32_t synaptic_matrix_region;
56 uint32_t master_pop_region;
57 uint32_t bitfield_filter_region;
58 uint32_t structural_region;
60 uint32_t post_slice_start;
61 uint32_t post_slice_count;
64 accum timestep_per_delay;
67 unsigned long accum weight_scales[];
89 void *synaptic_matrix, uint32_t post_slice_start,
90 uint32_t post_slice_count, uint32_t post_index,
91 unsigned long accum *weight_scales, accum timestep_per_delay) {
101 param_generator_t weight_generator =
103 param_generator_t delay_generator =
108 || delay_generator ==
NULL || weight_generator ==
NULL) {
114 config.post_hi, post_index, post_slice_start, post_slice_count,
115 weight_scales[
config.synapse_type], timestep_per_delay,
138 void *params_address) {
141 uint32_t data_size =
sizeof(expander_config_t)
143 expander_config_t *
config = spin1_malloc(data_size);
145 log_info(
"Generating %u edges for %u atoms starting at %u",
149 void *synaptic_matrix = data_specification_get_region(
150 config->synaptic_matrix_region, ds_regions);
170 for (uint32_t edge = 0; edge <
config->n_in_edges; edge++) {
172 &address, synaptic_matrix,
config->post_slice_start,
180 uint32_t *n_atom_data_sdram = address;
181 void *master_pop = data_specification_get_region(
182 config->master_pop_region, ds_regions);
183 void *bitfield_filter = data_specification_get_region(
184 config->bitfield_filter_region, ds_regions);
185 void *structural_matrix =
NULL;
186 if (
config->structural_region != INVALID_REGION_ID) {
187 structural_matrix = data_specification_get_region(
188 config->structural_region, ds_regions);
194 log_info(
"Region %u set to 0 at 0x%08x and 0x%08x",
195 config->bitfield_filter_region,
199 synaptic_matrix, bitfield_filter, structural_matrix);
206 log_info(
"Starting To Build Connectors");
217 void *params_address = data_specification_get_region(user1, ds_regions);
218 log_info(
"\tReading SDRAM at 0x%08x", params_address);
222 log_info(
"!!! Error reading SDRAM data !!!");
226 log_info(
"Finished On Machine Connectors!");
Expands bitfields on SpiNNaker to reduce data transfer times.
static bool do_bitfield_generation(uint32_t *n_atom_data_sdram, void *master_pop, void *synaptic_matrix, void *bitfield_filters, void *structural_matrix)
Entry point.
Utility functions for working with memory.
static void fast_memcpy(void *restrict to, const void *restrict from, size_t num_bytes)
A small and fast version of memcpy().
connection_generator_t connection_generator_init(uint32_t hash, void **in_region)
Initialise a specific connection generator.
bool connection_generator_generate(connection_generator_t generator, uint32_t pre_lo, uint32_t pre_hi, uint32_t post_lo, uint32_t post_hi, uint32_t post_index, uint32_t post_slice_start, uint32_t post_slice_count, unsigned long accum weight_scale, accum timestep_per_delay, param_generator_t weight_generator, param_generator_t delay_generator, matrix_generator_t matrix_generator)
Generate connections with a connection generator.
void connection_generator_free(connection_generator_t generator)
Finish with a connection generator.
The data for a connection generator.
Connection Generator interface.
data_specification_metadata_t * data_specification_get_data_address(void)
void log_info(const char *message,...)
matrix_generator_t matrix_generator_init(uint32_t hash, void **in_region, void *synaptic_matrix)
Initialise a specific matrix generator.
void matrix_generator_free(matrix_generator_t generator)
Finish with a matrix generator.
The data for a matrix generator.
Interface for matrix generation.
static uint32_t n_synapse_types
The number of synapse types.
void param_generator_free(param_generator_t generator)
Finish with a parameter generator.
param_generator_t param_generator_init(uint32_t hash, void **in_region)
Initialise a specific parameter generator.
Interface for parameter generator.
Random number generator interface.
The Random number generator parameters.
void sark_cpu_state(cpu_state state)
void rt_error(uint code,...)
region
spike source array region IDs in human readable form
A region of SDRAM used to transfer synapses.
uint spin1_get_core_id(void)
static bool read_connection_builder_region(void **region, void *synaptic_matrix, uint32_t post_slice_start, uint32_t post_slice_count, uint32_t post_index, unsigned long accum *weight_scales, accum timestep_per_delay)
Generate the synapses for a single connector.
rng_t * core_rng
An RNG that is local to the current core.
void c_main(void)
Entry point.
rng_t * population_rng
An RNG that starts in the same place on every core of the Population.
static bool run_synapse_expander(data_specification_metadata_t *ds_regions, void *params_address)
Read the data for the expander.
The configuration of the connection builder.