49 uint32_t max_delay_per_stage) {
54 log_debug(
"Delay of %u is too small", delay);
59 uint16_t stage = (delay - 1) / max_delay_per_stage;
60 if (stage >= max_stage) {
61 log_debug(
"Delay of %u is too big", delay);
62 stage = max_stage - 1;
63 delay = (stage * max_delay_per_stage);
67 delay = ((delay - 1) % max_delay_per_stage) + 1;
68 return (
struct delay_value) {.delay = delay, .stage = stage};
100 uint32_t max_delayed_row_n_words, uint32_t pre_index, uint32_t delay_stage,
101 uint32_t n_pre_neurons_per_core, uint32_t max_delay_stage, uint32_t n_pre_neurons) {
104 uint32_t remaining_pre_neurons = n_pre_neurons;
105 while (((core + 1) * n_pre_neurons_per_core) < pre_index) {
107 remaining_pre_neurons -= n_pre_neurons_per_core;
111 uint32_t local_pre_index = pre_index - (core * n_pre_neurons_per_core);
115 uint32_t n_neurons_on_core = n_pre_neurons_per_core;
116 if (remaining_pre_neurons < n_pre_neurons_per_core) {
117 n_neurons_on_core = remaining_pre_neurons;
121 uint32_t n_delay_neurons_per_core = n_pre_neurons_per_core * (max_delay_stage - 1);
125 uint32_t delay_core_index = core * n_delay_neurons_per_core;
126 uint32_t delay_local_index = ((delay_stage - 1) * n_neurons_on_core) + local_pre_index;
129 uint32_t pre_row = delay_core_index + delay_local_index;
130 uint32_t idx = pre_row * (max_delayed_row_n_words +
N_HEADER_WORDS);
131 return &delayed_synaptic_matrix[idx];
static struct delay_value get_delay(uint16_t delay_value, uint32_t max_stage, uint32_t max_delay_per_stage)
Get a converted delay value and stage.
static void * get_delay_row(uint32_t *delayed_synaptic_matrix, uint32_t max_delayed_row_n_words, uint32_t pre_index, uint32_t delay_stage, uint32_t n_pre_neurons_per_core, uint32_t max_delay_stage, uint32_t n_pre_neurons)
Get a delayed synaptic row for a given neuron and delay stage.