Sei sulla pagina 1di 2

How to Measure Energy in Cadence and HSPICE

1) When creating your schematic, place transistors and any supply or input voltage sources as
usual. Also place an additional supply voltage source to be used to supply transistors for which
you don’t want to measure power.

2) Connect the “vdd” and “gnd” rails to one of the supply sources and all transistors for which
you want to measure power.

3) Connect another set of rails (“vdda” and “gnda” in the example below) to the other supply
source, all other transistors, and any input sources as appropriate. In the example below, the
rightmost inverter is connected to the rightmost voltage source and its transistors are the only
ones that will be used in the energy calculations.

4) Select “Tools Æ Analog Environment” from the schematic window.

5) Select “Setup Æ Simulation Files Æ Edit Include File…” from the Analog Environment
window and type in the name of your include file (explained below) in the resulting window.
This specifies the include file to use, but does not create it.

6) Create or edit the include file specified above using your favorite text editor. Add the
following line (without quotes) to the include file: “.MEAS TRAN Qtot INTEGRAL i(V0)
FROM=0 TO=10n” This instructs the simulator to integrate the current through your supply
source (V0 in this example) from 0 to 10ns and store the result in Qtot. You will need to change
the name of the voltage source and start and end times as appropriate and may rename the result
variable as you wish.

7) Add the following line to the include file as well (don’t include the double quotes, but do
include the single quotes): “.MEAS Etot PARAM=’1.8*Qtot’” This multiplies the Qtot value
by Vdd (1.8V) and stores the result in Etot. (Note: This measures the total energy. If you want
to measure power, use AVG instead of INTEGRAL in the previous step or divide Etot by the
period of the integral in this step.)
8) Specify the parameters for your transient analysis (“Analysis Æ Choose …” or click on the
appropriate button on the right side of the Analog Environment window).

9) If you are simulating using Cadence, run the simulation (“Simulation Æ Run” or the
appropriate button on the right side of the window). The results of the energy calculation can be
viewed by selecting “Simulation Æ Output Log …” and searching near the bottom of the
resulting window. If you are simulating using HSPICE, create your netlist (“Simulation Æ
Netlist Æ Create Final”), save it, make any changes to it that may be necessary, and run the
simulation. (Note: I suggest redirecting the output of the simulation to a file so that you can
easily search for the results of the energy calculation. E.g. Type “hspice file.sp >! file.out” at the
terminal prompt.) The results can be found near the end of the simulation output.

Tips to Make Your Life Easier


If you are making frequent changes to your schematic and do not want to have to repeatedly
follow these steps, you can save the current state of the Analog Environment window by
selecting “Session Æ Save State …”. The next time you open Analog Environment select
“Session Æ Load State …” and choose the state you want to load.

If you do not want to have to continually add DCCAP and POST to the .OPTION line of your
netlist, you can set those options in the Analog Environment (“Simulation Æ Options Æ Analog
…”) and save them as part of your state.

You can use a vector input file when simulating with Cadence or add it automatically to your
netlist for use in HSPICE by adding “.VEC ‘FILENAME.VEC’” to your include file mentioned
above. Everything in the include file is converted to uppercase by Cadence, however, so you
will have to make sure that the vector file is named appropriately.

You can include any valid HSPICE statement in your include file. This can save you a lot of
cutting and pasting when you make frequent changes to your schematic (and thus your netlist).

Potrebbero piacerti anche