SPICE Import Block

Block Selection Tree: Data ImportSPICE import block

 

This type of block imports a circuit from a file in Berkeley SPICE syntax. It supports up to Berkeley's version 3f4 completely. Syntax extensions from SPICE derivates or commercial SPICE simulators such as HSPICE, PSPICE, LTSPICE, etc. are not supported, generally. A list of supported PSPICE features is given below.

 

An instance of this type is associated with a SPICE sub-circuit embraced in ".subckt" and ".ends". Nested and multiple top-level sub-models can also be dealt with, i.e. this sub-circuit may also contain other sub-circuits defined in the same file. The sub-circuit to use can be selected with the Select model drop-down of the SPICE Import file dialog box if the file contains more than one sub-circuit. It can only be modified by browsing for a SPICE file again. By the Spice Format selector, the user can choose between SPICE dialects SPICE3f4, PSPICE, and Combined. The latter is a combination of SPICE3f4 and a subset of PSPICE, where SPICE3f4 takes precedence over PSPICE, if conflicts occur.

 

 

The file that the block refers to is displayed in the Block Properties - General page. The block offers the usual features of File Blocks like browsing for a new file, editing the referenced project, choice of relative or absolute paths, updating file references and recovery of lost files.

 

Supported PSPICE features:

Defining parameters:

.PARAM name1=value1[,] name2={expression2} ...

.SUBCKT name ... PARAMS: name1=value1 [,] name2={expression2} ...

Examples:

.PARAM  C0=3.e8, MYPI=3.14

.PARAM  A=375.0 B={1.75k+125} C=1.75k

.PARAM  SUM={A+B+C}

.SUBCKT MySub 1 2 PARAMS: A=375.0 B={1.75k+125} C=1.75k

Passing parameters to subcircuits:

Xname node1 ... SUBName PARAMS: name1=value1 [,] name2={expression2} ...

Examples:

X1 1 2 MyInstance PARAMS: epseff=2.13 ls={A+B+C}

Passing parameters to circuit elements:

name ... {expression}

Examples:

ls1  1 2     {ls11_a}

ls2  3 4     {ls22_a}

k12  ls1 ls2 {k12_a}

VALUE keyword:

E|Gname node1 node2 VALUE={expression}

Examples:

GMULT 1 0 VALUE={V(3)*V(5,6)*100}

ERES  1 3 VALUE={I(VSENSE)*10k}

TABLE keyword:

E|Gname node1 node2 TABLE {expression}  = (in1, out1) (in2, out2) ...

E|Gname node1 node2 TABLE {expression}   in1 out1 in2 out2 ...

Examples:

ECOMP 3 0 TABLE {V(1,2)} = (-1mV, 0V)  (1mV, 10V)  (10mV, 1V)

GCOMP 1 2 TABLE {I(VSENSE)} -1uA 0 1mA 1A

POLY keyword:

E|Gname node1 node2 POLY(dim)  input1 input2 ... inputDim   k0 k1 k2 ...

Examples:

EAMP   3 0 POLY(1)  (2,0)               0 500                                

EMULT  3 0 POLY(2)  (1,0) (2,0)         0 0 0 0 1                      

GSUM   6 0 POLY(3)  (3,0) (4,0) (5,0)   0 1.2 0.5 1.2                 

Coefficients:

POLY(1): y=k0 + k1 x1 + k2 x1 x1 + k3 x1 x1 x1 + ...

POLY(2): y=k0 + k1 x1 + k2 x2 + k3 x1 x1 + k4 x2 x1 + k5 x2 x2 + k6 x1 x1 x1 + k7 x2 x1 x1 + k8 x2 x2 x1 + k9 x2 x2 x2 +...

POLY(3): y=k0 + k1 x1 + k2 x2 + k3 x3 + k4 x1 x1 + k5 x2 x1 + k6 x3 x1 + k7 x2 x2 + k8 x2 x3 + k9 x3 x3 + ...  

Note: In SPICE3f4 an input is simply described by two nodes n+ n- while in PSPICE it is formally written as a pair of nodes (n+, n-). In both cases it characterizes the voltage between nodes n+ and n-.     

FUNC statement:

.FUNC name(arg1, arg2, ...) {expression}

Examples:

.FUNC cot(x) {1./tan(x)}

.FUNC stair(x,x1,x2) {if(x<=x1, 0, if(x<x2, 1, 9))}

.FUNC combine(x, y, x1, x2) {alpha*stair(x,x1,x2)*cot(y)}

Note that .FUNC statements can be used in combinations with parameters and parameter expressions via .PARAM statement and can also be nested.

Inline comments:

Comments may follow any statement. Inline comments are started by a semicolon (instead of an asterisk which starts full line comments).

Example:

* Full line comment (also supported by SPICE3f4)

Rgate 3 4 10k ; gate resistor (inline comment)

Supported operators in addition to SPICE3f4 operators:

Exponentiation:             **

Unary NOT:                  ~

Boolean OR:                 |

Boolean XOR:                ^    (Exponentiation in SPICE3f4!)                 

Boolean AND:                &

Equality test:              ==

Non-equality test:          !=

Greater than test:          >

Greater or equal to test:   >=

Less than test:             <

Less than or equal to test: <=

 

Supported functions in addition to SPICE3 functions:

arctan(x)                   alias to atan(x)

atan2(y,x)                  arctan(y/x), four-quadrant     

log(x)                      log base e   (log base 10 in SPICE3f4!)

log10(x)                    log base 10

min(x,y)                    minimum of x and y

max(x,y)                    maximum of x and y

sgn(x)                      signum function

stp(x)                      step function alias to u(x) in SPICE3f4

pwr(x,y)                    |x|y, interchangeable with **

pwrs(x,y)                   signed power function, sgn(x) |x|y

limit(x,lo,hi)              truncate function: lo if x<lo, hi if x>hi, x otherwise

if(c,x,y)                   x if c is true, y if c is false

table(x, x1,y1,x2,y2,...)   tabulated data with linear interpolation and constant extrapolation in x

ddt(x)                      time derivative of x to be used in transient analysis

sdt(x)                      time integral of x to be used in transient analysis  

All device models:

T_ABS:            Applied  absolute temperature in °C

T_MEASURED:       Extraction temperature in °C                       

Diode model:

ISR, NR:          Recombination current modelling

NBV, IBLV, NBLV:  Reverse breakdown modelling

IKF:              High injection current modelling

TBV1, TBV2, TIKF: Temperature coefficients

BJT model:

CN, D, GAMMA, QCO, QUASIMOD, RCO, VO, VG: Quasi-saturation modelling

NK: High-current roll-off modelling

Current-controlled switch model:

ION, IOFF: Hysteresis modelling (replacing IT, IH in SPICE3f4)

Voltage-controlled switch model:

VON, VOFF: Hysteresis modelling (replacing VT, VH in SPICE3f4)

See also

Block Overview, File Blocks