The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl
Other CAD Tools >> Entry Tools >> Using a SPICE subcircuit in Spectre
https://designers-guide.org/forum/YaBB.pl?num=1191334088

Message started by vivkr on Oct 2nd, 2007, 7:08am

Title: Using a SPICE subcircuit in Spectre
Post by vivkr on Oct 2nd, 2007, 7:08am

Hi,

I am trying to include a SPICE model of a standalone component in my schematic made with Virtuoso.

The model is defined as a SPICE subcircuit. I think that some small format change is needed, but I have been
away from SPICE for years and don't remember anymore how one could convert a SPICE subckt to be used
with Spectre.

I tried the following:

1. Directly created a SPICE view and changed my reference view name to include "spice" ahead of "spectre". I am able to open
the SPICE netlist of the block through Virtuoso, but the netlisting does not work. It complains that it cannot descend into any
of the views although I am actually able to do so through the editor.

2. Converted the SPICE netlist to a Spectre one using spp. How does one create a "spectre" view for a given cell? There seems to be
no netlist example for this.

Could anyone suggest a solution?

Thanks
Vivek

Title: Re: Using a SPICE subcircuit in Spectre
Post by Frank Wiedmann on Oct 2nd, 2007, 8:27am

Here is what I usually do: Add a scasubckt component from analogLib to the schematic. For "Name of the model" enter the name after "subckt" in your Spectre netlist. For "Subckt file" enter the full path to the file with your Spectre netlist. For "Number of ports" enter the number of ports of your circuit. In the schematic, connect the "ref" port of the scasubckt component to a gnd component from analogLib. Finally, add a dummy port to your Spectre netlist at the end of the list (this corresponds to the unused "ref" port). For example, for a circuit with two ports, change the line "subckt mycircuit t1 t2" to "subckt mycircuit t1 t2 dummy". In the example given here, t1 and t2 would correspond to the ports b1 and b2 of the scasubckt component.

Title: Re: Using a SPICE subcircuit in Spectre
Post by vivkr on Oct 10th, 2007, 2:35am

Thanks a lot Frank!!!

Vivek

Title: Re: Using a SPICE subcircuit in Spectre
Post by claire on Jun 19th, 2008, 5:57am

I have the same problem as Vivkr. I'm trying to do what Frank respond but I can't find "Number of ports". Where should I look for this? My component is a pnp. I don't see too what is the "ref" that you talk about.
Can you help me?
Thanks.
Claire

Title: Re: Using a SPICE subcircuit in Spectre
Post by claire on Jun 19th, 2008, 7:39am

I have managed to do all what Frank say but it still not working!!
I think that my netlist is wrong. The extension must be .cir or .scs?? My component is a pnp.
I give you my netlist :

simulator lang=spectre
subckt mypnp E B C dummy
model mypnp bjt type=pnp minr=1e-60 rbmod=spice bf=2.775 * bfa nf=1.013 * nfa is=3.5351e-18 * isa
+ ise=3.5351e-18 * isa isc=3.5351e-18 * isa ne=1.3977142 rb=54.76734 * rba irb=1.401332e-3
+ rbm=1.0965611 * rbma re=1.3979963 * rea ikf=8.2254e-4 nkf=0.477972 vaf=372.731
+ br=4.4013e-3 nr=0.993881 nc=0.98076 rc=20.08 * rca ikr=1.98804e-4 var=20.84541
+ xti=3 eg=1.17 xtb=0 trb1=1.493714e-3 tirb1=1.375303e-5 trm1=1.074565e-5 tre1=1.068665e-4
+ tikf1=-2.512025e-3 tikr1=-3.93e-3 trc1=8e-5 tbf1=4.9e-3 tbf2=1.1e-6 tnf1=-1.056025e-4
+ tne1=2.152336e-4 tvaf1=-4e-5 tbr1=-1.01e-3 tbr2=1.3e-5 tnc1=1.122277e-4 tnc2=0
+ tnr1=-1.026101e-4 tnr2=0 cje=3.2987e-14 * cjea vje=0.895226 mje=0.4345495 fc=0
+ cjc=3.965229e-14 * cjca vjc=0.5846489 mjc=0.2933243 tlev=0 tlevc=1 cte=2.0325e-3
+ ctc=8.900197e-4 tvje=1.572025e-3 tvjc=2.819e-3 tnom=25
//
ends mypnp

What's wrong??

Title: Re: Using a SPICE subcircuit in Spectre
Post by sheldon on Jul 4th, 2008, 9:59pm

Claire,

  If you would share the error message, it would be easier to identify
the issue and propose solutions.

Also Frank's approach is not required for device models. For a device
model, you can just place the component in schematic and define the
model name, in your case, "mypnp".

On other observation, usually device models are not wrapped inside
of subcircuits. Spectre has a special construct called inline subcircuits
for device models. You should check the online help or manual for
details. The other option would be to just treat your model as a
model.

                                                            Best Regards,

                                                               Sheldon

Title: Re: Using a SPICE subcircuit in Spectre
Post by tkhan on Aug 15th, 2008, 11:15am

