From 136618b29d3d274dc6767b3260ae97d1024cf4a0 Mon Sep 17 00:00:00 2001 From: Keith Rothman <537074+litghost@users.noreply.github.com> Date: Thu, 24 Jan 2019 09:55:13 -0800 Subject: [PATCH 1/3] Add tilegrid report utility. Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com> --- utils/tilegrid_report.py | 42 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 utils/tilegrid_report.py diff --git a/utils/tilegrid_report.py b/utils/tilegrid_report.py new file mode 100755 index 00000000..b401c8c7 --- /dev/null +++ b/utils/tilegrid_report.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +import simplejson as json +import argparse + +def main(): + parser = argparse.ArgumentParser(description="") + parser.add_argument('tilegrid_json') + + args = parser.parse_args() + + with open(args.tilegrid_json, 'r') as f: + tilegrid = json.load(f) + + tile_types = {} + + for tile in tilegrid: + tile_type = tilegrid[tile]['type'] + if tile_type not in tile_types: + tile_types[tilegrid[tile]['type']] = [] + + tile_types[tile_type].append((tile, tilegrid[tile])) + + total_tile_count = 0 + total_have_bits = 0 + for tile_type, tiles in sorted(tile_types.items()): + if 'NULL' in tile_type: + continue + + have_bits = 0 + for tile_name, tile in tiles: + total_tile_count += 1 + if 'bits' in tile and 'CLB_IO_CLK' in tile['bits']: + have_bits += 1 + total_have_bits += 1 + + print('{}: {}/{} ({:.2f} %)'.format(tile_type, have_bits, len(tiles), 100.*float(have_bits)/len(tiles))) + + print('') + print('Summary: {}/{} ({:.2f} %)'.format(total_have_bits, total_tile_count, 100.*float(total_have_bits)/total_tile_count)) + +if __name__ == "__main__": + main() From d49897d45d19d9e113e088c384946ff320934c39 Mon Sep 17 00:00:00 2001 From: Keith Rothman <537074+litghost@users.noreply.github.com> Date: Thu, 24 Jan 2019 09:57:45 -0800 Subject: [PATCH 2/3] make format Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com> --- utils/tilegrid_report.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/utils/tilegrid_report.py b/utils/tilegrid_report.py index b401c8c7..8b26bdc0 100755 --- a/utils/tilegrid_report.py +++ b/utils/tilegrid_report.py @@ -2,8 +2,10 @@ import simplejson as json import argparse + def main(): - parser = argparse.ArgumentParser(description="") + parser = argparse.ArgumentParser( + description="Tool for checking which tiles have bits defined.") parser.add_argument('tilegrid_json') args = parser.parse_args() @@ -33,10 +35,17 @@ def main(): have_bits += 1 total_have_bits += 1 - print('{}: {}/{} ({:.2f} %)'.format(tile_type, have_bits, len(tiles), 100.*float(have_bits)/len(tiles))) + print( + '{}: {}/{} ({:.2f} %)'.format( + tile_type, have_bits, len(tiles), + 100. * float(have_bits) / len(tiles))) print('') - print('Summary: {}/{} ({:.2f} %)'.format(total_have_bits, total_tile_count, 100.*float(total_have_bits)/total_tile_count)) + print( + 'Summary: {}/{} ({:.2f} %)'.format( + total_have_bits, total_tile_count, + 100. * float(total_have_bits) / total_tile_count)) + if __name__ == "__main__": main() From c444e8a31082c8fe02b9bce21131b4bf9e6edc8a Mon Sep 17 00:00:00 2001 From: Keith Rothman <537074+litghost@users.noreply.github.com> Date: Thu, 24 Jan 2019 10:12:28 -0800 Subject: [PATCH 3/3] Add simplejson to requirements. Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com> --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 679e7de9..54e28725 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,3 +9,4 @@ sympy yapf==0.24.0 textx pytest +simplejson