cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Visitor
Visitor
774 Views
Registered: ‎06-26-2018

[Power Report] Easier Way to acquire power report values

Hello,

 

I'm trying to create a tcl script that can return the power report values in a format that I need. Is there an easier way to get values from the report other than by regexp? Here is my code as it stands:

 

        set table [regexp -all -inline -- {(?ptwx)
        ^                 # Beginning of a line
        [| ]+            # All the spaces and the literal | (maybe not optimal)
        (\w+)            # One or more alphanumeric, or _, characters (capturing)
        [| ]+            # All the spaces and the literal | (maybe not optimal)
        <?                # Zero or one literal <
        (\d+\.\d+)        # A number with decimal values (capturing)
        [| ]+            # All the spaces and the literal | (maybe not optimal)
        <?                # Zero or one literal <
        (\d+\.\d+)        # A number with decimal values (capturing)
        [| ]+            # All the spaces and the literal | (maybe not optimal)
        <?                # Zero or one literal <
        (\d+\.\d+)        # A number with decimal values (capturing)
        [| ]+            # All the spaces and the literal | (maybe not optimal)
        <?                # Zero or one literal <
        (\d+\.\d+)        # A number with decimal values (capturing)
        [| ]+            # All the spaces and the literal | (maybe not optimal)
        <?                # Zero or one literal <
        (\d+\.\d+)        # A number with decimal values (capturing)
        [ ]                # Literal whitespace
        [|]                # Literal |
        $                # End of a line
        #^[| ]+(\w+)[| ]+<?(\d+.\d+)[| ]+<?(\d+.\d+)[| ]+<?(\d+.\d+)[| ]+<?(\d+.\d+)[| ]+<?(\d+.\d+)[ ][|]$
        } [report_power -quiet -hier logic -return_string]];
        
        foreach {str name totalP clockP ioP signalP logicP} $table {
            puts "Name: $name";
            puts "Total Power: $totalP";
            puts "Clock Power: $clockP";
            puts "IO Power: $ioP";
            puts "Signal Power: $signalP";
            puts "Logic Power: $logicP\n";
        }

This regexp extracts the total power, clock power, io power, signal power, and logic power for all of the instances in a design. Is there an easier way to do this?

0 Kudos
1 Reply
Highlighted
Advisor
Advisor
741 Views
Registered: ‎12-03-2007

Hi @feeble , 

 

One option is to run "report_power" command with "-format xml" option. It dumps power report into a nicely formatted XML. Then you can use TCL XML parser to extract the required data.

 

Thanks,

Evgeni

Tags (1)
0 Kudos