|
|
@ -62,7 +62,6 @@ NevalSrc(double* noise, double* lnNoise, CKTcircuit* ckt, int type, int node1, i |
|
|
case N_GAIN: |
|
|
case N_GAIN: |
|
|
inoise = 0.0; |
|
|
inoise = 0.0; |
|
|
*noise = cmodu(csubco(ckt->CKTadjointRHS->d[0][node1], ckt->CKTadjointRHS->d[0][node2])); |
|
|
*noise = cmodu(csubco(ckt->CKTadjointRHS->d[0][node1], ckt->CKTadjointRHS->d[0][node2])); |
|
|
|
|
|
|
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
@ -92,8 +91,8 @@ NevalSrc(double* noise, double* lnNoise, CKTcircuit* ckt, int type, int node1, i |
|
|
|
|
|
|
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
double realVal; |
|
|
double realVal; |
|
|
double imagVal; |
|
|
double imagVal; |
|
|
double gain; |
|
|
double gain; |
|
|
@ -180,7 +179,6 @@ NevalSrc2( |
|
|
|
|
|
|
|
|
case THERMNOISE: |
|
|
case THERMNOISE: |
|
|
knoise = 4 * CONSTboltz * ckt->CKTtemp; /* param is the conductance of a resistor */ |
|
|
knoise = 4 * CONSTboltz * ckt->CKTtemp; /* param is the conductance of a resistor */ |
|
|
// For this simulation we are not collecting any statistics on output nodes. Force noise to 0 |
|
|
|
|
|
*noise = knoise; |
|
|
*noise = knoise; |
|
|
*lnNoise = log(MAX(*noise, N_MINLOG)); |
|
|
*lnNoise = log(MAX(*noise, N_MINLOG)); |
|
|
break; |
|
|
break; |
|
|
@ -216,7 +214,6 @@ NevalSrc2( |
|
|
iNoise->d[0][d] = in; |
|
|
iNoise->d[0][d] = in; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int d = 0; d < ckt->CKTportCount; d++) |
|
|
for (int d = 0; d < ckt->CKTportCount; d++) |
|
|
for (int s = 0; s < ckt->CKTportCount; s++) |
|
|
for (int s = 0; s < ckt->CKTportCount; s++) |
|
|
ckt->CKTNoiseCYmat->d[d][s] = caddco(ckt->CKTNoiseCYmat->d[d][s], cmultco(iNoise->d[0][d], conju(iNoise->d[0][s]))); |
|
|
ckt->CKTNoiseCYmat->d[d][s] = caddco(ckt->CKTNoiseCYmat->d[d][s], cmultco(iNoise->d[0][d], conju(iNoise->d[0][s]))); |
|
|
@ -225,7 +222,6 @@ NevalSrc2( |
|
|
} |
|
|
} |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
realVal1 = ckt->CKTrhs[node1] - ckt->CKTrhs[node2]; |
|
|
realVal1 = ckt->CKTrhs[node1] - ckt->CKTrhs[node2]; |
|
|
imagVal1 = ckt->CKTirhs[node1] - ckt->CKTirhs[node2]; |
|
|
imagVal1 = ckt->CKTirhs[node1] - ckt->CKTirhs[node2]; |
|
|
realVal2 = ckt->CKTrhs[node3] - ckt->CKTrhs[node4]; |
|
|
realVal2 = ckt->CKTrhs[node3] - ckt->CKTrhs[node4]; |
|
|
@ -270,10 +266,7 @@ NevalSrcInstanceTemp(double* noise, double* lnNoise, CKTcircuit* ckt, int type, |
|
|
int node1, int node2, double param, double param2) |
|
|
int node1, int node2, double param, double param2) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef RFSPICE |
|
|
#ifdef RFSPICE |
|
|
// For this simulation we are not collecting any statistics on output nodes. Force noise to 0 |
|
|
|
|
|
|
|
|
|
|
|
if (ckt->CKTcurrentAnalysis & DOING_SP) |
|
|
if (ckt->CKTcurrentAnalysis & DOING_SP) |
|
|
{ |
|
|
{ |
|
|
double inoise = 0.0; |
|
|
double inoise = 0.0; |
|
|
@ -282,14 +275,12 @@ NevalSrcInstanceTemp(double* noise, double* lnNoise, CKTcircuit* ckt, int type, |
|
|
|
|
|
|
|
|
case SHOTNOISE: |
|
|
case SHOTNOISE: |
|
|
inoise = 2 * CHARGE * fabs(param); /* param is the dc current in a semiconductor */ |
|
|
inoise = 2 * CHARGE * fabs(param); /* param is the dc current in a semiconductor */ |
|
|
// For this simulation we are not collecting any statistics on output nodes. Force noise to 0 |
|
|
|
|
|
*noise = inoise; |
|
|
*noise = inoise; |
|
|
*lnNoise = log(MAX(*noise, N_MINLOG)); |
|
|
*lnNoise = log(MAX(*noise, N_MINLOG)); |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case THERMNOISE: |
|
|
case THERMNOISE: |
|
|
inoise = 4.0 * CONSTboltz * (ckt->CKTtemp + param2) * param; /* param is the conductance of a resistor */ |
|
|
inoise = 4.0 * CONSTboltz * (ckt->CKTtemp + param2) * param; /* param is the conductance of a resistor */ |
|
|
// For this simulation we are not collecting any statistics on output nodes. Force noise to 0 |
|
|
|
|
|
*noise = inoise; |
|
|
*noise = inoise; |
|
|
*lnNoise = log(MAX(*noise, N_MINLOG)); |
|
|
*lnNoise = log(MAX(*noise, N_MINLOG)); |
|
|
break; |
|
|
break; |
|
|
@ -320,7 +311,6 @@ NevalSrcInstanceTemp(double* noise, double* lnNoise, CKTcircuit* ckt, int type, |
|
|
iNoise->d[0][d] = in; |
|
|
iNoise->d[0][d] = in; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int d = 0; d < ckt->CKTportCount; d++) |
|
|
for (int d = 0; d < ckt->CKTportCount; d++) |
|
|
for (int s = 0; s < ckt->CKTportCount; s++) |
|
|
for (int s = 0; s < ckt->CKTportCount; s++) |
|
|
ckt->CKTNoiseCYmat->d[d][s] = caddco(ckt->CKTNoiseCYmat->d[d][s], cmultco(iNoise->d[0][d], conju(iNoise->d[0][s]))); |
|
|
ckt->CKTNoiseCYmat->d[d][s] = caddco(ckt->CKTNoiseCYmat->d[d][s], cmultco(iNoise->d[0][d], conju(iNoise->d[0][s]))); |
|
|
@ -328,12 +318,14 @@ NevalSrcInstanceTemp(double* noise, double* lnNoise, CKTcircuit* ckt, int type, |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
double realVal; |
|
|
double realVal; |
|
|
double imagVal; |
|
|
double imagVal; |
|
|
double gain; |
|
|
double gain; |
|
|
realVal = ckt->CKTrhs[node1] - ckt->CKTrhs[node2]; |
|
|
realVal = ckt->CKTrhs[node1] - ckt->CKTrhs[node2]; |
|
|
imagVal = ckt->CKTirhs[node1] - ckt->CKTirhs[node2]; |
|
|
imagVal = ckt->CKTirhs[node1] - ckt->CKTirhs[node2]; |
|
|
gain = (realVal * realVal) + (imagVal * imagVal); |
|
|
gain = (realVal * realVal) + (imagVal * imagVal); |
|
|
|
|
|
|
|
|
switch (type) { |
|
|
switch (type) { |
|
|
|
|
|
|
|
|
case SHOTNOISE: |
|
|
case SHOTNOISE: |
|
|
@ -343,7 +335,7 @@ NevalSrcInstanceTemp(double* noise, double* lnNoise, CKTcircuit* ckt, int type, |
|
|
|
|
|
|
|
|
case THERMNOISE: |
|
|
case THERMNOISE: |
|
|
*noise = gain * 4 * CONSTboltz * (ckt->CKTtemp + param2) /* param2 is the instance temperature difference */ |
|
|
*noise = gain * 4 * CONSTboltz * (ckt->CKTtemp + param2) /* param2 is the instance temperature difference */ |
|
|
* param; /* param is the conductance of a resistor */ |
|
|
|
|
|
|
|
|
* param; /* param is the conductance of a resistor */ |
|
|
*lnNoise = log(MAX(*noise, N_MINLOG)); |
|
|
*lnNoise = log(MAX(*noise, N_MINLOG)); |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
|