ngspice with gEDA cheat sheet

Last update: 2015-07-01

All examples shamelessly copied from the Ngspice Users Manual Version 26plus
Click on the links to toggle the visability of the item.

Elementary Devices

Resistors
General SPICE form:
RXXXXXXX n+ n- <resistance|r=>value <ac=val> <m=val><scale=val> <temp=val> <dtemp=val> <tc1=val><tc2=val> <noisy=0|1>
Possible attributes
device : RESISTOR
refdes : R?
model-name : YOURMODELNAME
model : YOURMODEL

Additionally, gnet_spice_sdb will let us specify the following attributes separately:
l, w and temp
Example:
example attributes resistor


Capacitors

General SPICE form:
CXXXXXXX n+ n− <value> <mname> <m=val> <scale=val> <temp=val> <dtemp=val> <tc1=val> <tc2=val> <ic=init_condition>
Possible attributes
device : CAPACITOR
: POLARIZED_CAPACITOR
refdes : C?
model-name : YOURMODELNAME
model : YOURMODEL

Additionally, gnet_spice_sdb will let us specify the following attributes separately:
area, l, w and ic
Example:
example attributes capacitor

Inductors

General SPICE form:
LYYYYYYY n+ n− <value> <mname> <nt=val> <m=val> <scale=val> <temp=val> <dtemp=val> <tc1=val> <tc2=val> <m=val> <ic=init_condition>
Possible attributes
device : INDUCTOR
: COIL
refdes : L?
model-name : YOURMODELNAME
model : YOURMODEL

Additionally, gnet_spice_sdb will let us specify the following attributes separately:
l, w and ic
Example:
example attributes inductor

Coupled (Mutual) Inductors

General SPICE form:
KXXXXXXX LYYYYYYY LZZZZZZZ value
Possible attributes
device : K
refdes : K?
inductors : L? L?
value : 0.4

Example:
example attributes oupled inductor

Switches

General SPICE form:
SXXXXXXX N+ N− NC+ NC− MODEL <ON><OFF>
WYYYYYYY N+ N− VNAM MODEL <ON><OFF>

NGspice supports two different switches:

  1. Voltage controlled switch S? model sw
  2. Current controlled switch W? model csw

Currently only the voltage controlled switch is supported by the gnet_spice_sdb netlist script. TODO: summit a patch?
Unfortunately gnet_spice_sdb will not let us specify any attributes separately. So we can’t specify whether to switch is initially ON or OFF. TODO: submit a patch?

Possible attributes
device : SPICE-VC-switch
refdes : S?
model-name : YOURMODELNAME
model : YOURMODEL

Example:
example attributes voltage switch

Voltage and Current Sources

Independent Sources for Voltage or Current
General SPICE form:
VXXXXXXX N+ N− <<DC> DC/TRAN VALUE> <AC <ACMAG <ACPHASE>>> <DISTOF1 <F1MAG <F1PHASE>>> <DISTOF2 <F2MAG <F2PHASE>>>
IYYYYYYY N+ N− <<DC> DC/TRAN VALUE> <AC <ACMAG <ACPHASE>>> <DISTOF1 <F1MAG <F1PHASE>>> <DISTOF2 <F2MAG <F2PHASE>>>

From the gnet_spice_sdb perspective this is easy. The device attribute is either a VOLTAGE_SOURCE or a CURRENT_SOURCE and the rest we specify in the value attribute.

Possible attributes
device : VOLTAGE_SOURCE
: CURRENT_SOURCE
refdes : V?
: I?
value : See list below
model-name : YOURMODELNAME
model : YOURMODEL

Possible options for the value attribute are:

  1. Pulse General SPICE form:
  2. PULSE(V1 V2 TD TR TF PW PER)
  3. Sinusoidal General SPICE form:
  4. SIN(VO VA FREQ TD THETA)
  5. Exponential General SPICE form:
  6. EXP(V1 V2 TD1 TAU1 TD2 TAU2)
  7. Piece-Wise Linear General SPICE form:
  8. PWL(T1 V1 <T2 V2 T3 V3 T4 V4 ...>) <r=value> <td=value>
  9. Single-Frequency FM General SPICE form:
  10. SFFM(VO VA FC MDI FS)
  11. Amplitude modulated source (AM) General SPICE form:
  12. AM(VA VO MF FC TD)
  13. Transient noise source General SPICE form:
  14. TRNOISE(NA NT NALPHA NAMP RTSAM RTSCAPT RTSEMT)
  15. Random voltage source General SPICE form:
  16. TRRANDOM(TYPE TS <TD <PARAM1 <PARAM2>>>)

