Please, help us to better know about our user community by answering the following short survey: https://forms.gle/wpyrxWi18ox9Z5ae9
AbstractNeurer.h
Go to the documentation of this file.
1 
10 #ifndef AbstractNeurer_h
11 #define AbstractNeurer_h
12 
18 #include "Project.h"
19 #include "scGridPoint.h"
20 #include "NeurerConfig.h"
21 
22 using namespace sc_core; using namespace std;
23 //#include "AbstractNeurerConnection.h"
25 
26 typedef vector <scSynapticConnect*> scSynapticConnects_t;
27 typedef vector <scAxonalConnect*> scAxonalConnects_t;
28 
29 class NeurerProcessor;
30 class Spike;
31 class QSettings;
32 
36 typedef enum
37 {
41  nsb_Discharging,
45 
46 
69 class AbstractNeurer : public scHThread
70 {
71  friend class scSynapticConnect;
72 // friend class AbstractNeurerState;
73  public:
74  // Constructor declaration:
75  AbstractNeurer(const sc_core::sc_module_name nm, // Just the systemC name
76 // NeurerProcessor* Processor, // The present system is prepared for one topology only, but ...
77  scGridPoint* GP, SC_HTHREAD_ID_TYPE ID,
78  bool StandAlone = true
79  );
80  ~AbstractNeurer(void);
81  SC_HAS_PROCESS(AbstractNeurer); // We have the constructor in the .cpp file
82  // Directly HW-related functionality
83  void
84  Initialize_method(void);
85  /* void
86  CreateNeurons(void);*/
87  void
88  Reset(void);
89  bool
90  IsMetaInstructionFetched(void)
91  {assert(0);//return fetch.Stage.hi0 == (itype_t) I_QT;
92  return false;
93  }
94  bool
95  doFetchInstruction(void//SC_WORD_TYPE Instr
96  ) // The actual fetching; does not generate an event
97 {assert(0); return false;
98  }
99  bool
100  doExecuteInstruction(void){assert(0); return false;}
101  void
102  doExecuteMetaInstruction()
103  {assert(0);
104  }
106  Processor_Get(void);
107 
108  void
109  doQTERM(void)
110  {assert(0); }
111  bool
112  IsMetaInstructionReceived(void)
113  {assert(0); return false;}
114  string
115  StringOfName_Get(void){ return Owner_Get()->StringOfName_Get(ID_Get());}
116  string
117  PrologString_Get(void);
118  scGridPoint*
119  Parent_Get(void) { return dynamic_cast<scGridPoint*>(scHThread::Parent_Get());}
121  AxonalConnection_Get(unsigned int i)
122  { assert(i<m_Axons.size());
123  return m_Axons[i];
124  }
126  SynapticConnection_Get(unsigned int i)
127  { assert(i<m_Synapses.size());
128  return m_Synapses[i];
129  }
130  void
131  ConnectTo(AbstractNeurer* A);
132  void
133  ConnectFrom(scSynapticConnect* A);
135  FindSynapseFrom(AbstractNeurer* A);
137  FindAxonTo(AbstractNeurer* A); // Return axonal connect to A, or NULL
138 
139  struct{
140  sc_core::sc_event
142  Reset
143  ,Trigger
144  ,Charge
145  ,Discharge
146  , Leaking
147  ,Spiking
148  ,Recalculate
149  ;
150  }EVENT_NEURER;
151  void
152  Integrate_method(void);
153  void
154  LeakingPeriod_Set(short unsigned int P);
155  short unsigned int
156  LeakingPeriod_Get(void){ return mLeakingPeriod;}
157  void
158  SynchronFrequency_Set(sc_core::sc_event* F){ mSynchronFrequency = F;
159  mSynchronFrequency->notify();
160  }
164  void
165  Reset_method(void); //Puts the neurer in its initial state
166  void
167  ActionPotential_method(void);
168  void
169  Trigger_method(void); // Puts the neurer in synaptic-aware more
170  void
171  Charge_method(void); // Accumulates charge on the membrane, synaptic-unaware
172  void
173  Discharge_method(void); // Sends the spike to the axon
183  int
184  IntegratedCurrentInPeriod(int FromTime, int ToTime,
185  int FromValue, int ToValue)
186  { assert(FromTime<ToTime);
187  int Average = (FromValue + ToValue)/2;
188  float TimeDiff = ToTime - FromTime;
189  return TimeDiff*Average;
190  }
198  int
200  {
201  return mNoOfSynapticPoints// The number of synaptic points
202  * 10 // Synaptic area, u^2
203  * .01 // The capacity of a single synapsis, a neuronal condensator
204  * THOUSAND; //The result is in pF
205  }
211  void
213  {
214  mRunningCharge += C
215  // /NeurerCondensatorCapacity_Get()
216  ; // Add the actual contribution
217  // it is in uV*usec == 10^{-12}F == 10^{-3}pC
218  }
219  int64_t
220  RunningCharge_Get(){ return mRunningCharge;}
221  void
222  AddChargeContribution(int32_t C);
226  void Spiking_method(void);
227  int32_t AxonsNo_Get(void)
228  {return m_Axons.size();}
229  int32_t SynapsesNo_Get(void)
230  { return m_Synapses.size();}
231  void
232  ReadSettings(string Group, QSettings* settings);
233 // void setState(AbstractNeurer AN, AbstractNeurerState S);
234 //#if BIOLOGICAL_NEURON
235  int32_t
236  MembraneRestingPotential_Get()
237  {
238  return mMembraneRestingPotential;
239  }
240  int32_t
241  MembraneRestingPotential_Set(int32_t NewPot)
242  {
243  mMembraneRestingPotential = NewPot;
244  }
245  int32_t
246  MembranePotentialOffset_Get()
247  {
248 
249  }
256  void
257  MembranePotentialContribution_Add(int32_t NewContrib);
263  bool
264  MembraneSynapticContribution_Add(int32_t NewContrib);
265 //#endif //BIOLOGICAL_NEURON
272  void
274  {
275  assert(B < gob_Max);
276  if(B==nsb_Resting) mOperatingState = 0; // Clear all other bits if resting
277  mOperatingState[B] = V;
278  }
284  bool
286  { assert(B < gob_Max);
287  return mOperatingState[B];
288  }
289 
290 protected:
291 
292  std::bitset<nsb_Max>
294 // AbstractNeurerState *mState; //!< Stores the actual working state
295  void
296  State_Set();
297 /* void /// Make the actual inspection; overwritten in subclasses
298  doInspect(vector<int32_t>& in, vector<int32_t>& out);*/
299  void Leaking_method(void);
300  void Recalculate_method(void);
301 
302  scAxonalConnects_t
304 // vector <SynapticConnect_t>
305  scSynapticConnects_t
307  void
308  AxonalConnectionAdd_To(AbstractNeurer* AC);
309  void
310  Fire(void);
311  short unsigned int
312  mLeakingPeriod;
313  void
314  Resynchronize_method(void);
315  sc_core::sc_time
316  LocalTime_Get(void);
317  sc_core::sc_event*
319  sc_core::sc_time
321  int
323  int64_t // Where the calculation of charge contributions is summed
324  mRunningCharge;
325  // Floating points have a default -1 … 1 range, but can take any integral limits
326 // typedef saturating::type<float, -10, 200> ActionPotential_t;
327  // saturating::type<float, -10, 200>
328  int32_t
330  int32_t
333  mActionPotential;
334  Spike*
335  mSpike;
336  int
338  int
340  int
342  uint16_t
343  mTimeFactor, mAmplitudeFactor;
344  // Fix beginning of current action potential to current simuated time
345  sc_core::sc_time
346  ActionTime_Get(); // Return current time relative to zje beginnin gof the action potential
347  void
348  ActionPotentialTimeBegin_Set(void);
349  sc_core::sc_time
350  mActionPotentialStartAtMembrane1, mActionPotentialStartAtMembrane2;
351 #if BIOLOGICAL_NEURON
352  // #if !USE_INDIVIDUAL_RESTING_POTENTIAL
353  // static int
354  // #endif // USE_INDIVIDUAL_RESTING_POTENTIAL
355  int32_t
356  mMembraneRestingPotential;
357 #endif //
358  //Just working variables, cross-action potential phases
359  bool // Remember if the last time, the membrane was within tolerance
360  mBelowThresholdPreviously,
361  mNearRestingPreviously;
362  sc_core::sc_time
364 }; // of AbstractNeurer
366 #endif // AbstractNeurer_h
367 
nsb_Triggering
@ nsb_Triggering
Set if neurer is attempting to reach membrane's threshold.
Definition: AbstractNeurer.h:39
AbstractNeurer::m_Synapses
scSynapticConnects_t m_Synapses
List of neurons where our synapses receive input.
Definition: AbstractNeurer.h:306
scSynapticConnect::Fire
sc_core::sc_event Fire
< The synapsis wanna send a message to the postsynaptic neuron
Definition: AbstractNeurerConnection.h:66
scSynapticConnect::mSpike
Spike * mSpike
Pointer to the spike table.
Definition: AbstractNeurerConnection.h:75
gob_Max
@ gob_Max
!< Set if the gridpoint is receiving a message
Definition: scGridEnumTypes.h:48
scAxonalConnect
Handles the axonal output to a synapsis of a remote neuron. Handles the output broken-line spike.
Definition: AbstractNeurerConnection.h:88
AbstractNeurer::mSpikeAmplitude
int mSpikeAmplitude
Our shadow amplitude about spiking.
Definition: AbstractNeurer.h:339
AbstractNeurer::m_Axons
scAxonalConnects_t m_Axons
List of neurons where our axons lead to.
Definition: AbstractNeurer.h:303
scGridPoint.h
Function prototypes for the scEMPA simulator, Core.
nsb_Firing
@ nsb_Firing
Set if neurer' membrane is in course of discharging.
Definition: AbstractNeurer.h:42
scHThread
The scHThread class.
Definition: scHThread.h:138
AbstractNeurer::mAmplitudeFactor
uint16_t mAmplitudeFactor
Scale factors for the spike table.
Definition: AbstractNeurer.h:343
AbstractNeurer::NeurerStateBit_Set
void NeurerStateBit_Set(NeurerOperatingBit_t B, bool V)
Set a bit in the state word AbstractNeurer::mOperatingState.
Definition: AbstractNeurer.h:273
scGridPoint
This class implements the autonomous grid point functionality: it is a communicating GridPoint....
Definition: scGridPoint.h:127
AbstractNeurer::mSpikeIndex
int mSpikeIndex
The running index of the broken line.
Definition: AbstractNeurer.h:341
AbstractNeurer::mSynchronOffset
sc_core::sc_time mSynchronOffset
Contains the time of the last synchronization event.
Definition: AbstractNeurer.h:320
AbstractNeurer::NeurerStateBit_Get
bool NeurerStateBit_Get(NeurerOperatingBit_t B)
Get value of a bit in the state word AbstractNeurer::mOperatingState.
Definition: AbstractNeurer.h:285
nsb_Charging
@ nsb_Charging
Set if neurer is charging up its membrane to prepare firing.
Definition: AbstractNeurer.h:40
AbstractNeurer::NeurerCondensatorCapacity_Get
int NeurerCondensatorCapacity_Get(void)
NeurerCondensatorCapacity_Get.
Definition: AbstractNeurer.h:199
AbstractNeurer::mSpikeTime
int mSpikeTime
Our shadow time about spiking.
Definition: AbstractNeurer.h:337
AbstractNeurer::mMembranePotential
int32_t mMembranePotential
< The actual, measurable potential
Definition: AbstractNeurer.h:329
AbstractNeurer::IntegratedCurrentInPeriod
int IntegratedCurrentInPeriod(int FromTime, int ToTime, int FromValue, int ToValue)
IntegratedCurrentInPeriod A simple trapezoidal area (for short period, where the function is nearly l...
Definition: AbstractNeurer.h:184
AbstractNeurer::IncreaseActionPotentialWithCharge
void IncreaseActionPotentialWithCharge(int C)
IncreaseActionPotentialWithCharge.
Definition: AbstractNeurer.h:212
AbstractNeurer::mNoOfSynapticPoints
int mNoOfSynapticPoints
Calculated runtime, actually as m_Synapses.size()
Definition: AbstractNeurer.h:322
NeurerOperatingBit_t
NeurerOperatingBit_t
the names of the bits in the bitset for operating the neurer
Definition: AbstractNeurer.h:36
ActionPotential
Handles action potential tables for the neurons.
Definition: ActionPotential.h:79
AbstractNeurer::mSynchronFrequency
sc_core::sc_event * mSynchronFrequency
Contains which event resets the phase timing.
Definition: AbstractNeurer.h:318
scSynapticConnect
Handles input from an axon of a remote neuron, firing to this synapsis. Handles the input broken-line...
Definition: AbstractNeurerConnection.h:37
NeurerConfig.h
Topology information for the Neurer simulator.
Spike
Handles spike tables for the neurons.
Definition: Spike.h:66
AbstractNeurer::mMembranePotentialOffset
int32_t mMembranePotentialOffset
< The actual, measurable potential offset, applied externally
Definition: AbstractNeurer.h:331
AbstractNeurer
Definition: AbstractNeurer.h:69
AbstractNeurer::mActionPotentialBegin
sc_core::sc_time mActionPotentialBegin
< Remember the beginning of the actual action potential
Definition: AbstractNeurer.h:363
nsb_Resting
@ nsb_Resting
Set if neurer is resting.
Definition: AbstractNeurer.h:38
NeurerProcessor
The NeurerProcessor class.
Definition: NeurerProcessor.h:33
AbstractNeurer::mOperatingState
std::bitset< nsb_Max > mOperatingState
The word of operating bits.
Definition: AbstractNeurer.h:293
nsb_Max
@ nsb_Max
Set if neurer' membrane is in course of firing.
Definition: AbstractNeurer.h:43