Home > Community > Forums > Custom IC Design > Problem simulating Spice Netlist with Spectre


* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

 Problem simulating Spice Netlist with Spectre 

Last post Fri, May 17 2013 6:19 AM by Andrew Beckett. 7 replies.
Started by Oriba 10 Apr 2013 12:38 AM. Topic has 7 replies and 2856 views
Page 1 of 1 (8 items)
Sort Posts:
  • Wed, Apr 10 2013 12:38 AM

    • Oriba
    • Not Ranked
    • Joined on Tue, Aug 14 2012
    • Posts 3
    • Points 60
    Problem simulating Spice Netlist with Spectre Reply


    Recently i tried to simulate the following Spice netList with Spectre:( by : spectre filename.sp)

     simulator lang = spice
    .SUBCKT modelmemristor plus minus PARAMS:

    +phio=0.95 Lm=0.0998 w1=0.1261 foff=3.5e-6
    +ioff=115e-6 aoff=1.2 fon=40e-6 ion=8.9e-6
    +aon=1.8 b=500e-6 wc=107e-3
    G1 plus internal value={sgn(V(x))*(1/V(dw))^2*0.0617*(V(phiI)*exp(-V(B)*V(sr))-(V(phiI)+abs(V(x)))*exp(-V(B)*V(sr2)))}
    Esr sr 0 value={sqrt(V(phiI))}
    Esr2 sr2 0 value={sqrt(V(phiI)+abs(V(x)))}
    Rs internal minus 215
    Eg x 0 value={V(plus)-V(internal)}
    Elamda Lmda 0 value={Lm/V(w)}
    Ew2 w2 0 value={w1+V(w)-(0.9183/(2.85+4*V(Lmda)-2*abs(V(x))))}
    EDw dw 0 value={V(w2)-w1}
    EB B 0 value={10.246*V(dw)}
    ER R 0 value={(V(w2)/w1)*(V(w)-w1)/(V(w)-V(w2))}
    EphiI phiI 0 value={phio-abs(V(x))*((w1+V(w2))/(2*V(w)))-1.15*V(Lmda)*V(w)*log(V(R))/V(dw)}
    C1 w 0 1e-9 IC=1.2
    R w 0 1e8MEG
    Ec c 0 value={abs(V(internal)-V(minus))/215}
    Emon1 mon1 0 value={((V(w)-aoff)/wc)-(V(c)/b)}
    Emon2 mon2 0 value={(aon-V(w))/wc-(V(c)/b)}
    Goff 0 w value={foff*sinh(stp(V(x))*V(c)/ioff)*exp(-exp(V(mon1))-V(w)/wc)}
    Gon w 0 value={fon*sinh(stp(-V(x))*V(c)/ion)*exp(-exp(V(mon2))-V(w)/wc)}
    .ENDS modelmemristor

     When doing so, i got the following errors:

     Error found by spectre in `modelmemristor', during circuit read-in.
        ERROR (SFE-1815): "Mem.sp" 2: Missing value for parameter `G1' in
            subcircuit definition `modelmemristor'.
        ERROR (SFE-662): "Mem.sp" 2: Badly formed subcircuit definition

    I looked a littel bit and tried to change the G1 parameter to the following:

    G1 plus internal 0 xx value={sgn(V(x))*(1/V(dw))^2*0.0617*(V(phiI)*exp(-V(B)*V(sr))-(V(phiI)+abs(V(x)))*exp(-V(B)*V(sr2)))}
    Exx xx 0 1

    But still same Errors..
    Can anyway know what is the problem??
    My final goal is to attach this netlist to a symbol so i can use it in virtuoso.

    • Post Points: 20
  • Wed, Apr 10 2013 3:11 AM

    Re: Problem simulating Spice Netlist with Spectre Reply

    I tried this in MMSIM11.1 and got a number of problems. Spectre does not support PSPICE syntax (I think this is PSPICE), but Berkeley SPICE instead. So with a few small changes I got it to compile OK (you'll have to test that it actually works OK):

    simulator lang=spectre
    ** this function does not exist in spectre, so implement it ourselves
    real stp(real a) {
        return a>0?1.0:0.0
    simulator lang=spice

    ** the SPICE parser in spectre does not support PARAMS: so change to conventional
    ** SPICE syntax
    ** Also change all {} to ''
    .SUBCKT modelmemristor plus minus $PARAMS:
    +phio=0.95 Lm=0.0998 w1=0.1261 foff=3.5e-6
    +ioff=115e-6 aoff=1.2 fon=40e-6 ion=8.9e-6
    +aon=1.8 b=500e-6 wc=107e-3
    G1 plus internal value='sgn(V(x))*(1/V(dw))^2*0.0617*(V(phiI)*exp(-V(B)*V(sr))-(V(phiI)+abs(V(x)))*exp(-V(B)*V(sr2)))'
    Esr sr 0 value='sqrt(V(phiI))'
    Esr2 sr2 0 value='sqrt(V(phiI)+abs(V(x)))'
    Rs internal minus 215
    Eg x 0 value='V(plus)-V(internal)'
    Elamda Lmda 0 value='Lm/V(w)'
    Ew2 w2 0 value='w1+V(w)-(0.9183/(2.85+4*V(Lmda)-2*abs(V(x))))'
    EDw dw 0 value='V(w2)-w1'
    EB B 0 value='10.246*V(dw)'
    ER R 0 value='(V(w2)/w1)*(V(w)-w1)/(V(w)-V(w2))'
    EphiI phiI 0 value='phio-abs(V(x))*((w1+V(w2))/(2*V(w)))-1.15*V(Lmda)*V(w)*log(V(R))/V(dw)'
    C1 w 0 1e-9 IC=1.2
    ** Spectre does not support exponents with engineering suffixes together
    *R w 0 1e8MEG
    R w 0 1e14
    Ec c 0 value='abs(V(internal)-V(minus))/215'
    Emon1 mon1 0 value='((V(w)-aoff)/wc)-(V(c)/b)'
    Emon2 mon2 0 value='(aon-V(w))/wc-(V(c)/b)'
    Goff 0 w value='foff*sinh(stp(V(x))*V(c)/ioff)*exp(-exp(V(mon1))-V(w)/wc)'
    Gon w 0 value='fon*sinh(stp(-V(x))*V(c)/ion)*exp(-exp(V(mon2))-V(w)/wc)'
    .ENDS modelmemristor




    • Post Points: 35
  • Wed, Apr 10 2013 4:46 AM

    • Oriba
    • Not Ranked
    • Joined on Tue, Aug 14 2012
    • Posts 3
    • Points 60
    Re: Problem simulating Spice Netlist with Spectre Reply

    Thank you very much Andrew, for the response.

     I tried to do the changes you told me to, but it seems that Spectre have problem with the stp function.

    before i will write the error i get i will say i am using MMSIM72.

     The error:
      ERROR (SFE-874): "Mem.sp" 3: Unexpected end of line.
    Warning from spectre in `modelmemristor', during circuit read-in.

    line 3 in the where the return is.

    I also tried to change it to other variation , but it seems it has problems with the function defenition. Do you have any idea what could be the problem?

    Thanks agian

    • Post Points: 20
  • Wed, Apr 10 2013 6:54 AM

    Re: Problem simulating Spice Netlist with Spectre Reply

    I tried in MMSIM72, and it worked OK for me (I had a convergence problem, but my circuit is a bit silly).

    Can you cut and paste your function definition - i.e. the netlist you're using.

    Make sure that you don't have something important on the first line in the file you're simulating, as spectre (like SPICE) treats the first line as a comment... so if that first line is "simulator lang=spectre", things might not work...


    • Post Points: 20
  • Wed, Apr 10 2013 10:21 AM

    • Oriba
    • Not Ranked
    • Joined on Tue, Aug 14 2012
    • Posts 3
    • Points 60
    Re: Problem simulating Spice Netlist with Spectre Reply

    Thanks agian Andrew!

    I think it help and the problem was that i used the first line.
    now the only thing i get is : ERROR (SPECTRE-4080): There are no components in the circuit.
    which i think is ok since i tried to compile only this subckt.

    Now as i said i dont have a netlist yet becasue what i want to do is to create a symbol in virtuoso so this subckt can be used as a component. (because it is more Convenient for later)
    I tried 2 different ways:
    1. add the spectre subckt to verilog A but apparently i dont do it right.2. I tried to add from analogLib ascasubckt which is connected to my subckt.

    both ways were unsuccesfull.
    I would prefer to know how to connect it to verilog and activate it .  but also the a direct way to use it in virtuoso is good for me.

    • Post Points: 20
  • Wed, Apr 10 2013 1:42 PM

    Re: Problem simulating Spice Netlist with Spectre Reply

    I've no idea what adding a subckt to "verilog A" means, nor what the analogLib "ascasubckt" means. 

    There are numerous posts on this forum about how to reference an external model. However, simplest would probably be to copy a two terminal device (such as "res") from analogLib to your own library, edit the symbol and then edit the CDF to (say) set the model parameter to the name of your subckt model. Or change the component name in the spectre simulation info part of the CDF to match your subckt  name. 



    • Post Points: 5
  • Fri, May 17 2013 6:03 AM

    • Runner
    • Not Ranked
    • Joined on Fri, May 8 2009
    • Posts 12
    • Points 325
    Spice model in Spectre Reply

     Hello, Andrew! I think, I have similar problem simulating the following model in spectre:

     .SUBCKT IPD100N06S4 drain gate source Tj Tcase PARAMS: dVth=0 dRdson=0 dgfs=0 dC=0 Zthtype=0 Ls=1.5n Ld=1n Lg=3n

    .PARAM Rs=659u      Rg=1.3       Rd=50u       Rm=180u
    .PARAM Inn=90       Unn=10       Rmax=3.5m    gmin=60
    .PARAM RRf=390m     Rrbond=12m   Rtb=5.5      g2=758m
    .PARAM act=9.3

    .FUNC   Pb(I,dT,Rb)  {Rb/(2*Rtb)*(I-limit(dT/(max(I,1n)*Rb)+RRf*I*g2,0,I))**2}

    X1  d1 g s Tj S4_60_o_var PARAMS: a={act} dVth={dVth} dR={dRdson} dgfs={dgfs} Inn={Inn} Unn={Unn}
                                            +Rmax={Rmax} gmin={gmin} Rs={Rs} Rp={Rd} dC={dC} Rm={Rm}
    Rg    g1     g    {Rg}   
    Lg    gate   g1   {Lg*if(dgfs==99,0,1)}
    Gs    s1     s    VALUE={V(s1,s)/(Rs*(1+(limit(V(Tj),-200,999)-25)*4m)-Rm)}
    Rsa   s1     s    1Meg
    Ls    source s1   {Ls*if(dgfs==99,0,1)}
    Rda   d1     d2   {Rd}
    Ld    drain  d2   {Ld*if(dgfs==99,0,1)}
    Rsb   source s1    10
    Rga   gate   g1    10
    Rdb   drain  d2    10

    G_TH  0    Tb  VALUE =  {Pb(abs(I(Ls)),V(Tj,Tcase),Rrbond*(1+(limit((V(Tb)+V(Tj))/2,-200,999)-25)*4m))}
    Cthb  Tb      0               3.71m
    Rthb  Tb      Tj              {Rtb}
    Rth1  Tj      t1              {3.18m+limit(Zthtype,0,1)*1.18m}
    Rth2  t1      t2              {37.94m+limit(Zthtype,0,1)*14.04m}
    Rth3  t2      t3              {152.2m+limit(Zthtype,0,1)*57.57m}
    Rth4  t3      t4              {154.57m+limit(Zthtype,0,1)*115.94m}
    Rth5  t4      Tcase           {264.77m+limit(Zthtype,0,1)*198.61m}
    Cth1  Tj      0               97.107u
    Cth2  t1      0               334.606u
    Cth3  t2      0               2.294m
    Cth4  t3      0               1.639m
    Cth5  t4      0               37.686m
    Cth6  Tcase   0               70m


     I receive messages:

     WARNING (SFE-1805): "/OptiMOS-T2_60V.lib" 11: .FUNC is not recognised as a valid SPICE control card.

    ERROR (SFE-1024): "/OptiMOS-T2_60V.lib" 16: Instance `Lg': Unexpected value `0' - positional parameters are not allowed after explicitly named parameters.

     I have fixed problem with "if" by introducing ternary operator ( ? : ), but I do not know how to handle .FUNC and limit() constructions.

    Could you help?

    Filed under: ,
    • Post Points: 20
  • Fri, May 17 2013 6:19 AM

    Re: Spice model in Spectre Reply

    Not really tested, but something like this:

    simulator lang=spectre

    real limit(real val,real lower,real upper) {
        return val<lower?lower:val>upper?upper:val

    real Pb(real I,real dT,real Rb)  {
        return Rb/(2*Rtb)*(I-limit(dT/(max(I,1n)*Rb)+RRf*I*g2,0,I))**2

    See "spectre -h functions"



    • Post Points: 5
Page 1 of 1 (8 items)
Sort Posts:
Started by Oriba at 10 Apr 2013 12:38 AM. Topic has 7 replies.