Example:
example attributes voltage source


Linear Dependent Sources

Linear Dependent Source need some special care from the gnet_spice_sdb netlist script. In the gEDA gschem package there are predefined symbols for each source mentioned below.

The gnet_spice_sdb netlist script will add additional "sense" or "measure" sources to make them work properly. As long as we stick to the predefined symbols, working with the linear dependent source is easy. If we need something special gnet_spice_sdb can't help us.

Gxxxx: Linear Voltage-Controlled Current Sources (VCCS)
General SPICE form:
GXXXXXXX N+ N− NC+ NC− VALUE <m=val>

gnet_spice_sdb will not let us specify any attributes separately, so if we need to specify m include it in the value attribute.
Example:
example attributes VCCS source


Exxxx: Linear Voltage-Controlled Voltage Sources (VCVS)

General SPICE form:
EXXXXXXX N+ N− NC+ NC− VALUE

Example:
example attributes VCVS source

Fxxxx: Linear Current-Controlled Current Sources (CCCS)

General SPICE form:
FXXXXXXX N+ N− VNAM VALUE <m=val>

Please note that the general form of a F source takes the name of a voltage source (VNAM) as a reference the gnet_spice_sdb script will generate that voltage source for us. gnet_spice_sdb will not let us specify any attributes separately, so if we need to specify m include it in the value attribute.
Example:
example attributes CCCS source

Hxxxx: Linear Current-Controlled Voltage Sources (CCVS)

General SPICE form:
HXXXXXXX n+ n− vnam value

Please note that the general form of a H source takes the name of a voltage source (vnam) as a reference the gnet_spice_sdb script will generate that voltage source for us.
Example:
example attributes CCVS source

Non-linear Dependent Sources (Behavioral Sources)

Bxxxx: Nonlinear dependent source (ASRC)
Syntax and usage
General SPICE form:
BXXXXXXX n+ n− <i=expr> <v=expr><tc1=value> <tc2=value> <temp=value> <dtemp=value>

One of the great features of the gnet_spice_sdb script is that if it doesn't recognize a device attribute or refdes it will still output a spice line in the form REFDES NODES_FOUND VALUE. We can misuse that feature to make a non-linear dependent source. Just take any source from the library:

And use the standard attributes:
example attributes ASRC source


Exxxx: non-linear voltage source*

Same as the Bxxxx: Non-linear dependent source. Take a look at the ngspice manual for the value attribute option.

Gxxxx: non-linear current source*

Same as the Bxxxx: Non-linear dependent source. Take a look at the ngspice manual for the value attribute option.

Transmission Lines

Lossless Transmission Lines
General SPICE form:
TXXXXXXX N1 N2 N3 N4 Z0=VALUE <TD=VALUE><F=FREQ <NL=NRMLEN>> <IC=V1, I1, V2, I2>

Although gschem library has a transmission line symbol available the gnet_spice_sdb script does not recognize the device attribute nor the refdes. And gnet_spice_sdb will also not let us specify any attributes separately. TODO: submit a patch?
However, one of the great features of the gnet_spice_sdb script is that if it doesn't recognize a device attribute or refdes it will still output a spice line in the form REFDES NODES_FOUND VALUE. We can misuse that feature to make a transmission line. Just take the transmission line symbol from the library:

And use the standard attributes:
example attributes transmission line
Please note that the gschem SPICE library has a transmission line like symbol (wline-1x.sym) that resembles a tline.sym symbol. However the wline-1x.sym uses the W? refdes but the W is reserved for the Current controlled switch (so if we use this symbol we need to change the refdes)


Lossy Transmission Lines

General SPICE form:
OXXXXXXX n1 n2 n3 n4 mname

Unfortunately gnet_spice_sdb will not recognize refdes O? and therefore will also not output the model-name attribute (mname) and the model attribute. TODO: submit a patch?

Uniform Distributed RC Lines

General SPICE form:
UXXXXXXX n1 n2 n3 mname l=len <n=lumps>

