I just ran the test diode schematic in xschem. I got the following I vs V graph. Is it correct ? The...
r
I just ran the test diode schematic in xschem. I got the following I vs V graph. Is it correct ? The area parameter is set to 1. Does the large value of Voltage (Giga Volts!) has something to do with this ?
image.png
c
Looks like the characteristic of
GMIN
to me ... whatever diode you put into the netlist is probably invisible to SPICE. For what it's worth
test_diode.sch
misbehaves the same way in my simulation environment.
r
**.subckt test_diode I1 net1 0 0 Vk1 net1 K1 0 D1 0 K1 sky130_fd_pr__diode_pw2nd_05v5 area=1 Vk2 net2 K2 0 D2 0 K2 sky130_fd_pr__diode_pw2nd_11v0 area=1 F1 0 net2 vk1 1 ** begin user architecture code .control save all dc i1 0 50u 0.1u plot k1 k2 .endc ** manual skywater pdks install (with patches applied) * .lib /home/shahid/open_pdks/sky130A/libs.tech/ngspice/models/sky130.lib.spice tt ** opencircuitdesign pdks install .lib /home/shahid/open_pdks/sky130A/libs.tech/ngspice/sky130.lib.spice tt .param mc_mm_switch=0 .param mc_pr_switch=0 ** end user architecture code **.ends ** flattened .save nodes .save I(Vk1) .save I(Vk2) .end
ngspice does issue this warning
c
I get essentially the same SPICE netlist ... and the same misbehavior.
r
I wanted to insert some diodes in the layout to fix some antenna violations. I just ran a quick simulation to observe the behavior and threshold but got this behavior. The documentation says the spice models are valid from -5 to 5V.
c
Same warnings here ... anyhow, within its minimum conductance settings, ngspice simulates an open circuit. I have no idea why ngspice doesn't find a diode model that behaves well.
r
@Stefan Schippers
s
@Rana Muhammad Shahid Jamil yes i have the same issue, looks like the diode is an open circuit... investigating...
@Rana Muhammad Shahid Jamil @Christoph Maier simulation works if you remove the '`AREA=1`' parameter in diode lines. Try manually editing the
test_diode.spice
file after xschem generates the netlist and before doing the simulation. My understanding is that you should give the layout area of the diode with an AREA parameter, and since the skywater has a
.option scale=1e-6
a value of AREA=1 should correspond to 1um^2 diode. However in model definition default value for area is
area = 1.0e+12
. I don't know what does
1e12
area diode correspond to in physical dimensions. Is it a 1um^2 area? or a 1 square meter (1000000um x 1000000um = 1e12um^2)? @Tim Edwards In order to make simulation produce realistic data i have changed the default AREA to 1e12, same as the default value in model files. Thank you for pointing out this issue.
t
The
.option scale
applies to area as well, so
area=1
should correspond to 1um^2. Apparently it doesn't, though. I'm not sure where that discrepancy comes from.
s
@Tim Edwards Will try a simple diode tomorrow and see how it behaves with varying
area
and
.option scale
.
@Tim Edwards It looks that the AREA parameter in diodes is not scaled by .option scale, Following example...
Copy code
** test diode scaling with area and .option scale **
.option scale=1
vvcc vcc 0 0.65
d1 vcc 0 D1N4148 area=1
.control
op
print vvcc#branch
quit
.endc

