30 uint32_t allow_self_connections;
31 uint32_t with_replacement;
51 return (u01 * range) >> 15;
66 obj->params = *params_sdram;
67 *
region = ¶ms_sdram[1];
69 log_debug(
"Fixed Number Pre Connector parameters: "
70 "allow self connections = %u, "
71 "with replacement = %u, n_pre = %u",
72 obj->params.allow_self_connections,
73 obj->params.with_replacement, obj->params.n_pre);
106 void *generator, uint32_t pre_lo, uint32_t pre_hi,
107 uint32_t post_lo, uint32_t post_hi, UNUSED uint32_t post_index,
108 uint32_t post_slice_start, uint32_t post_slice_count,
109 unsigned long accum weight_scale, accum timestep_per_delay,
110 param_generator_t weight_generator, param_generator_t delay_generator,
113 uint32_t post_start = max(post_slice_start, post_lo);
114 uint32_t post_end =
min(post_slice_start + post_slice_count - 1, post_hi);
118 uint32_t n_values = pre_hi - pre_lo + 1;
120 uint32_t n_conns = obj->params.n_pre;
124 for (uint32_t post = post_start; post <= post_end; post++) {
125 uint32_t local_post = post - post_slice_start;
126 if (obj->params.with_replacement) {
128 for (uint32_t j = 0; j < n_conns; j++) {
133 bool written =
false;
134 uint32_t n_retries = 0;
137 if (obj->params.allow_self_connections || pre != post) {
143 }
while (!written && n_retries < 10);
145 log_error(
"Couldn't find a row to write to!");
151 uint16_t values[n_conns];
152 uint32_t replace_start = n_conns;
153 for (uint32_t j = 0; j < n_conns; j++) {
154 if (j == post && !obj->params.allow_self_connections) {
156 replace_start = n_conns + 1;
158 values[j] = j + pre_lo;
161 for (uint32_t j = replace_start; j < n_values; j++) {
164 if (j != post || obj->params.allow_self_connections) {
167 values[r] = j + pre_lo;
171 for (uint32_t j = 0; j < n_conns; j++) {
177 local_post, weight, delay, weight_scale)) {
static void * connection_generator_fixed_pre_initialise(void **region)
Initialise the fixed-pre connection generator.
bool connection_generator_fixed_pre_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-pre connection generator.
static uint32_t pre_random_in_range(rng_t *rng, uint32_t range)
Generates a uniformly-distributed random number.
void connection_generator_fixed_pre_free(void *generator)
Free the fixed-pre connection generator.
The data to be passed around.
The parameters that can be copied from SDRAM.
void log_error(const char *message,...)
void log_warning(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 * core_rng
An RNG that is local to the current core.
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.
static stdp_params params
Configuration parameters.