39 const double& gaussVar,
40 const double& gaussMean
43 double rnd1,rnd2,G,Q,Q1,Q2;
46 rnd1 = ((double)my_rand()) / ((
double)2147483647) ;
47 rnd2 = ((double)my_rand()) / ((
double)2147483647) ;
49 Q1 = 2.0 * rnd1 - 1.0 ;
50 Q2 = 2.0 * rnd2 - 1.0 ;
52 Q = Q1 * Q1 + Q2 * Q2 ;
55 G = gaussMean+sqrt(gaussVar)*(sqrt(-2.0*log(Q)/Q)*Q1);
63 long int seed = 11206341;
64 for(
int i=63; i>=0; i--) {
65 if(seed>=pow(2.,(
double)i)) {
67 seed-=(
long int)pow(2.,(
double)i);
69 else shiftreg[i]=
false;
74 bool zw = (((shiftreg[59]==shiftreg[60])==shiftreg[62])==shiftreg[63]);
75 for(
int i=63; i>0; i--) {
76 shiftreg[i] = shiftreg[i-1];
80 for(
int i=0; i<31; i++) {
81 if(shiftreg[2*i]) val+=pow(2.,(
double)i);
83 return((
int)floor(val));
94 template <
template <
class>
class OIf>
96 const double& gaussVar,
97 const double& gaussMean,
101 auto p =
new gaussian(pName.c_str(), gaussVar, gaussMean);
gaussian * make_gaussian(const std::string &pName, const double &gaussVar, const double &gaussMean, OIf< double > &outS)
Helper function to construct a Gaussian randome wave generator.
Definition: sy_lib.hpp:95
Implements the synchronous Model of Computation.
The namespace for ForSyDe.
Definition: abssemantics.hpp:30
gaussian(sc_module_name name_, const double &gaussVar, const double &gaussMean)
Definition: sy_lib.hpp:38
Process constructor for a source process.
Definition: sy_process_constructors.hpp:1092
Absent-extended data types.
Definition: abst_ext.hpp:32
Process constructor for a Gaussian randome wave generator.
Definition: sy_lib.hpp:35