Continue to Site

# Problem with Ngspice delay calculation

Status
Not open for further replies.

#### vrarjun

##### Newbie level 3
I am a newbie to ngspice,i am trying to calculate the delay between v(A) and v(Z).I keep getting run simulation aborted error.
Any suggestions would be of great help?.My spice file is given below

.SUBCKT th23 A B C Z VDD GND
M0 nbc C VDD VDD PD L=1 W=25
M2 nba B nbc VDD PD L=1 W=25
M3 ninv_i A nba VDD PD L=1 W=25
M4 ninv_i A nab GND ND L=1 W=15
M5 nab B GND GND ND L=1 W=15
M6 ninv_i C ncab GND ND L=1 W=15
M7 ncab A GND GND ND L=1 W=15
M8 ncab B GND GND ND L=1 W=15
M9 ninv_i Z npbd VDD PD L=1 W=4
M10 npbd B npbc VDD PD L=1 W=25
M11 npbc C VDD VDD PD L=1 W=25
M12 nabc A VDD VDD PD L=1 W=25
M13 nbc2 B nabc VDD PD L=1 W=25
M14 nbc2 C nabc VDD PD L=1 W=25
M15 ninv_i Z nbc2 VDD PD L=1 W=4
M16 ninv_i Z nd3abc GND ND L=1 W=4
M17 nd3abc A GND GND ND L=1 W=15
M18 nd3abc B GND GND ND L=1 W=15
M19 nd3abc C GND GND ND L=1 W=15
M20 Z ninv_i VDD VDD PD L=1 W=25
M21 Z ninv_i GND GND ND L=1 W=15
.ENDS

.param VDD=1.5v
.param GND=0

.save v(A) v(B)

vin1 A VDD 0 pwl (0 GND 100ns VDD 110ns VDD 200ns GND)
vin2 B VDD 0 pwl (0 GND 100ns VDD 110ns VDD 200ns GND)

.options acct

.global VDD! GND!

.tran 100ns 1000ns uic

.control
.measure tran delay_b trig v(B) val='VDD/2' rise=1
+ targ v(Z) val='VDD/2' rise=1
.measure tran delay_b trig v(A) val='VDD/2' rise=1
+ targ v(Z) val='VDD/2' rise=1
run
.endc

I hope ngspice defaults to units of microns otherwise your transistors are very large! I may have missed it, but I cannot see where you have used the circuit th23.

Keith

vrarjun

### vrarjun

Points: 2
Thanks Keith
Are you referring to instances of th23?.This is what i tried now.

X1 A B C Z VDD VSS th23

.SUBCKT th23 A B C Z VDD VSS
M0 nbc C VDD VDD PD L=1e-06 W=15e-06
M2 nba B nbc VDD PD L=1e-06 W=15e-06
M3 ninv_i A nba VDD PD L=1e-06 W=15e-06
M4 ninv_i A nab VSS ND L=1e-06 W=15e-06
M5 nab B VSS VSS ND L=1e-06 W=15e-06
M6 ninv_i C ncab VSS ND L=1e-06 W=15e-06
M7 ncab A VSS VSS ND L=1e-06 W=15e-06
M8 ncab B VSS VSS ND L=1e-06 W=15e-06
M9 ninv_i Z npbd VDD PD L=1e-06 W=4e-06
M10 npbd B npbc VDD PD L=1e-06 W=15e-06
M11 npbc C VDD VDD PD L=1e-06 W=15e-06
M12 nabc A VDD VDD PD L=1e-06 W=15e-06
M13 nbc2 B nabc VDD PD L=1e-06 W=15e-06
M14 nbc2 C nabc VDD PD L=1e-06 W=15e-06
M15 ninv_i Z nbc2 VDD PD L=1e-06 W=4e-06
M16 ninv_i Z nd3abc VSS ND L=1e-06 W=4e-06
M17 nd3abc A VSS VSS ND L=1e-06 W=15e-06
M18 nd3abc B VSS VSS ND L=1e-06 W=15e-06
M19 nd3abc C VSS VSS ND L=1e-06 W=15e-06
M20 Z ninv_i VDD VDD PD L=1e-06 W=15e-06
M21 Z ninv_i VSS VSS ND L=1e-06 W=15e-06
.ENDS th23

.param VDD=1.5v
.param VSS=0

.tran 10ns 500ns UIC
.probe v(A) v(B) v(C)

vin1 A VDD 0 pwl (0 VDD 10ns VDD 50ns VDD 100ns VSS 150ns )
vin2 B VDD 0 pwl (0 VDD 100ns VDD 50ns VDD 100ns VSS 150ns VDD 200ns VDD)
vin3 C VDD 0 pwl (0 VSS 100ns VSS 50ns VSS 100ns VSS 150ns VDD 200ns VDD)

.meas tran delay_b trig v(B) val=0.75 rise=1
+ targ v(Z) val=0.75 rise=1
.meas tran delay_b trig v(A) val=0.75 rise=1
+ targ v(Z) val=0.75 rise=1
.options acct

.control
print all
run
plot v(A) v(Z)
.endc

.end

ERROR
Warning : voltage source vin2 has non-increasing PWL time points.
Warning : voltage source vin3 has non-increasing PWL time points.
Error on line 0 : m.x1.m0 x1.nbc c vdd vdd x1.pd x1.l=1e-06 w=15e-06
Unable to find definition of model x1.pd - default assumed

unknown parameter (x1.l)
Error on line 0 : m.x1.m2 x1.nba b x1.nbc vdd x1.pd x1.l=1e-06 w=15e-06
Unable to find definition of model x1.pd - default assumed

unknown parameter (x1.l)
Error on line 0 : m.x1.m3 x1.ninv_i a x1.nba vdd x1.pd x1.l=1e-06 w=15e-06
Unable to find definition of model x1.pd - default assumed

unknown parameter (x1.l)
Error on line 0 : m.x1.m4 x1.ninv_i a x1.nab vss x1.nd

You need to have some models that match the names you have used e.g. PD and ND.

You have an odd number of values in vin1 - you need a point pair for each point.

Personally I would always avoid using the same name for a parameter and a device and/or net. While the simulator may or may not get confused, it never makes things easier to understand. You have used Vdd as both a net name and a parameter.

What you have posted there is incomplete as there is no power supply. Also, I don't know about ngspice but a lot of simulators treat only node zero as ground so you may need to add something like Vgnd VSS 0 0 to short VSS to node zero.

Keith

vrarjun

Points: 2