gnet_spice_sdb will recognize refdes U? BUT it will assume it's dealing with an integrated chip and therefore it will output the attributes model-name, model and file or the attribute value. If we don't need the l and n options we can misuse that feature to make an uniform distributed RC line.
Example:
example attributes RC lines

Single Lossy Transmission Line (TXL)

General SPICE form:
YXXXXXXX N1 0 N2 0 mname <LEN=LENGTH>

Unfortunately gnet_spice_sdb will not recognize refdes Y? and therefore will also not output the model-name attribute (mname) and the model attribute. TODO: submit a patch?

Coupled Multiconductor Line (CPL)

General SPICE form:
PXXXXXXX NI1 NI2...NIX GND1 NO1 NO2...NOXGND2 mname <LEN=LENGTH>

Unfortunately gnet_spice_sdb will not recognize refdes P? and therefore will also not output the model-name attribute (mname) and the model attribute. TODO: submit a patch?

Active Devices

Junction Diodes
General SPICE form:
DXXXXXXX n+ n− mname <area=val><m=val> <pj=val> <off> <ic=vd> <temp=val><dtemp=val>

n+ and n- are the positive and negative nodes. Personally I find it difficult to remember if the anode is positive or negative and visa-versa, so to make it easier for me, I rewrite the general form as:

DXXXXXXX anode cathode mname <area=val><m=val> <pj=val> <off> <ic=vd> <temp=val><dtemp=val>

gnet_spice_sdb script will also look at the file attribute, this will overwrite the model attribute.
Additionally, gnet_spice_sdb will let us specify the following attributes separately:
temp, ic, area, off

Possible attributes
device : DIODE
Refdes : D?

Example:
example attributes diode


Bipolar Junction Transistors (BJTs)

General SPICE form:
QXXXXXXX nc nb ne <ns> mname<area=val> <areac=val> <areab=val> <m=val><off> <ic=vbe,vce> <temp=val> <dtemp=val>
Possible attributes
device : NPN_TRANSISTOR
: SPICE-NPN
: PNP_TRANSISTOR
: SPICE-PNP
refdes : Q?
model-name : YOURMODELNAME
model : YOURMODEL
file : /Path/To/Spice/File.prm The file attribute will take priority over the model attribute. We can define both in our symbol.

Additionally, gnet_spice_sdb will let us specify the following attributes separately:
temp, ic, area, offExample:
example attributes BJT

Junction Field-Effect Transistors (JFETs)

General SPICE form:
JXXXXXXX nd ng ns mname <area><off> <ic=vds,vgs> <temp=t>
Possible attributes
device : NFET_TRANSISTOR
: PFET_TRANSISTOR
refdes : J?
model-name : YOURMODELNAME
model : YOURMODEL
file : /Path/To/Spice/File.prm The file attribute will take priority over the model attribute. We can define both in our symbol.

Additionally, gnet_spice_sdb will let us specify the following attributes separately:
temp, ic, area, offExample:
example attributes JFET

MESFETs

General SPICE form:
ZXXXXXXX ND NG NS MNAME <AREA><OFF> <IC=VDS, VGS>
Possible attributes
device : MESFET_TRANSISTOR
refdes : Z?
model-name : YOURMODELNAME
model : YOURMODEL
file : /Path/To/Spice/File.prm The file attribute will take priority over the model attribute. We can define both in our symbol.

Additionally, gnet_spice_sdb will let us specify the following attributes separately:
temp, ic, area, offExample:
example attributes MESFET

MOSFET devices

General SPICE form:
MXXXXXXX nd ng ns nb mname <m=val><l=val> <w=val> <ad=val> <as=val> <pd=val><ps=val> <nrd=val> <nrs=val> <off> <ic=vds,vgs, vbs> <temp=t>
Possible attributes
device : NMOS_TRANSISTOR
: PMOS_TRANSISTOR
refdes : M?
model-name : YOURMODELNAME
model : YOURMODEL
file : /Path/To/Spice/File.prm The file attribute will take priority over the model attribute. We can define both in our symbol.

Additionally, gnet_spice_sdb will let us specify the following attributes separately:
temp, ic, area, off, l, w, as, ad, pd,ps, nrd, nrs, mExample:
example attributes MOSFET

Sub Circuit

