sPyNNaker neural_modelling  development
weight_multiplicative_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 
28 uint32_t *weight_shift;
29 
32 typedef struct {
33  accum min_weight;
34  accum max_weight;
35  accum a2_plus;
36  accum a2_minus;
38 
39 //---------------------------------------
40 // Functions
41 //---------------------------------------
43  address_t address, uint32_t n_synapse_types,
44  uint32_t *ring_buffer_to_input_buffer_left_shifts) {
45  // Copy plasticity region data from address
46  // **NOTE** this seems somewhat safer than relying on sizeof
48  spin1_malloc(sizeof(plasticity_weight_region_data_t) * n_synapse_types);
49  if (dtcm_copy == NULL) {
50  log_error("Could not initialise weight region data");
51  return NULL;
52  }
53  weight_shift = spin1_malloc(sizeof(uint32_t) * n_synapse_types);
54  if (weight_shift == NULL) {
55  log_error("Could not initialise weight region data");
56  return NULL;
57  }
58 
60  for (uint32_t s = 0; s < n_synapse_types; s++, config++) {
61  // Copy parameters
62  dtcm_copy[s].min_weight = config->min_weight;
63  dtcm_copy[s].max_weight = config->max_weight;
64  dtcm_copy[s].a2_plus = config->a2_plus;
65  dtcm_copy[s].a2_minus = config->a2_minus;
66 
67  // Copy weight shift
68  weight_shift[s] = ring_buffer_to_input_buffer_left_shifts[s];
69 
70  log_debug("\tSynapse type %u: Min weight:%d, Max weight:%d, A2+:%d, A2-:%d,"
71  " Weight multiply right shift:%u",
72  s, dtcm_copy[s].min_weight, dtcm_copy[s].max_weight,
73  dtcm_copy[s].a2_plus, dtcm_copy[s].a2_minus, weight_shift[s]);
74  }
75 
76  // Return end address of region
77  return (address_t) config;
78 }
static struct local_only_config config
A local copy of the configuration.
Definition: local_only.c:43
static uint32_t n_synapse_types
The number of synapse types.
Definition: neuron.c:51
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 array, in DTCM.
How the configuration data for multiplicative is laid out in SDRAM. The layout is an array of these.
Multiplicative single-term weight dependence rule.
accum a2_plus
Scaling factor for weight delta on potentiation.
accum a2_minus
Scaling factor for weight delta on depression.