Language : Spectre

The Spectre language plugin attempts to support the syntax of the Cadence Spectre simulator.

Not all features of Spectre are supported, but those that work will work with Spectre syntax. Wherever possible, Gnucap features will work in Spectre mode, even if they don't work in Spectre.

The Spectre mode is case sensitive, and uses “SI” units.

The “SI” units are case sensitive. 1p is 1e-12. 1P is 1e15. 1m is 1e-3. 1M is 1e6.

Comments are preceded by // and extend to the end of the line.

The format is line oriented. A newline terminates a statement. You can extend a line by ending it with \ .

From startup, you can set Spectre mode with the command line:

simulator lang=spectre

or

spectre

Components

All components have the same syntax:

label (port list) type arguments
  • Label : a string. The first letter has no significance.
  • Port list : A list of the ports (connections), whitespace delimited. Mapping is determined by order. The port list should be surrounded by parentheses.
  • Type : The type of component. If there is a “model” statement, this is the name in the model statement. Otherwise, it could be the name of a “subckt”, a Verilog “module” or “paramset”, or a standard device. This is called “master” in the Spectre manual.
  • Arguments : A list of arguments (parameters or values). All arguments are name = value pairs, of the form “name = value”, whitespace delimited. The value may be an expression.
Rload (out 0) resistor r=10K
X1 (out in vc) amp rload=100K

There are some components that exploit the syntax in other languages that are not supported in Spectre mode, but you can use them by switching to a mode that does support that syntax.

Vcc (vc  0) vsource  dc=15 // Spice-style source arguments are not supported.
Vin (in  0) vsource  ac=1  // Spice-style source arguments are not supported.

But you can switch modes, to one that does support the syntax:

// assume it is starting in Spectre mode
- spice
* It takes Spice syntax now
Vcc (vc 0) dc 15
Vin (in 0) ac 1
* Commands in Spice mode start with a dot.
.spectre
// Now it is back in Spectre mode.

Top-level blocks

Two top level blocks are supported: model and subckt.

model

A “model” statement sets parameters based on an existing compiled model. This will be extended to cover all “masters”. It becomes a “master” that can be instantiated later. It is equivalent to a spice ”.model” or a Verilog “paramset”.

The syntax is:

"model" newname itsmaster parameters
  • model : Keyword identifies a model statement.
  • newtype : The new type being defined. This can be used as a device type later.
  • itsmaster : The type it is derived from.
  • Arguments : A list of arguments (parameters or values). All arguments are name - value pairs, of the form “name = value”, whitespace delimited. The value may be an expression.
model gp_npn npn bf=150

subckt

subckt amp (out in vcc)
parameters rload=10k
Rb1   (base vcc)      resistor  r=1M  // 1 megohm
Rb2   (base 0  )      resistor  r=100k
Rc    (col  vcc)      resistor  r=100k
Re    (emit 0  )      resistor  r=10k
Ce    (emit 0  )      capacitor c=1m  // 1 millifarad
Cin   (base in )      capacitor c=1u
Q1    (col base emit) gp-npn
Q2    (vcc col e2)    gp-npn
Re2   (e2   0  )      resistor  r=1k
Cout  (e2   out)      capacitor c=10u
Rload (out 0  )       resistor  r=rload
ends amp
X1    (out in vc)     amp      rload=100k
Vcc   (vc  0)         vsource  dc=15
Vin   (in  0)         vsource  ac=1
Rload (out 0)         resistor r=10k

Commands

Commands usually have the same syntax as components, but there is no port list.

The Spectre mode does not introduce any new commands. The only change is the syntax.

In Spectre mode, there is a label before the command, like a component. The label names a file which will contain the results of the command. The filename extension is the command.

As an non-standard extension, using a dash '-' as the label sends the command output to the standard output.

Commands are executed in the order given.

setbias op
response ac start=20 stop=20K dec=10
- ac

This is equivalent to the native mode:

op >setbias.op
ac start=20 stop=20K dec=10 >response.ac
ac

Extras

  • You can switch languages any time with the appropriate command. The command must be in spectre syntax, with a label or dash first. The command to switch back must be issued in the language you switched to.

Status

The current implementation in gnucap differs slightly from the Cadence product.

  • The “master” must be defined before it is referenced.
  • The devices and commands are whatever gnucap has installed, which are probably different from what Spectre (the simulator) provides.
  • The circuit must be defined before any commands using it, unless you want to simulate a partial circuit. Scripted and interactive modifications to the circuit are done the way gnucap usually does.
  • There is an interactive mode, with spectre syntax.
gnucap/manual/languages/spectre.txt · Last modified: 2015/12/11 15:39 (external edit)
 
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Run by Debian Driven by DokuWiki