Hello,
I created a symbol in Virtuoso 6.16 and wrote a SPICE model for it and added spectre stop view in cell view. Now when I try to simulate (MMSIM 13) it I don't get any error but the current through the behavioral source (bsource) is incorrect. However, the equations in my functions are correct. What could be the reason for it? is it because of the if..else conditions?. Kindly see the example of my model below.
**myFunctions
simulator lang=spectre
real myfunc1( real A, real B, real C ) {
return A + B + C;
}
real myfunc2( real A, real B, real C ) {
return A - B - C;
}
real myfunc3( real A, real B, real C ) {
return A * B * C;
}
**myModel
simulator lang=spice
subckt myModel X Y Z
.param
+W=100u L=100u
+a1 = 1u
+a2 = 2u
*Behavioral current source between X and Z node
cccs1 X Z bsource i=(W/L) * (if(V(Y, Z) <= 0.3, myfunc1(A, B, C), if(V(Y, Z) > 0.3 & V(Y, Z) < 0.7, myfunc2(A, B, C), myfunc3(A, B, C))))
*resistance between X and Z node
R X Z 10e9
.ends