sPyNNaker neural_modelling 7.2.2
Loading...
Searching...
No Matches
weight_additive_two_term_impl.c
Go to the documentation of this file.
1/*
2 * Copyright (c) 2015 The University of Manchester
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * https://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
20
21//---------------------------------------
22// Globals
23//---------------------------------------
26
28uint32_t *weight_shift;
29
32typedef struct {
33 accum min_weight;
34 accum max_weight;
35 accum a2_plus;
36 accum a2_minus;
37 accum a3_plus;
38 accum a3_minus;
40
41//---------------------------------------
42// Functions
43//---------------------------------------
45 address_t address, uint32_t n_synapse_types,
46 UNUSED uint32_t *ring_buffer_to_input_buffer_left_shifts) {
47 // Copy plasticity region data from address
48 // **NOTE** this seems somewhat safer than relying on sizeof
50
51 struct plasticity_weight_region_data_two_term_t *dtcm_copy =
52 plasticity_weight_region_data = spin1_malloc(
53 sizeof(struct plasticity_weight_region_data_two_term_t) *
55 if (dtcm_copy == NULL) {
56 log_error("Could not initialise weight region data");
57 return NULL;
58 }
59
60 weight_shift = spin1_malloc(sizeof(uint32_t) * n_synapse_types);
61 if (weight_shift == NULL) {
62 log_error("Could not initialise weight region data");
63 return NULL;
64 }
65
66 for (uint32_t s = 0; s < n_synapse_types; s++, config++) {
67 dtcm_copy[s].min_weight = config->min_weight;
68 dtcm_copy[s].max_weight = config->max_weight;
69 dtcm_copy[s].a2_plus = config->a2_plus;
70 dtcm_copy[s].a2_minus = config->a2_minus;
71 dtcm_copy[s].a3_plus = config->a3_plus;
72 dtcm_copy[s].a3_minus = config->a3_minus;
73
74 // Copy weight shift
75 weight_shift[s] = ring_buffer_to_input_buffer_left_shifts[s];
76
77 log_debug("\tSynapse type %u: Min weight:%d, Max weight:%d, A2+:%d, A2-:%d,"
78 " A3+:%d, A3-:%d",
79 s, dtcm_copy[s].min_weight, dtcm_copy[s].max_weight,
80 dtcm_copy[s].a2_plus, dtcm_copy[s].a2_minus,
81 dtcm_copy[s].a3_plus, dtcm_copy[s].a3_minus);
82 }
83
84 // Return end address of region
85 return (address_t) config;
86}
uint32_t * address_t
void log_error(const char *message,...)
void log_debug(const char *message,...)
static uint32_t n_synapse_types
The number of synapse types.
Definition neuron.c:51
#define NULL
address_t weight_initialise(address_t address, uint32_t n_synapse_types, uint32_t *ring_buffer_to_input_buffer_left_shifts)
Initialises the weight aspect of an STDP rule.
uint32_t * weight_shift
Plasticity multiply shift array, in DTCM.
plasticity_weight_region_data_t * plasticity_weight_region_data
Global plasticity parameter data.
How the configuration data for additive_two_term is laid out in SDRAM. The layout is an array of thes...
Additive dual-term weight dependence rule.