This project is trying to develop an open source power estimation tool. It mainly focuses on average switching power and leakage power. The analysis is based on Tool Command Language (TCL) code and takes SPICE netlist and fewer parameters as inputs and gives required power values along with modified netlist files.
- Power Analysis Tool using TCL
- Table of contents
- Power Tool Strategy
- Inputs for TCL Power Tool
- TCL Power Tool with examples
- TCL Power Tool Outputs Interpretation
- Future Work
- TCL Power Tool Usage
- Circuits Power Values
- Contact Information
Power estimation of a circuit is done using a simple formula power P = I X V.
- Average swithing power is calculated as product of average switching current and VDD i.e., Iavg xVDD.
- Leakage power is calculated as product of leakage current and VDD i.e., Ileakage x VDD.
The main concept used for power calculation is creating a current controlled current source and taking average power which equals to voltage step across the current source βIvdd during the time period. The voltage step of Vnetl is same for each time period. The value of β shown is CnetVDD/T.
Basic concept used for calculating power
The main input for power tool is spice netlist file. Some more inputs present in netlist are taken while executing code such as
- Supply voltage Node , Supply voltage name
- For Average switching power, Minimum time period of circuit & Supply voltage value
- For Leakage power calculation, No.of time varying inputs and their names.
- First download or clone this repository
git clone https://github.com/yalamanchilivahini5/vsdtclpowertool.git
- To see circuit diagrams of inverter and 1-bit fast adder circuit, Go to
Images
and see inv_ckt.jpg and 1bitadder_ckt.jpg - Here are the steps for circuits simulation and run tcl codes to obtain power values.
- Make sure that netlist file, included files in netlist (if any) and power codes are present in same folder.
- Go to 'NGspice power folder' to run simulations (One can directly open terminal from Ngspice Power folder also).
$ cd vsdtclpowertool/Ngspice\ power/
- (optional step) Run desired circuit Netlist(for example inverter) to get output waveforms and then exit from ngspice shell.
$ ngspice inv.cir
Inverter Transient analysis
- To get average switching power and leakage power, run TCL code
power_modified.tcl
and enter required values.
$ tclsh power_modified.tcl
- Enter required details and enter 1 for average switching power or 2 for leakage power.
- If choice is average switching power enter required data and press enter.
Average Switching power of inverter from TCL code
- Additional file namely
switchingpower_netlist.cir
is added into the directory. - If choice is leakage power, enter required data and press enter.
Leakage power of inverter from TCL code
- A netlist file namely
leakagepower_netlist.cir
is added to directory.
Follow same steps to run any other simulation. Here is another circuit '1-bit fast adder'.
- Go to 'NGspice power folder' to run simulations (One can directly open terminal from Ngspice Power folder also).
$ cd vsdtclpowertool/Ngspice\ power/
- (optional step) Run desired circuit Netlist(here 1bit adder) to get output waveforms and then exit from ngspice shell.
$ ngspice 1bitadder.cir
1-bit fast adder Inputs A, B, Cin and Outputs S, Cout
- To get average switching power and leakage power, run TCL code
power_modified.tcl
and enter required values.
$ tclsh power_modified.tcl
- Enter required details and enter 1 for average switching power or 2 for leakage power.
- If choice is for average switching power, enter required data and press enter.
Average switching power of 1-bit fast adder from TCL code
- Additional file namely
switchingpower_netlist.cir
is added into the directory. - If choice is leakage power, enter required data and press enter.
Leakage power of 1-bit fast adder from TCL code
- Outputs power values dispalyed are in watt.
- Two files namely switchingpower_netlist.cir and leakagepower_netlist.cir are added after running whole power code. These are modified netlist files for calculating average switching power and leakage power respectively.
To view waveforms for modified netlist, run these files (after running desired netlist) using ngspice by commenting quit statement.
Commenting quit statement in netlist
Average Switching Power Netlist of inverter
$ ngspice switchingpower_netlist.cir`
Power plot of Inverter
Voltage step for each 20ns is almost same and the value equals average switching power.
Leakage Power Netlist of inverter
$ ngspice leakagepower_netlist.cir
Average Switching Power Netlist of 1-bit fast adder
$ ngspice switchingpower_netlist.cir`
Power plot of 1-bit fast adder
Voltage step for each 2ns is almost same and the value equals average switching power.
Leakage Power Netlist of 1-bit fast adder
$ ngspice leakagepower_netlist.cir
The designed power tool only works for single supply voltage (VDD) circuits and it assumes there is atleast one switching activity in the given timeperiod. Also it is tested for osu018 technology. Hence it can be extended for multiple supply circuits and for various technologies.
TCL Power Tool mainly works on NGSPICE and TCL shell. Here are steps for setup of required open source tools.
- For installing ngspice
$ sudo apt-get install ngspice
- Most of Linux/Unix systems have inbuilt tcl shell. If not installed prior then for installing TCL shell
$ sudo apt-get install tcl
Note: Circuit Netlist file, include files of netlist(if any) and TCL power code must be present in same folder.
Here are steps to run TCL power tool:
- To clone repository or download files, open terminal and type
$ sudo apt install -y git
$ git clone https://github.com/yalamanchilivahini5/vsdtclpowertool.git
- To get power code present in
Ngspice Power
.(One can directly open terminal from 'Ngspice power' folder also)
$ cd vsdtclpowertool/Ngspice\ power/
- Copy desired netlist files and any included files in the
Ngspice power
folder or copypower_modified.tcl
to folder in which netlist files and included files are present. - Make sure that netlist file has .tran, run and .endc statements in it.
- Here is the brief usage picture to run these codes.
- To run code,
$ tclsh power_modified.tcl
- Enter netlist file name, supply voltage node and supply voltage name in circuit netlist file and press enter.
- Enter 1 for calculating average switching power and 2 for calculating leakage power.
- If choice is average switching power, enter further details such as supply voltage value and minimum time period of circuit.
- The average switching power is displayed in both watt and uW.
- If choice is leakage power, enter few more details such as no.of time varying inputs such as pulse, sine and their names. If there are no time varying inputs, enter 0.
- The leakage power is displayed in both watt and uW.
The switching power and leakage power values calculated for different circuits is presented in an excel sheet Circuits power values. Also there is a power tools (TCL and python power tool) comparision presented in excel sheet Comparing power tools_charu and vahini.
Circuits power table
YALAMANCHILI VAHINI
- YALAMANCHILI VAHINI M.tech Embedded Systems, NIT Jamshedpur [email protected]
- KUNAL GHOSH Director, VSD Corp. Pvt. Ltd. [email protected]
- PHILIPP GÜHRING Software Architect at LibreSilicon Association [email protected]
- Dr. GAURAV TRIVEDI
Co-Principal Investigator, EICT Academy,
and Associative Professor, EEE Department, IIT Guwahati [email protected]