i am trying to import an inductor i made in momentum and generated the spice netlist for. i followed the instructions above  but get this error:

Error found by spectre in `asdf', during circuit read-in.
   "/*****/asdf.cir" 1: Syntax error in
       specification of `spice'.
Warning from spectre, in `asdf', during circuit read-in.
   "/*****/asdf.cir" 17: Subcircuit name missing in
       closing the nested definition for `asdf'.

any help would be appreciated.

Title: Re: Using a SPICE subcircuit in Spectre
Post by Geoffrey_Coram on Sep 15th, 2008, 9:24am


claire wrote on Jun 19th, 2008, 7:39am:
subckt mypnp E B C dummy
model mypnp bjt type=pnp minr=1e-60 rbmod=spice bf=2.775 * bfa nf=1.013 * nfa
...
What's wrong??


1) you've got a model card, but no instance of anything in the subckt
2) you probably don't want the model card to have the same name as the subckt
3) BJT terminals are usually ordered as C B E (not E B C)
4) where are "bfa" and "nfa" declared/assigned values?


subckt mypnp E B C dummy
model pnpmod bjt type=pnp minr=1e-60 rbmod=spice bf=2.775 * bfa nf=1.013 * nfa
...
q1 (C B E) pnpmod
endst mypnp

Title: Re: Using a SPICE subcircuit in Spectre
Post by Geoffrey_Coram on Sep 15th, 2008, 9:27am


tkhan wrote on Aug 15th, 2008, 11:15am:
i am trying to import an inductor i made in momentum and generated the spice netlist for. i followed the instructions above  but get this error:

Error found by spectre in `asdf', during circuit read-in.
   "/*****/asdf.cir" 1: Syntax error in
       specification of `spice'.


