From f85b1dcba4879e66197c5279133767342a05a59b Mon Sep 17 00:00:00 2001 From: "Stephen R. Whiteley" Date: Thu, 23 May 2019 20:59:45 -0700 Subject: [PATCH] WRspice: Typo fix and update to jj.va, required ADMS script fix. Fix *@ and *# lines not being executed in source.cc, tweaks to noise.cir example. --- .../devlib/adms/admst/wrspiceMODULEdefs.h.xml | 52 ++++++++++++------- wrspice/devlib/adms/examples/jj/jj.va | 45 ++++++++++++++-- wrspice/examples/noise.cir | 9 +++- wrspice/src/fte/source.cc | 6 ++- 4 files changed, 87 insertions(+), 25 deletions(-) diff --git a/wrspice/devlib/adms/admst/wrspiceMODULEdefs.h.xml b/wrspice/devlib/adms/admst/wrspiceMODULEdefs.h.xml index 6de61b03c..50fc9d9d2 100644 --- a/wrspice/devlib/adms/admst/wrspiceMODULEdefs.h.xml +++ b/wrspice/devlib/adms/admst/wrspiceMODULEdefs.h.xml @@ -617,15 +617,22 @@ inline double _d1_pow(double x,double y) { return x==0.0?0.0:log(x)*pow(x,y); - - - - - - - - - + + + + + + + + + + + + + + + + @@ -917,15 +924,24 @@ inline double _d1_pow(double x,double y) { return x==0.0?0.0:log(x)*pow(x,y); - - - - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/wrspice/devlib/adms/examples/jj/jj.va b/wrspice/devlib/adms/examples/jj/jj.va index b193a7824..f70b3dca7 100644 --- a/wrspice/devlib/adms/examples/jj/jj.va +++ b/wrspice/devlib/adms/examples/jj/jj.va @@ -51,6 +51,10 @@ // Whiteley Research/Synopsys Josephson Junction Model // + +// Version 1.30, May 23, 2019 fixed typos from last check-in, added +// ADMS magic so phase and vdpbak are treated as read-only params. +// Added 'n' SFQ pulse emission count read-only instance param. // Version 1.29, May 22, 2019 the tsfactor param is now relative to 2pi // instead of pi. If you set this to X previously, you should now set // it to X/2 for the same results. New tsaccel parameter for time @@ -203,6 +207,10 @@ `define NEWLSH `endif +// Enable the 'n' SFQ emission count parameter. Can comment this if +// you don't do SFQ logic. +`define NEWNPAR + // Uncomment this to support a phony DC analysis mode by loading JJ as // a tiny resistance. Not recommended. //`define fakeDC @@ -288,7 +296,7 @@ parameter real tsfactor = `TSDEFAULT from [0.001:1] // Use longer time steps when JJ voltage is smaller, a value of about // 2.5 seems to work best for RSFQ. -Parameter real tsaccel = 1.0 from 1.0:20.0] +parameter real tsaccel = 1.0 from [1.0:20.0] `P(type="model" info="Ratio max time step to that at dropback voltage"); // Critical current for area=1. @@ -383,8 +391,13 @@ parameter real lsh = 0.0 from [0.0:100.0p] parameter real area = 1.0 from [0.05:20.0] `P(type="instance" info="Ic scale factor"); -real phase, scale, caps, rsubs, rnorms, vless, vmore, i1, i2; -real vdpbak, vth, start_phase, tsf, ic_scaled; +real vdpbak `P(type="model" info="Dropback voltage"); +real phase `P(type="instance" info="Junction phase"); +`ifdef NEWNPAR +integer n `P(type="instance" info="SFQ emission count"); +`endif +real scale, caps, rsubs, rnorms, vless, vmore, i1, i2; +real vth, start_phase, tsf, ic_scaled; `ifdef NEWVSHUNT real gshunt; `ifdef NEWLSH @@ -741,7 +754,33 @@ analog begin if (vtmp < vth) vtmp = vth; $bound_step(2*`M_PI*tsf*`PHI0_2PI/vtmp); + +`ifdef NEWNPAR + // Compute the SFQ emission count, used for pass/fail testing + // of SFQ circuits. + begin + real pp, twopi; + integer pint; + twopi = `M_PI + `M_PI; + if (phase >= 0.0) + begin + pint = phase/twopi; + pp = phase - pint*twopi; + if (pp > `M_PI + `M_PI_4) + pint = pint + 1; + end + else + begin + pint = phase/twopi; + pp = phase - pint*twopi + twopi; + if (pp < `M_PI - `M_PI_4) + pint = pint - 1; + end + n = abs(pint); end +`endif + end + else begin $error("JJ.va model: unknown or unsupported analysis."); diff --git a/wrspice/examples/noise.cir b/wrspice/examples/noise.cir index 66065bc6a..5056ca841 100644 --- a/wrspice/examples/noise.cir +++ b/wrspice/examples/noise.cir @@ -2,8 +2,8 @@ * WRspice has the ability to model noise in the time domain. This * simple example illustrates thermal resistor noise in an RLC circuit. * More complex cases can be used to model noise-induced errors, etc. -* See the document MarkJerreryNoiseMemo.pdf in the docs area of the -* distribution archive of wrcad.com for more info (password required). +* See the document MarkJefferyNoiseMemo.pdf in the docs area of the +* distribution archive of wrcad.com for more info. * Below defines a function "noise" which encapsulates the thermal * noise equation and a call to the gauss "tran" function. The noise @@ -16,6 +16,11 @@ * This one is active (recall that *@ is like .exec/.endc for one line). *@ define noise(r,t,dt,n) gauss(sqrt(2*boltz*t/(r*dt)), 0, dt, n) +* This is not a comment in WRspice, it acts like the three lines +* below if they were uncommented. +* .exec +* define noise(r,t,dt,n) gauss(sqrt(2*boltz*t/(r*dt)), 0, dt, n) +* .endc * This one is commented out, comment the one above and uncomment this * to try it out. diff --git a/wrspice/src/fte/source.cc b/wrspice/src/fte/source.cc index cdf84cfca..305fe527e 100644 --- a/wrspice/src/fte/source.cc +++ b/wrspice/src/fte/source.cc @@ -2306,9 +2306,11 @@ sLine::get_keywords(int *kwfound) continue; } - if (lstring::cimatch(CONT_KW, dd->li_line)) + if (lstring::cimatch(CONT_KW, dd->li_line) || + lstring::cimatch(CONT_PREFX, dd->li_line)) *kwfound |= LI_CONT_FOUND; - else if (lstring::cimatch(EXEC_KW, dd->li_line)) + else if (lstring::cimatch(EXEC_KW, dd->li_line) || + lstring::cimatch(EXEC_PREFX, dd->li_line)) *kwfound |= LI_EXEC_FOUND; else if (lstring::cimatch(POST_KW, dd->li_line)) *kwfound |= LI_POST_FOUND;