.SUBCKT Line
Any device can be modelled as a sub circuit, gnet_spice_sdb netlist script defines two explicit devices but will also take any devicename as long as the X? refdes is used.
Apparently this is (or was) mostly used for PMOS and NMOS definitions, but there is no restriction whatsoever to use it for our own frequently used sub circuit.
Possible attributes
device : SUBCKT_PMOS
: SUBCKT_NMOS
: FANTASY_NAME We must use the X? refdes
refdes : X?
model-name : YOURMODELNAME
model : YOURMODEL
file : /Path/To/Spice/File.prm The file attribute will take priority over the model attribute. We can define both in our symbol.

Due to the PMOS and NMOS inheritance, gnet_spice_sdb will let us specify the following additional attributes separately if de device is either SUBCKT_PMOS or SUBCKT_NMOS:
temp, ic, area, off, l, w, as, ad, pd, ps, nrd, nrs, mExample:
example attributes SUBCKT


Mixed-Mode and Behavioral Modeling with XSPICE and gEDA

Introduction
From the gEDA spice netlist script perspective Xspice models all use the same structure and attributes.
Possible attributes
device : FANTASY_NAME We must use the A? refdes
refdes : A?
model-name : YOURMODELNAME
model : XSPICEMODEL Don’t use a fantasy name for the model, check the ngspice manual for the correct model names.
file : /Path/To/Spice/File.prm The file attribute will take priority over the model attribute. We can define both in our symbol.

Most xspice models can be used through the gnet_spice_sdb netlist script without problems as long as they have a single input or output port, like the gain model:a1 1 2 amp
.model amp gain(in_offset=0.1 gain=5.0 out_offset=−0.01)
However if the xspice model has a [vector] as input or output, like the summer model:a2 [1 2] 3 sum1
.model sum1 summer(in_offset=[0.1 −0.2] in_gain=[2.0 1.0] out_gain=5.0out_offset=−0.01)
the standard way will not work.
BUT there is a way to make it work. If we dig deep enough into the script we will find a hidden gem. The hidden gem is an attribute "net-format". We can use that attribute to format how the gnet_spice_sdb script will output the pinsequence numbers into the spice simulation file. We can give the "net-format" attribute the values like the examples in the table below. There are two points important when using the net-format attribute:

  1. always end the value with a space (in the examples below this is the "_" at the end of the net-format attribute value, use a space i.s.o. the "_" character); TODO: submit a patch?
  2. the script will output the pinsequence numbers to the spice simulation file and NOT the pin numbers we have defined in our schematic symbol;

The format of the "net-format" attribute is dependent on the "simple-format" used by scheme and guile.
Take a look at Guile manual. At the bottom of the page we see:
Guile contains a format procedure even when the module (ice-9 format) is not loaded. The default format is simple-format, it doesn’t support all escape sequences documented in this section, and will signal an error if you try to use one of them. The reason for two versions is that the full format is fairly large and requires some time to load. simple-format is often adequate too.
If we dig deeper we find we can use the following format to get what we want.
Examples:

"net-format" attribute value output to spice simulation file
[~a ~a] ~a_ [1 2] 3
[~a] [~a]_ [1] [2]
[~a ~a ~a] [~a]_ [1 2 3] [4]
(~a ~a) ~a_ (1 2) 3

Here is an example for the Analog-to-Digital Node Bridge:abridge2 [1] [8] adc_buff
.model adc_buff adc_bridge(in_low = 0.3 in_high = 3.5)
Example:
example attributes Analog-to-Digital Node Bridge
With this information all the XSPICE models mentioned below can be used with the gnet_spice_sdb netlist script.


Analog Models

Gain
Example Usage:
a1 1 2 amp
.model amp gain(in_offset = 0.1 gain = 5.0 out_offset = −0.01)

Example:
example attributes XSPICE gain


Summer

Example Usage:
a2 [1 2] 3 sum1
.model sum1 summer(in_offset = [0.1 −0.2] in_gain = [2.0 1.0] out_gain = 5.0 out_offset = −0.01)

Example:
example attributes XSPICE summer

Multiplier

Example SPICE Usage:
a3 [1 2 3] 4 sigmult
.model sigmult mult(in_offset = [0.1 0.1 −0.1] in_gain = [10.0 10.0 10.0] out_gain = 5.0 out_offset = 0.05)

Divider

