Paralleling devices with multiplier m
When it is needed to simulate several devices of the same kind in parallel, use the `m' (parallel multiplier) instance parameter available for the devices listed in Table 3.1. This multiplies the value of the element's matrix stamp with m's value. The netlist below shows how to correctly use the parallel multiplier:
Multiple device example:
d1 2 0 mydiode m=10
d01 1 0 mydiode
d02 1 0 mydiode
d03 1 0 mydiode
d04 1 0 mydiode
d05 1 0 mydiode
d06 1 0 mydiode
d07 1 0 mydiode
d08 1 0 mydiode
d09 1 0 mydiode
d10 1 0 mydiode
...
The d1 instance connected between nodes 2 and 0 is equivalent to the 10 parallel devices d01-d10 connected between nodes 1 and 0.
The following devices support the multiplier m:
First letter
|
Element description
|
C
|
Capacitor
|
D
|
Diode
|
F
|
Current-controlled current source (CCCs)
|
G
|
Voltage-controlled current source (VCCS)
|
I
|
Current source
|
J
|
Junction field effect transistor (JFET)
|
L
|
Inductor
|
M
|
Metal oxide field effect transistor (MOSFET)
|
Q
|
Bipolar junction transistor (BJT)
|
R
|
Resistor
|
X
|
Subcircuit (for details see below)
|
Z
|
Metal semiconductor field effect transistor (MESFET)
|
Table 3.1: ngspice elements supporting multiplier 'm'
When the X line (e.g. x1 a b sub1 m=5) contains the token m=value (as shown) or m=expression, subcircuit invocation is done in a special way. If an instance line of the subcircuit sub1 contains any of the elements shown in table 3.1, then these elements are instantiated with the additional parameter m (in this example having the value 5). If such an element already has an m multiplier parameter, the element m is multiplied with the m derived from the X line. This works recursively, meaning that if a subcircuit contains another subcircuit (a nested X line), then the latter m parameter will be multiplied by the former one, and so on.
Example 1:
.param madd = 6
X1 a b sub1 m=5
.subckt sub1 a1 b1
Cs1 a1 b1 C=5p m='madd-2'
.ends
In example 1, the capacitance between nodes a and b will be C = 5pF*(madd-2)*5 = 100pF.
Example 2:
.param madd = 4
X1 a b sub1 m=3
.subckt sub1 a1 b1
X2 a1 b1 sub2 m='madd-2'
.ends
.subckt sub2 a2 b2
Cs2 a2 b2 3p m=2
.ends
In example 2, the capacitance between nodes a and b is C = 3pF*2*(madd-2)*3 = 36pF.
Using m may fail to correctly describe geometrical properties for real devices like MOS transistors.
M1 d g s nmos W=0.3u L=0.18u m=20
is probably not be the same as
M1 d g s nmos W=6u L=0.18u
because the former may suffer from small width (or edge) effects, whereas the latter is simply a wide transistor.