.MODEL D1N4148 D
+ IS = 4.352E-9 N = 1.906 BV = 110 IBV = 0.0001 RS = 0.6458 CJO = 7.048E-13
+ VJ = 0.869 M = 0.03 FC = 0.5 TT = 3.48E-9
.end
...with diode
area=1
and
.option scale=1
yields
-2.24933e-03
diode current. Same example with diode
area=100
and
.option scale=0.1
yields
-2.24933e-01
current. So the diode
area
parameter is taken as an absolute multiplier, not affected by
.option scale
. I don't remember (and i have no more access to) hspice behavior, so i don't know if above behavior is a bug or not.
@Tim Edwards in some hspice slides (i assume here hspice does the right thing, which is of course questionable) it is specified that .option scale should affect diodes too...
I think time has come to file a bug 🙂
r
@Stefan Schippers really appreciate you pursuing the bug. Was wondering about the un recognised parameter warnings that ngspice throws in shell. Does ngspice not support these parameters?
s
@Rana Muhammad Shahid Jamil yes, there are some unrecognized parameters. In my simple test_diode schematic i get:
unrecognized parameter (vb) - ignored
unrecognized parameter (gap1) - ignored
unrecognized parameter (gap2) - ignored
unrecognized parameter (xw) - ignored
I hope these are second order parameters, however, yes, this is another issue to be fixed.
I need to carefully write the bug fix requests, ngspice bug tracking is flooded with bugs that are not bugs, like: • ngspice updated the boltzman constant that in recent precise measures is more accurate and different from the k constant used in original spice2 40 years ago. Some users are complaining because they see microvolt differences. I find it very funny that someone asks to use a wrong physical constant (by today measuring standards) just to preserve compatibility with some 40 years old spice implementation. • Some users ask the unary - operator takes precedence over exponentiation, so that -1^2 should get 1 instead of ngspice result of -1. This, also according to operator precedence of mainstream authoritative programming languages is not a bug, ngspice does the right thing. (well,
awk -2^2 -->-4, tcl -2**2 -->4
so best thing to avoid ambiguity is use parenthesis) Anyway, this is the bug report.
r
Bug report looks good. nice work!
s
If anyone has access to HSPICE or other commonly used simulators please test if diode scales with
.option scale
By lurking into the code, ngspice has a diosetup.c file where:
Copy code
...
here->DIOarea = here->DIOarea * scale * scale;
...
So diode should be scaled. Ngspice devs are looking into the issue.
@Rana Muhammad Shahid Jamil @Tim Edwards I have investigated the diode issue. Ngspice does scale diode geometric parameters (area, perimeter) if a
LEVEL=3
is present in the diode model, and we have that level parameter in diode models. I have manually changed the
.option scale=1e-6
to
.option scale=100e-6
in
.../share/pdk/sky130A/libs.tech/ngspice/all.spice
and I/V characteristics of diodes change considerably (bottom picture with .option
scale = 100e-6
show a much lower Vbe for both diodes, since they are now 10000 times bigger). Both simulations below are done with AREA=1e12 set on diode lines:
Copy code
**.subckt test_diode
I1 net1 0 0
Vk1 net1 K1 0
.save  i(vk1)
D1 0 K1 sky130_fd_pr__diode_pw2nd_05v5 area=1e12
Vk2 net2 K2 0
.save  i(vk2)
D2 0 K2 sky130_fd_pr__diode_pw2nd_11v0 area=1e12
F1 0 net2 vk1 1
.control
save all
dc i1 0 50u 0.1u
plot k1 k2
.endc
.lib /home/schippes/share/pdk/sky130A/libs.tech/ngspice/sky130.lib.spice tt
.end
What is not clear to me is what AREA parameter do i need to specify on diode lines to simulate a 1um^2 diode. From the pictures it seems that AREA=1e12 yields an I/V characteristics that is compatible for a 1um^2 device, although considering the .option scale=1e-6 and AREA=1e12 this would be the specification of a 1 square meter diode.
Also i noticed that ngspice is aligned with HSPICE, from Hspice device models reference manual: Setting Scaling Options â–  Use the SCALE element option to scale LEVEL=2 and LEVEL=3 diode element parameters. â–  Use the SCALM (scale model) option to scale LEVEL=2 and LEVEL=3 diode model parameters. LEVEL=1 does not use SCALE or SCALM. So a diode without LEVEL=2 or LEVEL=3 is not scaled. This is probably to preserve models for discrete devices from unwanted scaling.
r
Great work. But does
.option scale=1u
scales
area
parameter by
1u (10^-6)
or by
1u^2 (10-12)
? nvm i saw diosetup.c code . it is scaled by
10^-12
t
@Stefan Schippers: Thanks for researching this.
s
@Rana Muhammad Shahid Jamil All linear geometric parameters of semiconductor deviecs scale with
SCALE
(so, W, L, perimeters and so on). All area parameters (usually for Diodes and BJTs) scale with
SCALE^2