Example SPICE Usage:
a4 1 2 4 divider
.model divider divide(num_offset = 0.1 num_gain = 2.5 den_offset = −0.1 den_gain = 5.0 den_lower.limit = 1e−5 den_domain = 1e−6
+ fraction = FALSEout_gain = 1.0 out_offset = 0.0)

Limiter

Example SPICE Usage:
a5 1 2 limit5
.model limit5 limit(in_offset = 0.1 gain = 2.5 out_lower_limit = −5.0out_upper_limit = 5.0 limit_range = 0.10 fraction = FALSE)

Controlled Limiter

Example SPICE Usage:
a6 3 6 8 4 varlimit
.model varlimit climit(in_offset = 0.1 gain = 2.5 upper_delta = 0.0 lower_delta = 0.0limit_range = 0.10 fraction = FALSE)

PWL Controlled Source

Example SPICE Usage:
a7 2 4 xfer_cntl1
.model xfer_cntl1 pwl(x_array = [−2.0 −1.0 2.0 4.0 5.0]
+ y_array = [−0.2 −0.2 0.1 2.0 10.0]
+ input_domain = 0.05 fraction=TRUE)

Filesource

Example SPICE Usage:
a8 %vd([1 0 2 0]) filesrc.
.model filesrc filesource (file = "sine.m" amploffset = [0 0] amplscale = [1 1]
+ timeoffset = 0 timescale = 1
+ timerelative = false amplstep = false)

multi_input_pwl block

Example SPICE Usage:
a82 [1 0 2 0 3 0] 7 0 pwlm
.model pwlm multi_input_pwl(x_array = [−2.0 −1.0 2.0 4.0 5.0]
+ y_array = [−0.2 −0.2 0.1 2.0 10.0]
+ model = "and")

Analog Switch

Example SPICE Usage:
a8 3 (6 7) switch3
.model switch3 aswitch(cntl_off = 0.0 cntl_on = 5.0 r_off = 1e6 r_on = 10.0 log = TRUE)

Zener Diode

Example SPICE Usage:
a9 3 4 vref10
.model vref10 zener(v_breakdown = 10.0 i_breakdown = 0.02 r_breakdown = 1.0 i_rev = 1e−6i_sat = 1e−12)

Current Limiter

Example SPICE Usage:
a10 3 10 20 4 amp3
.model amp3 ilimit(in_offset = 0.0 gain = 16.0 r_out_source = 1.0
+ r_out_sink = 1.0 i_limit_source = 1e−3
+ i_limit_sink = 10e−3 v_pwr_range = 0.2
+ i_source_range = 1e−6 i_sink_range = 1e−6
+ r_out_domain = 1e−6)

Hysteresis Block

Example SPICE Usage:
a11 1 2 schmitt1
.model schmitt1 hyst(in_low = 0.7 in_high = 2.4 hyst = 0.5
+ out_lower_limit = 0.5 out_upper_limit = 3.0
+ input_domain = 0.01 fraction = TRUE)

Differentiator

Example SPICE Usage:
a12 7 12 slope_gen
.model slope_gen d_dt(out_offset = 0.0 gain = 1.0
+ out_lower_limit = 1e−12 out_upper_limit = 1e12
+ limit_range = 1e−9)

Integrator

Example SPICE Usage:
a13 7 12 time_count
.model time_count int(in_offset = 0.0 gain = 1.0
+ out_lower_limit = −1e12 out_upper_limit = 1e12
+ limit_range = 1e−9 out_ic = 0.0)

S-Domain Transfer Function

Example SPICE Usage:
.model filter s_xfer(gain = 0.139713
+ num_coeff = [1.0 0.0 0.7464102]
+ den_coeff = [1.0 0.9989420.001170077]
+ int_ic = [0 0])
a12 node1 node2 cheby1
.model cheby1 s_xfer(num_coeff = [1] den_coeff = [1 1.09773 1.10251]
+ int_ic = [0 0] denormalized_freq = 1500)
a14 9 22 cheby_LP_3KHz.
.model cheby_LP_3KHz s_xfer(in_offset = 0.0 gain = 1.0 int_ic = [0 0]
+ num_coeff = [1.0]
+ den_coeff = [1.0 1.42562 1.51620])

Slew Rate Block

Example SPICE Usage:
a15 1 2 slew1
.model slew1 slew(rise_slope = 0.5e6 fall_slope = 0.5e6)

Inductive Coupling

