hspicehierarchy.pdf

Upload: popoyboy

Post on 04-Apr-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/29/2019 HSpiceHierarchy.pdf

    1/6

    Design Hierarchy In HSPICEUse of Subcircuits, measurement, and Parameters

    Reza NekoveiElectrical Engineering and Computer Science DepartmentTexas A&M University-Kingsville

    Introduction

    This hand out illustrates a few important techniques for design and measurement of largercircuits using HSPICE:

    1. Hierarchical design2. Delay and power measurement3. Parametric design

    Hierarchical design

    To show how the hierarchy can simplify the netlist (using subcircuits), first the netlist fora NAND gate in figure 1 is created.

    M1 C A Vdd Vdd cmosp L=1U W=10U

    M2 C B vdd Vdd cmosp L=1U W=10UM3 C B M34 0 cmosn L=1U W=10U

    M4 M34 A 0 0 cmosn L=1U W=10U

    Figure 1. Circuit and logic gate representation for a two input NAND gate.

  • 7/29/2019 HSpiceHierarchy.pdf

    2/6

  • 7/29/2019 HSpiceHierarchy.pdf

    3/6

    Figure 2. EXOR gate and its NAND gate based design.

    Finally the EXOR is simulated and verified as shown:

    Delay and Power measurements

    Measure command can help obtain accurate measurement and record them in a texttransient measurement file (filename.mt#). The following command can find the averagepower consumption over given time:

    .measure avg_pow AVG power from=1n to=20n

    The keyword power indicates the instantaneous power dissipation of the circuit. In orderto create measurement outputs add MEASOUT to the options list:

    .OPTIONS PROBE POST MEASOUT

    The following would be written to the measurement file (EXOR.mt0) for the aboveexample:

  • 7/29/2019 HSpiceHierarchy.pdf

    4/6

    $DATA1 SOURCE='HSPICE' VERSION='U-2003.09 '

    .TITLE 'netlist for exor based on 4 nand gates'

    avg_pow temper alter#

    9.580e-04 25.0000 1.0000

    The following are measurement statements for propagation delay at Vdd/2 (50% of Vdd)for the high-to-low (fall) and low-to-high (rise) cases:

    .measure tpLH trig V(in) val='5.0/2' fall=1 targ v(out) val='5.0/2' rise=1

    .measure tpHL trig V(in) val='5.0/2' rise=1 targ v(out) val='5.0/2' fall=1

    Here is their result reported in the filename.mt0 in text:

    $DATA1 SOURCE='HSPICE' VERSION='U-2003.09 '

    .TITLE 'inverter circuit'

    tpLH tpHL temper alter#1.321e-10 1.613e-11 25.0000 1.0000

    The measurement details are also available in the listing file as:

    tpLH= 1.3206E-10 targ= 1.6632E-08 trig= 1.6500E-08

    tpHL= 1.6127E-11 targ= 1.0516E-08 trig= 1.0500E-08

    Where the delays are the difference between trigger times (trig) and target times (targ).

    Parametric design

    The netlist can be simplified by using parameters and algebraic expressions to definerelationships among devices. The following example shows how to use parameters to setMOSFET sizes.

    .param lambda='.25u' $set the scale to .25 micron

    .param wn='3*lambda' $ NMOS width is 3 times scale

    .param wp='wn*2' $ PMOS is twice the NMOS

    .param L1='2*lambda' $ Channel length

    .param Lsource='3*lambda'.param Ldrain='3*lambda'

    * Use the parameters to pass the transistor sizes

    M1 OUT IN VCC VCC cmosp L='L1' W='wp'

    +PS='2*(Lsource+wp)' PD='2*(Ldrain+wp)'

    +AS='Lsource*wp' AD='Ldrain*wp'

  • 7/29/2019 HSpiceHierarchy.pdf

    5/6

    M2 OUT IN 0 0 cmosn L='L1' W='wn' PS='2*(Lsource+wn)'

    +PD='2*(Ldrain+wn)' AS='Lsource*wn' AD='Ldrain*wn'

    The following examples illustrate more uses for parameters and algebraic expressions:

    .measure imax MAX I(nodename)

    .measure vmax MAX V(nodename)

    .measure ivmax param='vmax*imax'

    *Measruring energy in a given interval(10ns to 30ns)

    .measure trans Icc INTEG I(Vcc) From=10ns TO=30ns

    .measure E_cct Param='-Icc*Vdd'

    or to print the result using PAR():

    .print IVMAX = PAR('ivmax')

    The .ALTER statement can be used before the .END statement to rerun a simulationusing different parameters and data. The following example uses this statement to createtwo runs (in filename.tr0 and filename.tr1) for two load capacitances (cL=0.5pF andcL=1.5pF):

    CL out 0 0.5p $ the original load (goes into file.tr0)

    * rerun the simulation using this load (goes into file.tr1)

    .ALTER cL out 0 1.5p

    The .IC statement can be used to set circuit initial conditions, here is an example that set

    initial voltage for a node to 5volts:

    .IC v(nodename)=5v

    Finally, to run the simulation over a given range you can use the SWEEP statement. Thefollowing statement repeats transient analysis over the give temperature range:

    .TRAN 200p 20n SWEEP temp 80 90 10

    and its output is shown in the following figure. Here is one more example showing theuse of parametric load with sweep transient:

    *Use parametric load sweep to find cross points

    .param load='1fF'

    Cload node 0 'load'

    .trans 0.5n 35n sweep load 1fF 12fF 1fF

  • 7/29/2019 HSpiceHierarchy.pdf

    6/6

    Plot of v(in) and v(out) versus time; where v(out) is varying from 80 degrees to 90degrees and values calculated every 10 degrees.