47 #include <Xyce_config.h>
64 #include <N_ERH_ErrorMgr.h>
68 #include <N_LAS_Matrix.h>
69 #include <N_LAS_Vector.h>
70 #include <N_UTL_FeatureTest.h>
83 .setDescription(
"Maximal Synaptic Conductance");
89 .setDescription(
"Transmission Probability");
95 .setDescription(
"Synaptic weight,initial value");
102 .setDescription(
"Presynaptic voltage spike threhsold");
106 .setDescription(
"Time delay between presynaptic signal and postsynaptic response");
110 .setDescription(
"Maximal Synaptic Conductance");
114 .setDescription(
"Postsynaptic Reversal Potential");
118 .setDescription(
"Rise time constant");
122 .setDescription(
"Decay time constant");
126 .setDescription(
"Voltage threshold for a spike event");
130 .setDescription(
"Resting voltage for resting event");
133 .setDescription(
"Synaptic weight,minimum value");
136 .setDescription(
"Synaptic weight,maximum value");
139 .setDescription(
"Synaptic weight,initial value");
143 .setDescription(
"Rate for Longterm potentiation factor (LPF) based on post-synaptic voltage (rate 1)");
147 .setDescription(
"Rate for Longterm potentiation factor (LPF) based on post-synaptic voltage (rate 2)");
151 .setDescription(
"Rate for Longterm potentiation factor (LPF) based on pre-synaptic voltage (rate 3)");
154 .setDescription(
"Long term depression coefficient");
157 .setDescription(
"Long term potentiation coefficient");
160 .setDescription(
"Transmission Probability");
197 :
DeviceInstance(IB, configuration.getInstanceParameters(), factory_block),
209 #ifdef Xyce_FullSynapseJac
210 APostEquPostNodeOffset(-1),
211 f_PostEquPostNodePtr(0),
213 transmissionProbability(1.0),
214 transmissionFactor(1),
217 randInitialized(false)
228 #ifdef Xyce_FullSynapseJac
290 const std::vector<int> & extLIDVecRef )
295 if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS))
297 Xyce::dout() << std::endl << section_divider << std::endl;
298 Xyce::dout() <<
" SynapseInstance::registerLIDs" << std::endl;
299 Xyce::dout() <<
" name = " <<
getName() << std::endl;
309 if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS) )
311 Xyce::dout() <<
" li_Prev = " <<
li_Prev << std::endl;
312 Xyce::dout() <<
" li_Post = " <<
li_Post << std::endl;
315 if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS) )
317 Xyce::dout() << section_divider << std::endl;
396 #ifdef Xyce_FullSynapseJac
397 APostEquPostNodeOffset = jacLIDVec[1][0];
411 #ifndef Xyce_NONPOINTER_MATRIX_LOAD
412 #ifdef Xyce_FullSynapseJac
414 f_PostEquPostNodePtr = &(dFdx[
li_Post][APostEquPostNodeOffset]);
429 bool bsuccess =
true;
435 double vPre = lastSolVecPtr[
li_Prev];
436 double vPost = lastSolVecPtr[
li_Post];
447 unsigned int aSeed =
static_cast<unsigned int>(time( NULL ) ) ;
508 double Anow = stoVec[
li_A0_store] * exp( - ( time - t0 ) / tau1 );
509 double Bnow = stoVec[
li_B0_store] * exp( - ( time - t0 ) / tau2 );
560 if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS))
562 Xyce::dout() << std::endl << section_divider << std::endl;
563 Xyce::dout() <<
" SynapseInstance::updateIntermediateVars" << std::endl;
564 Xyce::dout() <<
"Anow: " << Anow << std::endl;
565 Xyce::dout() <<
"Bnow: " << Bnow << std::endl;
579 didVpost = synapticWeight * (Bnow - Anow);
581 if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS))
583 Xyce::dout() << std::endl << section_divider << std::endl;
584 Xyce::dout() <<
"vPost: " << vPost << std::endl;
585 Xyce::dout() <<
"eRev: " << eRev << std::endl;
586 Xyce::dout() <<
"weight: " << synapticWeight << std::endl;
588 Xyce::dout() <<
"ipost: " <<
ipost << std::endl;
589 Xyce::dout() <<
"didVpost: " <<
didVpost << std::endl;
718 #ifdef Xyce_FullSynapseJac
738 bool bsuccess =
true;
756 double deltaAB = factor*
gMax;
761 double Anow = stoVec[
li_A0_store] * exp( - ( time - t0 ) / tau1 );
762 double Bnow = stoVec[
li_B0_store] * exp( - ( time - t0 ) / tau2 );
773 if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS))
775 Xyce::dout() << std::endl << section_divider << std::endl;
776 Xyce::dout() <<
" SynapseInstance::outputPlotFiles" << std::endl;
778 Xyce::dout() <<
"weight in store: " << stoVec[
li_weight_store] << std::endl;
795 bool bsuccess =
true;
831 std::vector<Instance*>::iterator iter;
835 for (iter=first; iter!=last; ++iter)
837 (*iter)->processParams();
855 :
DeviceModel(MB, configuration.getModelParameters(), factory_block),
889 std::vector<Instance*>::iterator iter;
893 for (iter=first; iter!=last; ++iter)
909 std::vector<Instance*>::const_iterator iter;
916 os <<
"Number of Synapse3 Instances: " << isize << std::endl;
917 os <<
" name model name Parameters" << std::endl;
918 for (i=0, iter=first; iter!=last; ++iter, ++i)
920 os <<
" " << i <<
": " << (*iter)->getName() <<
"\t";
945 for (std::vector<Instance *>::const_iterator it = instanceContainer.begin(); it != instanceContainer.end(); ++it)
959 .registerDevice(
"synapse", 3)
960 .registerModelType(
"synapse", 3);
const InstanceName & getName() const
bool updateDependentParameters()
const std::vector< std::vector< int > > & jacobianStamp() const
const SolverState & solverState_
Descriptor & addPar(const char *parName, T default_value, T U::*varPtr)
Adds the parameter description to the parameter map.
static void loadModelParameters(ParametricData< Model > &model_parameters)
bool updateSecondaryState()
double transmissionProbability
Instance(const Configuration &configuration, const InstanceBlock &IB, Model &Riter, const FactoryBlock &factory_block)
Pure virtual class to augment a linear system.
void setNumStoreVars(int num_store_vars)
double getRandomPerturbation()
void registerStoreLIDs(const std::vector< int > &storeLIDVecRef)
virtual void registerJacLIDs(const JacobianStamp &jacLIDVec)
static Device * factory(const Configuration &configuration, const FactoryBlock &factory_block)
void registerJacLIDs(const std::vector< std::vector< int > > &jacLIDVec)
int getNumStoreVars() const
int SetSeed(unsigned int seedIn)
std::vector< Param > params
Parameters from the line.
void setParams(const std::vector< Param > ¶ms)
const std::string & getName() const
The FactoryBlock contains parameters needed by the device, instance and model creation functions...
const DeviceOptions & getDeviceOptions() const
double * nextStoVectorRawPtr
virtual void forEachInstance(DeviceInstanceOp &op) const
Apply a device instance "op" to all instances associated with this model.
const DeviceOptions & deviceOptions_
static Config< T > & addConfiguration()
Adds the device to the Xyce device configuration.
Linear::Matrix * dFdxMatrixPtr
bool updateIntermediateVars()
std::vector< Instance * > instanceContainer
The Device class is an interface for device implementations.
void addStoreNode(Util::SymbolTable &symbol_table, int index, const InstanceName &instance_name, const std::string &lead_name)
bool processInstanceParams()
processInstanceParams
bool transmissionProbabilityValueGiven
void loadNodeSymbols(Util::SymbolTable &symbol_table) const
Populates and returns the store name map.
Class Configuration contains device configuration data.
bool updateTemperature(const double &temp_tmp)
static void loadInstanceParameters(ParametricData< Instance > &instance_parameters)
double transmissionProbability
const SolverState & getSolverState() const
bool updatePrimaryState()
bool processParams()
processParams
static std::vector< std::vector< int > > jacStamp
Linear::Vector * daeFVectorPtr
virtual std::ostream & printOutInstances(std::ostream &os) const
void registerLIDs(const std::vector< int > &intLIDVecRef, const std::vector< int > &extLIDVecRef)
const ExternData & extData
double synapticWeightUpdate
ModelBlock represents a .MODEL line from the netlist.
Manages parameter binding for class C.
InstanceBlock represent a device instance line from the netlist.
std::vector< Param > params
double * lastSolVectorRawPtr
double * lastStoVectorRawPtr
void setModParams(const std::vector< Param > ¶ms)
int numLeadCurrentStoreVars