( ESNUG 458 Item 3 ) -------------------------------------------- [11/16/06]

From: Judy Alvarez-Gallardo <judy.alvarez=user domain=st got calm>
Subject: Judy's reportLeakagePower equivalent script for IC Compiler users

Hi John,

I've been working on a eval of Synopsys IC Compiler vs. Cadence Encounter.
During one of the comparisons I  was doing, I discovered that Encounter had
this pretty cool command to report the leakage power consumed per library
used for my design:
                           reportLeakagePower

It also listed the total number of cells that were used from each library
along with the total leakage power consumed by it.  So I tried finding a
equivalent command that would do that in IC Compiler, but to no avail.  I
had no luck finding any sample scripts on the Synopsys SolvNet webpage,
nor any luck getting that script from the Synopsys Support center when I
requested it from them.  So long story short, I wrote my own Tcl script to
mimic Cadence's "reportLeakagePower" command in Synopsys' ICC tool and
wanted to submit it here to share it with everyone & to save them the pain
of writing one up themselves.

  # File: reportLeakagePower.tcl
  # Author: Judy Alvarez-Gallardo
  # Date: 07 November 2006
  # Brief: TCL Script to output Leakage Power consumed per library.
  # Version: 1.0

  ungroup -all -flatten

  set RptFile     [open "./library_power.rpt" "w+"]
  set TmpFile     ./temp_file.txt
  set allCells    [get_cells -hier *]
  set sizeCells   [sizeof_col $allCells]
  set tcl_precision 6
  set PwrNum 0
  set cellPwr 0
  set LkgNum 0
  set total 0

  puts $RptFile "LEAKAGE POWER REPORT.\n"


  foreach_in_collection one_cell $allCells {
  # Get the individual cell's library name
  set fullLibPath [get_attr -quiet $one_cell ref_lib_name]
  set libName [lindex [split $fullLibPath /] end]

  set pwrLeak 0

  # Create a new array for each library used in design.
  # If an array already exists for that specific library, then the
  # variable pwrLeak will be set to current array's power leakage value.
  if {[info exists pwrArray($libName)]} {set pwrLeak $pwrArray($libName)}

  # Create a temp file which will store the cell's power information
  redirect $TmpFile {report_power -cell -only $one_cell}

  # Process the cell power information found in the temp file
  # and scale power units to uW

  if [file exists $TmpFile] {
    set tmpReport [open $TmpFile r]
    while { [gets $tmpReport line] >= 0 } {
     if { [string first "Totals (1 cell)" $line] != -1 } {
      if {[string match *mW [lindex $line end]]} {
        set PwrNum [lindex $line end]
        set cellPwr [expr [lindex [split $PwrNum mW] 0] * 1000]
      } elseif {[string match *uW [lindex $line end]]} {
        set PwrNum [lindex $line end]
        set cellPwr [expr [lindex [split $PwrNum uW] 0] * 1]
      } elseif {[string match *nW [lindex $line end]]} {
        set PwrNum [lindex $line end]
        set cellPwr [expr [lindex [split $PwrNum nW] 0] * 0.001]
      } elseif {[string match *pW [lindex $line end]]} {
        set PwrNum [lindex $line end]
        set cellPwr [expr [lindex [split $PwrNum pW] 0] * 0.000001]
      } elseif {[string match *fW [lindex $line end]]} {
        set PwrNum [lindex $line end]
        set cellPwr [expr [lindex [split $PwrNum fW] 0] * 0.000000001]
      }
      # Increment the array's power leakage value with this cell's value
      set LkgNum  [expr $pwrLeak + $cellPwr]
      set pwrLeak $LkgNum
     }
    }
    close $tmpReport
  }

  # The library's array containing the leakage power value will be updated
  # with the new cumulative power leakage value that was calculated above.
  # Also, create a new array to track cell usage from each library.

  if { ! [info exists pwrArray($libName)] } {
    set pwrArray($libName) $pwrLeak
    set libArray($libName) 1
  } else {
    set pwrArray($libName) $pwrLeak
    incr libArray($libName)
  }
  }

  # Output leakage power report.
  puts $RptFile [format "    LIBRARY       # CELLS     LEAKAGE PWR/LIBRARY"]
  puts $RptFile [format "-------------------------------------------------"]
  foreach index [array names pwrArray] {
    puts -nonewline $RptFile [format "%15s" $index]
    puts -nonewline $RptFile [format "%11d" $libArray($index)]
    puts $RptFile [format "%23f" $pwrArray($index)]
    set total [expr {$total + $pwrArray($index)}]
  }
  puts $RptFile [format "-------------------------------------------------"]
  puts $RptFile [format "TOTAL LEAKAGE POWER (uW):%24f" $total]

  unset pwrArray
  unset libArray
  close $RptFile
  file delete -force $TmpFile

I know it's rather simple, but if you don't like writing tricky TCL scripts,
here it is already written for you.  Enjoy!

    - Judy Alvarez-Gallardo
      STmicroelectronics                         San Diego, CA


  Editor's Note: Way to go, Judy!  I always love shared scripts!  - John
Index    Next->Item







   
 Sign up for the DeepChip newsletter.
Email
 Read what EDA tool users really think.


Feedback About Wiretaps ESNUGs SIGN UP! Downloads Trip Reports Advertise

"Relax. This is a discussion. Anything said here is just one engineer's opinion. Email in your dissenting letter and it'll be published, too."
This Web Site Is Modified Every 2-3 Days
Copyright 1991-2024 John Cooley.  All Rights Reserved.
| Contact John Cooley | Webmaster | Legal | Feedback Form |

   !!!     "It's not a BUG,
  /o o\  /  it's a FEATURE!"
 (  >  )
  \ - / 
  _] [_     (jcooley 1991)