Electronic – Negative time measurement with hspice

spice

I was wondering what the best way to measure the standard tPHL, tPLH parameters was in HSPICE. Specifically I was wondering the best way to address the negative values I am getting.

I have a circuit with 2 connected inverters terminating a capacitor to ground.

I am attempting to measure the high-low time by looking at when the signal starts and stops.

I am confused as to the why when I measure tplh2, the time for the second inverter to fall and rise I get a negative time.

What is going on here?

* 2 inverters, and negative delay
.LIB 'models15.txt' MOS
M1 OUTa IN VDD VDD pch L=1.5u W=6u
M2 OUTa IN 0   0   nch L=1.5u W=3u
M3 OUTb OUTa VDD VDD pch L=1.5u W=6u
M4 OUTb OUTa 0   0   nch L=1.5u W=3u
CL 0 OUTb 1p

VVDD VDD 0 5
VIN IN 0 0 PULSE 0 5 3n 1n 1n 7n 20n
.DC VIN 0 5 0.05
.PRINT DC V(IN) V(OUTb)
.PRINT DC V(IN) V(OUTa)
.TRAN 100p 100n
.PRINT TRAN V(IN) V(OUTb)
.PRINT TRAN V(IN) V(OUTa)
.measure tran tphl1 trig v(IN) val='0.5*5' rise=1 targ v(OUTa) val='0.5*5' fall=1
.measure tran tplh1 trig v(IN) val='0.5*5' fall=1 targ v(OUTa) val='0.5*5' rise=1
.measure tran tphl2 trig v(IN) val='0.5*5' rise=1 targ v(OUTb) val='0.5*5' fall=1
.measure tran tplh2 trig v(IN) val='0.5*5' fall=1 targ v(OUTb) val='0.5*5' rise=1
.OPTIONS LIST NODE POST
.END

Output

.TITLE '* inverter circuit'
 tphl1            tplh1            tphl2            tplh2
 1.054e-10        5.715e-11        9.190e-09       -6.982e-09

Best Answer

Probably, the answer will not be relevant to you now, but I'll try to see whether I still remember this stuff.

I see few suspicious parts in your code. Let's separate them into two categories: misunderstanding of theoretical concepts and coding errors.

Theoretical concepts:

  1. What you measure here are not tPHL (fall time) and tPLH (rise time), but tPD - propagation delay through your circuit. In fact, you're measuring two propagation delays: from input to output of the first inverter (which is loaded by the second inverter) and from input to output of the second inverter (which is loaded by the capacitor).

    tPHL and tPLH are (usually) defined to be the time it takes a voltage at some particular node to fall from 90% to 10%, or to rise from 10% to 90% of its maximal value. The main difference is that propagation delay is measured from one node to another, but rise and fall times are specific parameters of a single node.

    For the purpose of further discussion, lets assume that you intended to measure the propagation delays.

  2. Look at the following line:

    .measure tran tphl1 trig v(IN) val='0.5*5' rise=1 targ v(OUTa) val='0.5*5' fall=1

    here you're measuring the time from 50% of the rising edge of the input to 50% of the falling edge of the first inverter. This is OK.

    However, this line:

    .measure tran tphl2 trig v(IN) val='0.5*5' rise=1 targ v(OUTb) val='0.5*5' fall=1

    states that you're trying to measure the time from 50% of the rising edge of the input to 50% of the falling edge of the second inverter. But when two inverters are connected in series they consistent a buffer, and the voltage at the output of the second inverter will track (with some propagation delay) the voltage at the input of the first inverter. For purpose of this measurement you should've measured the time to the rising edge of the second inverter.

Coding errors:

I'm much less confident in this part, since it has been a while since I used Spice.

  1. What did you use DC analysis for? I believe that if you specify both DC and TRAN analysis, the way it works is executing full TRAN for each step of DC. If this is the case, you should've obtained a set of .measure measurements - one for each step of DC analysis. The fact that you see just one measurement means that it was obtained either at the last step of DC analysis, or it is an average. Anyhow, I suggest that for the purpose of this measurement you'll remove DC analysis completely.
  2. Your input voltage (PULSE) is not symmetrical - its rise time is 1ns but the fall time is 7ns. Usually, when you measure propagation delays, you will define the same rise and fall times for the input signal.

    More accurate way will be adding a buffer between symmetrical input signal and the circuit you're simulating. This will allow the signals that drive your test circuit to imitate signals from a real hardware.

Now to your question: I believe that the negative value you got is related mainly to #2 of Theoretical Concepts, and, maybe, to #1 of coding errors.