forked from The-OpenROAD-Project/EDAAC
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* initializing project report * update vs code settings * first attempt to implement flow models * bump version * improved module import * fix bug in negative bounds * bump up version * adding innovus power reports
- Loading branch information
1 parent
eaec283
commit 06025b1
Showing
8 changed files
with
108 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,5 +32,5 @@ test: | |
check: | ||
twine check dist/* | ||
|
||
publish: | ||
publish: clean build | ||
twine upload dist/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
''' | ||
EDA Analytics Central (EDAAC) | ||
Copyright (c) 2019, Abdelrahman Hosny | ||
All rights reserved. | ||
BSD 3-Clause License | ||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
''' | ||
|
||
from edaac.log import get_logger | ||
import re | ||
|
||
|
||
def parse_innovus_power_report(report_file_path): | ||
logger = get_logger() | ||
# this could be substituted by a default dictionary | ||
# but keeping it this way to see what metrics this function reports | ||
metrics = { | ||
'power_internal_total': None, | ||
'power_switching_total': None, | ||
'power_leakage_total': None, | ||
'power_internal_percentage': None, | ||
'power_switching_percentage': None, | ||
'power_leakage_percentage': None, | ||
'power_total': None, | ||
} | ||
|
||
try: | ||
with open(report_file_path, 'r') as f: | ||
report = ''.join(f.readlines()) | ||
except Exception as e: | ||
logger.error('Can\'t read report file: %s. Skipping ..', | ||
report_file_path) | ||
return | ||
|
||
# Internal power | ||
regex = 'Total Internal Power:[ \t]+(?P<total>[0-9\.]*)[ \t]+(?P<percentage>[%0-9\.]*)%' | ||
m = re.search(regex, report) | ||
if m: | ||
metrics['power_internal_total'] = float(m.group('total')) | ||
metrics['power_internal_percentage'] = float(m.group('percentage')) | ||
|
||
# Switching power | ||
regex = 'Total Switching Power:[ \t]+(?P<total>[0-9\.]*)[ \t]+(?P<percentage>[%0-9\.]*)%' | ||
m = re.search(regex, report) | ||
if m: | ||
metrics['power_switching_total'] = float(m.group('total')) | ||
metrics['power_switching_percentage'] = float(m.group('percentage')) | ||
|
||
# Leakage power | ||
regex = 'Total Leakage Power:[ \t]+(?P<total>[0-9\.]*)[ \t]+(?P<percentage>[%0-9\.]*)%' | ||
m = re.search(regex, report) | ||
if m: | ||
metrics['power_leakage_total'] = float(m.group('total')) | ||
metrics['power_leakage_percentage'] = float(m.group('percentage')) | ||
|
||
# Total power | ||
regex = 'Total Power:[ \t]+(?P<total>[0-9\.]*)' | ||
m = re.search(regex, report) | ||
if m: | ||
metrics['power_total'] = float(m.group('total')) | ||
|
||
logger.info('Successfully extracted metrics from %s', report_file_path) | ||
|
||
return metrics |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
from .test_innovus_drc import * | ||
from .test_innovus_conn import * | ||
from .test_innovus_timing import * | ||
from .test_innovus_power import * | ||
from .test_initialize_project import * | ||
from .test_add_flow import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import unittest | ||
import os | ||
import pathlib | ||
|
||
from edaac.metrics.parsers import parse_innovus_power_report | ||
|
||
|
||
class TestInnovusPower(unittest.TestCase): | ||
def test(self): | ||
report_file = os.path.join( | ||
pathlib.Path(__file__).parent.absolute(), 'data', 'pwr1.rpt') | ||
metrics = { | ||
'power_internal_total': 26.31116662, | ||
'power_switching_total': 21.61735782, | ||
'power_leakage_total': 13.58182182, | ||
'power_total': 61.51034631, | ||
'power_internal_percentage': 42.7752, | ||
'power_switching_percentage': 35.1443, | ||
'power_leakage_percentage': 22.0805 | ||
} | ||
|
||
if os.path.exists(report_file): | ||
result = parse_innovus_power_report(report_file) | ||
self.assertDictEqual(metrics, result) | ||
else: | ||
logger.warning('Skipping private Power report file %s' % report_file) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters