如下的一段程序,是一个子电路的定义:
* charge controlled memrc implementation for ELDO
.SUBCKT memC Plus Minus PARAMS:
+ Cmin=10nF Cmax=10uF Cinit=100nF k=10meg p=1 IC=0
* Input port *
Emc Plus Minus value={DM(v(x))*(v(charge)+IC*Cinit)}
* Charge computation. Int1 from Fig. 1 is formed by Cq and Gq *
Gq 0 charge value={I(Emc)}
Cq charge 0 1
Rq charge 0 1G
* State-space equation (4). Int2 from Fig. 1 is formed by Cx and Gx *
.param xinit={(1/Cinit-1/Cmax)/(1/Cmin-1/Cmax)}
.func window(x,p)={1-(2*x-1)**(2*p)};
Gx 0 x value={v(charge)*k*window(v(x),p)};
Cx x 0 1 IC={xinit}
Rx x 0 1G
.func DM(x)={1/Cmax+(1/Cmin-1/Cmax)*x};
.ENDS