Skip to content

Commit

Permalink
WRspice: Typo fix and update to jj.va, required ADMS script fix.
Browse files Browse the repository at this point in the history
Fix *@ and *# lines not being executed in source.cc, tweaks to
noise.cir example.
  • Loading branch information
wrcad committed May 24, 2019
1 parent d2dba3b commit f85b1dc
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 25 deletions.
52 changes: 34 additions & 18 deletions wrspice/devlib/adms/admst/wrspiceMODULEdefs.h.xml
Original file line number Diff line number Diff line change
Expand Up @@ -617,15 +617,22 @@ inline double _d1_pow(double x,double y) { return x==0.0?0.0:log(x)*pow(x,y);
<admst:text format="\n$(indent)// Variables\n"/>
<admst:for-each select="variable[input='no' and (scope='global_instance' or
(parametertype='instance' and not(nilled(attribute))))]">
<admst:if test="[minsize=maxsize]">
<admst:text format="$(indent)%(vtype(.)) %(name);\n"/>
</admst:if>
<!-- array support 111217 -->
<admst:if test="[minsize!=maxsize]">
<admst:value-of select="name"/>
<admst:apply-templates select="." match="math:asizeval"/>
<admst:text format="$(indent)%(vtype(.)) %s[$leftval];\n"/>
</admst:if>
<admst:variable name="vv" value="%(name)"/>
<admst:choose>
<admst:when test="$instance_vars[name=$vv]">
</admst:when>
<admst:otherwise>
<admst:if test="[minsize=maxsize]">
<admst:text format="$(indent)%(vtype(.)) %(name);\n"/>
</admst:if>
<!-- array support 111217 -->
<admst:if test="[minsize!=maxsize]">
<admst:value-of select="name"/>
<admst:apply-templates select="." match="math:asizeval"/>
<admst:text format="$(indent)%(vtype(.)) %s[$leftval];\n"/>
</admst:if>
</admst:otherwise>
</admst:choose>
</admst:for-each>
<admst:if test="$instance_vars">
<admst:for-each select="$instance_vars">
Expand Down Expand Up @@ -917,15 +924,24 @@ inline double _d1_pow(double x,double y) { return x==0.0?0.0:log(x)*pow(x,y);
<admst:text format="\n$(indent)// Variables\n"/>
<admst:for-each select="variable[input='no' and (scope='global_model' or
(parametertype='model' and not(nilled(attribute))))]">
<admst:if test="[minsize=maxsize]">
<admst:text format="$(indent)%(vtype(.)) %(name);\n"/>
</admst:if>
<!-- array support 111217 -->
<admst:if test="[minsize!=maxsize]">
<admst:value-of select="name"/>
<admst:apply-templates select="." match="math:asizeval"/>
<admst:text format="$(indent)%(vtype(.)) %s[$leftval];\n"/>
</admst:if>

<admst:variable name="vv" value="%(name)"/>
<admst:choose>
<admst:when test="$model_vars[name=$vv]">
</admst:when>
<admst:otherwise>
<admst:if test="[minsize=maxsize]">
<admst:text format="$(indent)%(vtype(.)) %(name);\n"/>
</admst:if>
<!-- array support 111217 -->
<admst:if test="[minsize!=maxsize]">
<admst:value-of select="name"/>
<admst:apply-templates select="." match="math:asizeval"/>
<admst:text format="$(indent)%(vtype(.)) %s[$leftval];\n"/>
</admst:if>
</admst:otherwise>
</admst:choose>

</admst:for-each>
<admst:if test="$model_vars">
<admst:for-each select="$model_vars">
Expand Down
45 changes: 42 additions & 3 deletions wrspice/devlib/adms/examples/jj/jj.va
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.");
Expand Down
9 changes: 7 additions & 2 deletions wrspice/examples/noise.cir
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down
6 changes: 4 additions & 2 deletions wrspice/src/fte/source.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f85b1dc

Please sign in to comment.