search tips

advanced search

site search by freefind

                        

 

                                        

hspice

Nanosim

spectre

Ultrasim  

smartspice  

Welcome to Spiceguy.net.
Today is: Tuesday March 19, 2024

Measuring Capacitance

This page shows how to measure input capacitance on an inverter, first using AC Analysis frequency response and then again using transient analysis for comparison.

1)  Procedure to Measure Capacitance using AC Analysis

This example shows how to measure input capacitance on an inverter input using AC analysis.   Below is the HSPICE source (omitting the transistor model setup).   See the comments which explain how capacitance "c_comp" is measured.  All lines beginning with asterisk (*) are comments in HSPICE.   Any text after a "$" is also a comment.  The HSPICE output file with the measured capacitance is also shown after the source code.

 

A)  HSPICE SOURCE CODE USING AC ANALYSIS

 

********===============================================================********
***************** Power Supplies Parameters and Connection ****************
********===============================================================********

*
*  Set frequency parameter to 100MHz and pi constant:

*

.param pfreq = 100x                   $ Input Frequency in AC analysis, 100MHz
+                 pi = 3.1415926535   $ value of pi

*
* Global Supply parameters:
*
.param pvss = 0.00V
+ pvdd =   1.50V
+ pvdd2 = 'pvdd * 0.50'
+ pvih   = 'pvss'
+ pvil    = 'pvdd'
*
* Supply Setup -
VVDD VDD 0  DC 'pvdd'
VVSS   VSS  0  DC 'pvss'
********===============================================================********

*

*

********===============================================================********
***************** Circuit Hookup and Output Loading ****************
********===============================================================********
*
XINV    VDD   VSS   A    Z     INV  WP=2.04u  WN=1.42u
*

.NODESET V(A)='pvdd2'      $ Initial DC Bias for AC Sweep
********===============================================================********
*
********===============================================================********
***************** AC ANALYSIS and C_Comp Measurement                                *****************
********===============================================================********
*
* This performs a frequency sweep by 10 points per decade from 1kHz to 1GHz:
*
.AC DEC  10   1K   1000x
*
* #####################################################################
* ################ Start AC Analysis for net: "A"                         ##############
* ################ >> Can only run one net at a time <<               ##############
* #####################################################################
*
* Net "A" voltage source has vdd/2 DC bias and 1mV  RMS  AC bias:
*
VINAC_A   A  VSS   DC 'pvdd2'  AC   1mV
*
* .NET starts the AC Network Analysis (VINAC..  is input voltage source) :
* -------------------------------------------------------------------
* Syntax for 1-port : .net VINAC  <--- using this one and measuring ZIN.
* Syntax for 2-ports: .net v(out_node) VINAC
* ------------------------------------------
*
.NET VINAC_A
*
* These are the real (ZR_A) and imaginary parts (ZI_A) of input impedance (ZIN) :
*
*measure ac  ZR_A   FIND ZIN(R)  AT = 'pfreq' (commented out/see below for "res_A")
.measure  ac  ZI_A     FIND ZIN(I)   AT = 'pfreq'
*
*  General Impedance:  ZIN = ZR +  j x ZI  (where j = sqrt(-1) 
*
* so we have:    j x ZI = 1/(j x omega x Cin) --> ZI = -1/(omega x Cin)
*
* ---> Cin = abs (1/(omega x ZI_A)),   where omega = 2 x pi x f and abs is absolute value.
* ---> Cin = abs (1/(2 x pi x f x ZI_A))
*
.measure ac   c_comp_A    param ='abs(1.0/(2.0*pi*pfreq*ZI_A))'
.measure ac   res_A           FIND ZIN(R) AT = 'pfreq'
*
*
********===============================================================********
**************** Output Signals                                                                                     ****************
********===============================================================********
*
.probe ac   ZIN(R)    ZIN(I)
*
********===============================================================********

 

B)  HSPICE OUTPUT  FOR AC ANALYSIS (".lis" file)  (run on linux box)

 

Here is a portion of the HSPICE output ".lis"  file.   Marked in blue we see first the Nodal Capacitance Table estimates our