As a wild guess (you don't actually show us line 1), I'm thinking line 1 is supposed to be a comment, but doesn't have a leading * because Spice always ignores the first line -- and then Spectre is reading the file thinking it's Spectre format and trying to parse the first line.

Title: Re: Using a SPICE subcircuit in Spectre
Post by Frank Wiedmann on Sep 16th, 2008, 12:10am

The subcircuit netlist is expected in Spectre format, not in Spice format. You can convert the Spice netlist to Spectre format with spp. See http://sourcelink.cadence.com/docs/files/Release_Info/Docs/spectreuser/spectreuser5.1.41/chap3.html or type spp -h at the Unix prompt for a list of options.

You can also try to add the command line simulator lang=spice in front of the netlist and simulator lang=spectre after it. I have never tried this, though.

Title: Re: Using a SPICE subcircuit in Spectre
Post by sheldon on Sep 18th, 2008, 6:33pm

Another approach would be to tell Spectre that the block is not
in Spectre format. For example,

simulator lang=spice

*** My SPICE netlist

.SUBCKT
...
.ends

simulator lang=spectre

I believe that this is approach is preferred to using spp.

                                                                    Best Regards,

                                                                         Sheldon



Title: Re: Using a SPICE subcircuit in Spectre
Post by fernando.g.r on Dec 6th, 2010, 2:39am

Hello,

I've been reading the thread and trying to follow your advice.

Unfortunately, when i try to simulate my netlist all i get is:


Code:
Warning from spectre in `component', during circuit read-in.
   "example" 46: `gx': Encountered statement in Spectre format while in Spice language mode. This will not be supported in a future release.
Error found by spectre during circuit read-in.
   Primitive 'n1' does not support behavioural expressions( File:example, Instance:gx)




here is part of the spice model (a current dependent  source) included in the spectre netlist:


Code:
simulator lang= spice

.SUBCKT component Plus 0
***********************************************
* STATE EQUATION MODELING *
Gx 0 N1 value= I(Roff)*mag*V(N1)


May you help me?

Thanks

Title: Re: Using a SPICE subcircuit in Spectre
Post by Frank Wiedmann on Dec 6th, 2010, 3:32am

Have you tried using correct SPICE syntax? See for example http://bwrc.eecs.berkeley.edu/classes/icbook/spice/UserGuide/elements.html#462.

Title: Re: Using a SPICE subcircuit in Spectre
Post by fernando.g.r on Dec 6th, 2010, 6:45am

Thanks for the link, i've found the error.

Title: Re: Using a SPICE subcircuit in Spectre
Post by apprentice on Apr 4th, 2011, 10:25pm

Hi all,

  Instead of using a scasubckt component, I tried creating a cell with a CDF parameter flowing the recipe somehow.  The detail recipe can be found from the link at the end of the post.
  However, I got a error.
Error found by spectre during circuit read-in.
   ERROR (SFE-23): "input.scs" 13: I1 is an instance of an undefined model abc_model.
   

input.scs
  // Generated for: spectre
// Generated on: Apr  4 22:06:27 2011
// Design library name: abc
// Design cell name: tb_abc
// Design view name: schematic
simulator lang=spectre
global 0

// Library name: abc
// Cell name: tb_abc
// View name: schematic
I1 (in_p in_n out) abc_model
V0 (in_p in_n) vsource type=bit edgetype=linear val0=0 val1=1 period=30p \
       rise=12p fall=12p data="0" rptstart=1 rpttimes=0
R0 (out 0) resistor r=1
simulatorOptions options reltol=1e-3 vabstol=1e-6 iabstol=1e-12 temp=27 \
   tnom=27 scalem=1.0 scale=1.0 gmin=1e-12 rforce=1 maxnotes=5 maxwarns=5 \
   digits=5 cols=80 pivrel=1e-3 sensfile="../psf/sens.output" \
   checklimitdest=psf
tran tran stop=100p write="spectre.ic" writefinal="spectre.fc" \
   annotate=status maxiters=5
finalTimeOP info what=oppoint where=rawfile
modelParameter info what=models where=rawfile
element info what=inst where=rawfile
outputParameter info what=output where=rawfile
designParamVals info what=parameters where=rawfile
primitives info what=primitives where=rawfile
subckts info what=subckts  where=rawfile
saveOptions options save=allpub

--------------------
abc_model.scs (model library setup done - attached screen capture)

simulator lang=spectre insensitive=yes


subckt abc_model (in_p in_n out)
// *********************************************************************
// circuit
//
//
//
parameters d=0.01
...
...
...
// output circuit
...
ends abc_model
// *********************************************************************


  Which step could be wrong? Which part of message I should post to help troubleshoot?

thanks

http://www.cadence.com/Community/blogs/rf/archive/2009/01/07/tip-of-the-week-how-to-simulate-a-subcircuit-netlist-with-spectre-in-ade.aspx

Title: Re: Using a SPICE subcircuit in Spectre
Post by boe on Apr 5th, 2011, 8:28am

apprentice,

there should be an include statement for abc_model.scs in the input.scs.

B O E

Title: Re: Using a SPICE subcircuit in Spectre
Post by apprentice on Apr 5th, 2011, 8:47am

Should I manually edit the input.scs to have the include statement?

I guess I missed one of the steps so that the include statement isn't able to be in the input.scs automatically.

Title: Re: Using a SPICE subcircuit in Spectre
Post by boe on Apr 5th, 2011, 11:19am


apprentice wrote on Apr 5th, 2011, 8:47am:
Should I manually edit the input.scs to have the include statement?
That should not be necessary. The netlister should automatically include all model files via include statement.

B O E

PS: Please note the forum guidelines: "Create your own topic. Do not jump into another person's topic. This only creates confusion and makes the board harder to search. Even if the problem seems similar to you, more often than not, the answer to your request will be something different from the original posters."

Title: Re: Using a SPICE subcircuit in Spectre
Post by apprentice on Apr 13th, 2011, 10:04pm

I repeated the simulation and checked the input.scs which has the include statement.

include "/home/.../abc_model.scs"

However, I still find the same error.

Error found by spectre during circuit read-in.
   ERROR (SFE-23): "input.scs" 13: I1 is an instance of an undefined model abc_model.

anything to try?

thanks

Title: Re: Using a SPICE subcircuit in Spectre
Post by boe on Apr 14th, 2011, 3:51am

apprentice,

If you have a SPICE subcircuit, you need lang=spice somewhere at the beginning of your subcircuit. However, your netlist extract does not show this.

Is the include statement before or after the use of abc_model? Is the path correct?

B O E

Title: Re: Using a SPICE subcircuit in Spectre
Post by apprentice on Apr 14th, 2011, 9:03am

B O E,

The first line of abc_model.scs is below.  
      simulator lang=spectre insensitive=yes

Path is correct.

don't quite understand the quoted question. A few lines of the input.scs are below.
"Is the include statement before or after the use of abc_model?"

input.scs
 // Generated for: spectre
// Generated on: Apr  4 22:06:27 2011
// Design library name: abc
// Design cell name: tb_abc
// Design view name: schematic
simulator lang=spectre
global 0
include "/home/../abc_model.scs
...


one question on CDF parameter
  name:  (shall it be exactly same as subckt name defined in netlist?)
In my case, the name should be "abc_model" instead of "model".



thanks

Title: Re: Using a SPICE subcircuit in Spectre
Post by boe on Apr 14th, 2011, 12:20pm

apprentice,

I define all subcircuits before I use it. So, you should have the include statement first, and only later use the abc_model (i.e. create instances of it).

The line (reply #14)
I1 (in_p in_n out) abc_model
should use abc_model if it is known to the simulator.

I assume the parameter model should create an instance parameter "model (Model name)" that should be used for netlisting if you set all other parameters correctly.

This is a thread on how to use a SPICE model, so I am surprised that you have lang=spectre.

B O E

[Added:] NB: There are some differences in syntax between SPICE and Spectre, so it is important to define the language properly.

Title: Re: Using a SPICE subcircuit in Spectre
Post by boe on Apr 14th, 2011, 12:41pm

apprentice,

You seem to have a problem in the netlist. So please post your latest version so we can have a look at it

B O E

The Designer's Guide Community Forum » Powered by YaBB 2.2.2!
YaBB © 2000-2008. All Rights Reserved.