59 obj->
params = *params_sdram;
60 *
region = ¶ms_sdram[1];
62 log_debug(
"Fixed Number Post Connector, allow self connections = %u, "
63 "with replacement = %u, n_post = %u",
86 return (u01 * range) >> 15;
89static bool fixed_post_write(uint32_t pre, uint32_t post, accum weight_scale,
90 accum timestep_per_delay, param_generator_t weight_generator,
119 void *generator, uint32_t pre_lo, uint32_t pre_hi,
120 uint32_t post_lo, uint32_t post_hi, UNUSED uint32_t post_index,
121 uint32_t post_slice_start, uint32_t post_slice_count,
122 unsigned long accum weight_scale, accum timestep_per_delay,
123 param_generator_t weight_generator, param_generator_t delay_generator,
127 uint32_t post_slice_end = post_slice_start + post_slice_count;
131 uint32_t n_values = post_hi - post_lo + 1;
137 for (uint32_t pre = pre_lo; pre <= pre_hi; pre++) {
140 for (uint32_t j = 0; j < n_conns; j++) {
146 if (post >= post_slice_start && post < post_slice_end) {
147 post -= post_slice_start;
148 if (!fixed_post_write(pre, post, weight_scale, timestep_per_delay,
150 log_error(
"Matrix not sized correctly!");
157 uint16_t values[n_conns];
158 uint32_t replace_start = n_conns;
159 for (uint32_t j = 0; j < n_conns; j++) {
162 replace_start = n_conns + 1;
164 values[j] = j + post_lo;
167 for (uint32_t j = replace_start; j < n_values; j++) {
173 values[r] = j + post_lo;
177 for (uint32_t j = 0; j < n_conns; j++) {
178 if (values[j] >= post_slice_start && values[j] < post_slice_end) {
179 uint32_t post = values[j] - post_slice_start;
180 if (!fixed_post_write(pre, post, weight_scale, timestep_per_delay,
182 log_error(
"Matrix not sized correctly!");
static uint32_t post_random_in_range(rng_t *rng, uint32_t range)
Generates a uniformly-distributed random number.
static void * connection_generator_fixed_post_initialise(void **region)
Initialise the fixed-post connection generator.
static bool connection_generator_fixed_post_generate(void *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 the fixed-post connection generator.
struct fixed_post_params params
Parameters read from SDRAM.
uint32_t allow_self_connections
Do we allow self connections?
uint32_t with_replacement
Do we allow any neuron to be multiply connected by this connector?
static void connection_generator_fixed_post_free(void *generator)
Free the fixed-post connection generator.
uint32_t n_post
Number of connections per pre-neuron in total.
The state of this connection generator.
The parameters that can be copied from SDRAM.
void log_error(const char *message,...)
void log_debug(const char *message,...)
static uint16_t rescale_delay(accum delay, accum timestep_per_delay)
Rescales a delay to account for timesteps and type-converts it.
bool matrix_generator_write_synapse(matrix_generator_t generator, uint32_t pre_index, uint16_t post_index, accum weight, uint16_t delay, unsigned long accum weight_scale)
Write a synapse with a matrix generator.
The data for a matrix generator.
rng_t * population_rng
An RNG that starts in the same place on every core of the Population.
accum param_generator_generate(param_generator_t generator)
Generate value with a parameter generator.
uint32_t rng_generator(rng_t *rng)
Generate a uniformly-distributed random number.
Random number generator interface.
The Random number generator parameters.
void sark_free(void *ptr)
region
spike source array region IDs in human readable form
static uint32_t rng(void)
Random number generation for the Poisson sources. This is a local version for speed of operation.