capacitance to be 4.526fF,  and the result of the AC analysis is 6.845fF using our setup.

****** HSPICE -- W-2004.09 (20040730) 11:53:10 05/19/2007 linux
******
r0: test_cap_tran, c_comp typ. 25c
****** operating point information tnom= 27.000 temp= 65.000
******
***** operating point status is all simulation time is 0.
nodal capacitance table
node = cap node = cap node = cap

+0:a = 4.526f     0:vdd = 8.432f 0:vss = 6.441f
+0:z = 4.720f

r0: test_cap_tran, c_comp typ. 25c
****** ac analysis tnom= 27.000 temp= 65.000
******
zi_a=-232.498k
c_comp_a= 6.845f

res_a= 471.341

***** job concluded
****** HSPICE -- W-2004.09 (20040730) 11:53:10 05/19/2007
******
r0: test_cap_tran, c_comp typ. 25c
****** job statistics summary tnom= 27.000 temp= 65.000
******

total memory used 473 kbytes

# nodes = 5 # elements= 5
# diodes= 0 # bjts = 0 # jfets = 0 # mosfets = 2

analysis time # points tot. iter conv.iter

op point 0.00 1 7
ac analysis 0.00 61 61
readin 0.11
errchk 0.03
setup 0.01
output 0.00
total cpu time 0.15 seconds
job started at 11:53:10 05/19/2007
job ended at 11:53:13 05/19/2007

 


2)  Alternate Method to Measure Capacitance using Transient Analysis

This example shows how to measure input capacitance on an inverter input using transient analysis.   Below is the HSPICE source, omitting the transistor model setup.   See the comments which explain how capacitance "c_comp" is measured.  All lines beginning with asterisk are comments in HSPICE.   Any text after a "$" is also a comment.  The HSPICE output with result is also shown after the source code.

                                                                                           

This is done using the formula for current through a capacitor:   I = C x  delta-V/delta-T,   or  C = I x delta-T/delta-V

 

The final result will be the average of the above formula run twice:  First with a rising input, and then with a falling input.  Answer is shown in blue below.

 

 

A)  HSPICE SOURCE CODE USING TRANSIENT ANALYSIS

* Set triangle pulse timing parameters here :
* -----------------------------------------
.param ptr = 1.0n                 $ Input Pulse rise time = 1ns
+ ptf           = 1.0n                 $ Input Pulse fall time = 1ns
+ ptd          = 1.0n                 $ delay to start pulse
+ pstop      = 'ptd+ptr+ptf'   $ End of simulation

* Global Supply parameters:
.
.param pvss = 0.00V
+          pvdd = 1.50V
+          pvdd2 = 'pvdd * 0.50'
+          pvih = 'pvdd2 + 250mV'     $ gives delta-V = 0.5V
+          pvil =   'pvdd2 - 250mV'
*
* Supply Setup
* -----------------------------
VVDD VDD 0 DC 'pvdd'
VVSS VSS    0 DC 'pvss'

*

********===============================================================********
***************** Circuit Hookup                                                                                  ****************
********===============================================================********
*
XINV    VDD  VSS   A    Z     INV      WP=2.04u   WN=1.42u

********===============================================================********
***************** TRANSIENT ANALYSIS                                                              *****************
********===============================================================********
*
*----------------
.TRAN 10p 'pstop'
*----------------
*
* Note: Pulse below starts at Vdd/2 just to get cap. table value at A = Vdd/2.
* Then you have triangle pulse with same slope at each side:
*
VA  A VSS   PWL (0.00n 'pvdd2'    'ptd/5' 'pvil'     'ptd' 'pvil'    'ptd+ptr' 'pvih'       'ptd+ptr+ptf' 'pvil')

*

*   Note:  Slew rate = (pvih - pvil) / (ptr) = 0.5V/1.0 nS
*

