Skip to content

Commit

Permalink
Add round-to-nearest multiplies back in neuron components
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewgait committed Aug 11, 2023
1 parent 0161cb0 commit 9d0022f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
10 changes: 5 additions & 5 deletions neural_modelling/src/neuron/input_types/input_type_conductance.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#define _INPUT_TYPE_CONDUCTANCE_H_

#include "input_type.h"
//#include "round.h"
#include "round.h"

//! Conductance input parameters
struct input_type_params_t {
Expand Down Expand Up @@ -76,11 +76,11 @@ static inline void input_type_convert_excitatory_input_to_current(
state_t membrane_voltage) {
for (int i=0; i < NUM_EXCITATORY_RECEPTORS; i++) {
// accum = accum * (accum - accum)
exc_input[i] = exc_input[i] *
(input_type->V_rev_E - membrane_voltage);
// exc_input[i] = exc_input[i] *
// (input_type->V_rev_E - membrane_voltage);
// RTN accum
// exc_input[i] = MULT_ROUND_NEAREST_ACCUM(exc_input[i],
// (input_type->V_rev_E - membrane_voltage));
exc_input[i] = MULT_ROUND_NEAREST_ACCUM(exc_input[i],
(input_type->V_rev_E - membrane_voltage));
}
}

Expand Down
20 changes: 11 additions & 9 deletions neural_modelling/src/neuron/synapse_types/exp_synapse_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#include <stdfix-exp.h>
#include <neuron/decay.h>
//#include "round.h"
#include "round.h"

//! The type of exponential decay parameters
typedef struct exp_params_t {
Expand Down Expand Up @@ -60,20 +60,22 @@ static inline void decay_and_init(exp_state_t *state, exp_params_t *params,
//! \param[in,out] exp_param: The parameter to shape
static inline void exp_shaping(exp_state_t *exp_param) {
// decay value according to decay constant
exp_param->synaptic_input_value =
decay_s1615(exp_param->synaptic_input_value, exp_param->decay);
// exp_param->synaptic_input_value =
// MULT_ROUND_NEAREST_ACCUM(exp_param->synaptic_input_value,
// exp_param->decay);
// exp_param->synaptic_input_value =
// decay_s1615(exp_param->synaptic_input_value, exp_param->decay);
// RTN testing
exp_param->synaptic_input_value =
MULT_ROUND_NEAREST_ACCUM(exp_param->synaptic_input_value,
exp_param->decay);
}

//! \brief helper function to add input for a given timer period to a given
//! neuron
//! \param[in,out] parameter: the parameter to update
//! \param[in] input: the input to add.
static inline void add_input_exp(exp_state_t *parameter, input_t input) {
parameter->synaptic_input_value = parameter->synaptic_input_value +
decay_s1615(input, parameter->init);
// parameter->synaptic_input_value = parameter->synaptic_input_value +
// MULT_ROUND_NEAREST_ACCUM(input, parameter->init);
// decay_s1615(input, parameter->init);
// RTN testing
parameter->synaptic_input_value = parameter->synaptic_input_value +
MULT_ROUND_NEAREST_ACCUM(input, parameter->init);
}

0 comments on commit 9d0022f

Please sign in to comment.