sprun
New Member
Offline
Posts: 7
|
Below is the code I used.
******************************************************************* `include "constants.vams" `include "disciplines.vams"
module VXR(clk,out,outboost);
input clk; electrical clk; output out, outboost;
electrical in, inboost, out, outboost; real Rch; integer odd1, odd2;
parameter real C = 1.0e-9; parameter real VDD = 3.3; parameter real Vth1 = 1.62; parameter real Vth2 = 1.75; parameter real f1 = 1.3e6; //freq=5MHz parameter real f2 = 6.5e5; //freq=5MHz parameter integer N1 = 3; //pump stage parameter integer N2 = 2; //pump stage parameter real Ron = 1e-12; //switch resistor when on parameter real Roff = 1e12; //switch resistor when off parameter real Rload1 = 1.7e5; //load resistor parameter real Rload2 = 1.0e5; //load resistor parameter real Rup = 1.0e5; //
analog begin if(V(clk)-2.0>0) Rch = Ron; else Rch = Roff;
odd1 = N1%2; odd2 = N2%2;
@(initial_step) begin V(out) <+ 2.0; V(outboost) <+ 2.0 ; end
V(inboost) <+ VDD+N1*VDD-(N1+1.0)*Vth1; V(outboost,inboost) <+ ((N1/C+Rch)/f1)*I(inboost,outboost); I(inboost,outboost) <+ ( (4.0*N1*N1-N1-3.0)*C/(12.0*(N1+1.0) ) *ddt(V(outboost)) + V(outboost)/Rload1 + (V(outboost)-VDD)/Rup)*odd1 + ( (4.0*N1*N1+3.0*N1+2.0) * C/(12.0*(N1+1.0)) * ddt(V(outboost)) + V(outboost)/Rload1 + (V(outboost)-VDD)/Rup )*(1-odd1);
V(in) <+ VDD+N2*VDD-(N2+1.0)*Vth2; V(out,in) <+ ((N2/C+Rch)/f2)*I(in,out); I(in,out) <+ ( (4.0*N2*N2-N2-3.0)*C/(12.0*(N2+1.0) )*ddt(V(out)) + V(out)/Rload2 + (V(out)-VDD)/Rup)*odd2 + ( (4.0*N2*N2+3.0*N2+2.0) * C/(12.0*(N2+1.0)) * ddt(V(out)) + V(out)/Rload2 + (V(out)-VDD)/Rup ) *(1-odd2);
end
endmodule
|