********===============================================================********
***************** Measure Statements                                                                        ****************
********===============================================================********
*
* This assumes node "A" is your net for cap measurement, and "VA"
* is the PWL source with slow (0.5V/nS) ramp.
*
*  CALCULATE THE 20/80/50%  LEVELS:
.measure tran ptrp20m param = 'pvil + (pvih-pvil)*0.20'
.measure tran ptrp80m param = 'pvil + (pvih-pvil)*0.80'
.measure tran ptrp50m param = 'pvil + (pvih-pvil)*0.50'
*
.measure tran DELTA_V  param = '(pvih-pvil)*0.60'    $ Using 20-80% of swing for DELTA_V, which is 60%
*
Here_are_IIH_and_IIL for Rising Waveform:
.measure tran IIHR  FIND I(VA) WHEN V(A) = ptrp80m   td='ptd/2'

.measure tran IILR   FIND I(VA) WHEN V(A) = ptrp20m   td='ptd/2'
*

Here_are_IIH_and_IIL for Falling Waveform:
.measure tran IIHF   FIND I(VA) WHEN V(A) = ptrp80m  td='ptd+ptr'
.measure tran IILF   FIND I(VA) WHEN V(A) = ptrp20m  td='ptd+ptr'
*

* Here is the 20-80% Rise Time:
.measure tran DT_R trig V(A) val='ptrp20m' td='ptd/2' rise=1
+                                 targ V(A) val='ptrp80m' td='ptd/2' rise=1

*

* Here is the 80-20% Fall Time:
.measure tran DT_F trig V(A) val='ptrp80m' td='ptd/2' fall=1
+                                 targ V(A) val='ptrp20m' td='ptd/2' fall=1
*

* Now use C = I x delta-T/delta-V:
.measure tran  C_compR         param = 'abs(IIHR-IILR) * DT_R / (DELTA_V)'     $ Capacitance for Rising Pulse
.measure tran  C_compF          param  = 'abs(IIHF-IILF) * DT_F / (DELTA_V)'      $ Capacitance for Falling Pulse
.measure tran  C_comp_avg    param = '(C_compR+C_compF) / 2.0'                         $ Average value
*
*
********===============================================================********
**************** Output Signals                                                                                    ****************
********===============================================================********
*
* Power Supplies and Global Signals :
*
.probe tran  V(VDD) V(VSS)   V(A)   V(Z)
*
********===============================================================********

 

 

B)  HSPICE OUTPUT  (".lis" FILE)

 

Here is a portion of the output .lis  file.   The result is slightly less than the AC method using the transient method which averages the currents for the rising and falling inputs.

 

******
r0: test_cap_tran, c_comp typ. 25c
****** transient analysis tnom= 27.000 temp= 65.000
******
ptrp20m= 600.000m
ptrp80m= 900.000m
ptrp50m= 750.000m
delta_v= 300.000m
*
iilr= -4.538u
iihr= -2.719u
iihf= 2.688u
iilf= 6.436u
dt_r= 600.000p targ= 1.800n trig= 1.200n
dt_f= 600.000p targ= 2.800n trig= 2.200n

*
c_compr= 3.638f
c_compf= 7.496f
c_comp_avg= 5.567f   (Compare to c_comp_a= 6.845f we had before using AC analysis)

***** job concluded
****** HSPICE -- W-2004.09 (20040730) 14:28:16 05/19/2007
******
r0: test_cap_tran, c_comp typ. 25c
****** job statistics summary tnom= 27.000 temp= 65.000
******

total memory used 604 kbytes

# nodes = 5 # elements= 5
# diodes= 0 # bjts = 0 # jfets = 0 # mosfets = 2

analysis time # points tot. iter conv.iter

op point 0.00 1 7
transient 0.01 301 318 156 rev= 0
readin 0.11
errchk 0.04
setup 0.00
output 0.00
total cpu time 0.16 seconds
job started at 14:28:16 05/19/2007
job ended at 14:28:23 05/19/2007


 

                                            HOME | SPICE | EDUCATION | NEWS     [Back to Top]

Send email to Doran@Spiceguy.net with questions or comments about this web site.  Copyright © 2011 by Spiceguy.net.  Last modified: 12/09/11