Example SPICE Usage:
a150 (7 0) (9 10) lcouple1
.model lcouple1 lcouple(num_turns = 10.0)

Magnetic Core

Example SPICE Usage:
a1 (2 0) (3 0) primary
.model primary lcouple (num_turns = 155)
a2 (3 4) iron_core
.model iron_core core (H_array = [−1000 −500 −375 −250 −188 −125−63 0 63 125 188 250 375 500 1000]
+B_array = [−3.13e−3 −2.63e−3 −2.33e−3 −1.93e−3−1.5e−3 −6.25e−4 −2.5e−4 0 2.5e−4
+ 6.25e−4 1.5e−3 1.93e−3 2.33e−3 2.63e−33.13e−3]
+ area = 0.01 length = 0.01)
a3 (5 0) (4 0) secondary
.model secondary lcouple (num_turns = 310)
a1 (2 0) (3 0) primary
.model primary lcouple (num_turns = 155)

a2 (3 4) iron_core
.model iron_core core (mode = 2 in_low =−7.0 in_high = 7.0
+ out_lower_limit = −2.5e−4 out_upper_limit = 2.5e−4
+ hyst = 2.3 )

a3 (5 0) (4 0) secondary
.model secondary lcouple (num_turns = 310)

Controlled Sine Wave Oscillator

Example SPICE Usage:
asine 1 2 in_sine
.model in_sine sine(cntl_array = [−1 0 5 6]
+ freq_array = [1010 1000 1000] out_low = −5.0
+ out_high = 5.0)

Controlled Triangle Wave Oscillator

Example SPICE Usage:
ain 1 2 ramp1
.model ramp1 triangle(cntl_array = [−1 0 5 6]
+ freq_array = [10 10 1000 1000] out_low = −5.0
+ out_high = 5.0 duty_cycle = 0.9)

Controlled Square Wave Oscillator

Example SPICE Usage:
ain 1 2 pulse1
.model pulse1 square(cntl_array = [−1 0 5 6]
+ freq_array = [10 10 1000 1000] out_low = 0.0
+ out_high = 4.5 duty_cycle = 0.2
+ rise_time = 1e−6 fall_time = 2e−6)

Controlled One-Shot

Example SPICE Usage:
ain 1 2 3 4 pulse2
.model pulse2 oneshot(cntl_array = [−1 0 10 11]
+ pw_array=[1e−6 1e−6 1e−4 1e−4]
+ clk_trig = 0.9 pos_edge_trig = FALSE
+ out_low = 0.0 out_high = 4.5
+ rise_delay = 20.0−9 fall_delay = 35.0e−9)

Capacitance Meter

Example SPICE Usage:
atest1 1 2 ctest
.model ctest cmeter(gain=1.0e12)

Inductance Meter

Example SPICE Usage:
atest2 1 2 ltest
.model ltest lmeter(gain = 1.0e6)

Memristor

Example SPICE Usage:
amen 1 2 memr
.model memr memristor(rmin = 1k rmax = 10k rinit = 7k alpha = 0 beta = 2e13 vt = 1.6)

Hybrid Models

Digital-to-Analog Node Bridge
Example SPICE Usage:
abridge1 [7] [2] dac1
.model dac1 dac_bridge(out_low = 0.7 out_high = 3.5 out_undef = 2.2 input_load = 5.0e−12 t_rise = 50e−9 t_fall = 20e−9)


Analog-to-Digital Node Bridge

Example SPICE Usage:
abridge2 [1] [8] adc_buff
.model adc_buff adc_bridge(in_low = 0.3 in_high = 3.5)

Controlled Digital Oscillator

Example SPICE Usage:
a5 1 8 var_clock
.model var_clock d_osc(cntl_array = [−2 −1 1 2]
+ freq_array = [1e3 1e3 10e3 10e3]
+ duty_cycle = 0.4 init_phase = 180.0
+ rise_delay = 10e−9 fall_delay = 8e−9)

Digital Models

Buffer
Example SPICE Usage:
a6 1 8 buff1
.model buff1 d_buffer(rise_delay = 0.5e−9 fall_delay = 0.3e−9 input_load =0.5e−12)


Inverter

Example SPICE Usage:
a6 1 8 inv1
.model inv1 d_inverter(rise_delay = 0.5e−9 fall_delay = 0.3e−9 input_load =0.5e−12)

And

Example SPICE Usage:
a6 [1 2] 8 and1
.model and1 d_and(rise_delay = 0.5e−9 fall_delay = 0.3e−9 input_load = 0.5e−12)

Nand

Example SPICE Usage:
a6 [1 2 3] 8 nand1
.model nand1 d_nand(rise_delay = 0.5e−9 fall_delay = 0.3e−9 input_load = 0.5e−12)

Or

Example SPICE Usage:
a6 [1 2 3] 8 or1
.model or1 d_or(rise_delay = 0.5e−9 fall_delay = 0.3e−9 input_load = 0.5e−12)

Nor

Example SPICE Usage:
anor12 [1 2 3 4] 8 nor12
.model nor12 d_or(rise_delay = 0.5e−9 fall_delay = 0.3e−9 input_load = 0.5e−12)

Xor

Example SPICE Usage:
a9 [1 2] 8 xnor3
.model xnor3 d_xnor(rise_delay = 0.5e−9 fall_delay = 0.3e−9 input_load = 0.5e−12)

Tristate

Example SPICE Usage:
a9 1 2 8 tri7
.model tri7 d_tristate(delay = 0.5e−9 input_load = 0.5e−12 enable_load = 0.5e−12)

Pullup

Example SPICE Usage:
a2 9 pullup1
.model pullup1 d_pullup(load = 20.0e−12)

Pulldown

Example SPICE Usage:
a4 9 pulldown1
.model pulldown1 d_pulldown(load = 20.0e−12)

D Flip Flop

Example SPICE Usage:
a8 1 2 3 4 5 6 7 flop2
.model flop2 d_jkff(clk_delay = 13.0e−9 set_delay = 25.0e−9
+ reset_delay = 27.0e−9 ic = 2 rise_delay = 10.0e−9 fall_delay = 3e−9)

Toggle Flip Flop

Example SPICE Usage:
a8 2 12 4 5 6 3 flop3
.model flop3 d_tff(clk_delay = 13.0e−9 set_delay = 25.0e−9
+ reset_delay = 27.0e−9 ic = 2 rise_delay = 10.0e−9
+ fall_delay = 3e−9 t_load = 0.2e−12)

Set-Reset Flip Flop

Example SPICE Usage:
a8 2 12 4 5 6 3 14 flop7
.model flop7 d_srff(clk_delay = 13.0e−9 set_delay = 25.0e−9
+ reset_delay = 27.0e−9 ic = 2 rise_delay = 10.0e−9
+ fall_delay = 3e−9)

D Latch

Example SPICE Usage:
a4 12 4 5 6 3 14 latch1
.model latch1 d_dlatch(data_delay = 13.0e−9 enable_delay = 22.0e−9
+ set_delay = 25.0e−9
+ reset_delay = 27.0e−9 ic = 2
+ rise_delay= 10.0e−9 fall_delay = 3e−9)

Set-Reset Latch

Example SPICE Usage:
a4 12 4 5 6 3 14 16 latch2
.model latch2 d_srlatch(sr_delay = 13.0e−9 enable_delay = 22.0e−9
+ set_delay = 25.0e−9
+ reset_delay = 27.0e−9 ic = 2
+ rise_delay = 10.0e−9 fall_delay = 3e−9)

State Machine

Example SPICE Usage:
a4 [2 3 4 5] 1 12 [22 23 24 25 26 27 2829] state1
.model state1 d_state(clk_delay = 13.0e−9reset_delay = 27.0e−9
+ state_file = "newstate.txt" reset_state = 2)

Frequency Divider

Example SPICE Usage:
a4 3 7 divider
.model divider d_fdiv(div_factor = 5 high_cycles = 3
+ i_count = 4 rise_delay = 23e−9 fall_delay = 9e−9)

RAM

Example SPICE Usage:
a4 [3 4 5 6] [3 4 5 6] [12 13 14 15 16 1718 19] 30 [22 23 24] ram2
.model ram2 d_ram(select_value = 2 ic = 2 read_delay = 80e−9)

Digital Source

Example SPICE Usage:
a3 [2 3 4 5 6 7 8 9 10 11 12 13 14 15 1617] input_vector
.model input_vector d_source(input_file = "source_simple.text")

Version used in this note: gEDA 1.8.1
Comments are welcome at ( geda at myken dot nl )