From 58a6110be198089d784b5ad3e2ecb611182bd5ea Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 22 Jun 2017 17:38:38 -0700 Subject: Add icefuzz support for the UP5K and rework underlying device specification for more flexibility. --- icefuzz/extract.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'icefuzz/extract.py') diff --git a/icefuzz/extract.py b/icefuzz/extract.py index 1ffac8a..75be225 100644 --- a/icefuzz/extract.py +++ b/icefuzz/extract.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 - +import os import sys, re db = set() @@ -9,36 +9,38 @@ mode_384 = False cur_text_db = None max_x, max_y = 0, 0 -if sys.argv[1] == '-8': - sys.argv = sys.argv[1:] - mode_8k = True - -if sys.argv[1] == '-3': - sys.argv = sys.argv[1:] - mode_384 = True +device_class = os.getenv("ICEDEVICE") for filename in sys.argv[1:]: with open(filename, "r") as f: + ignore = False for line in f: if line == "\n": pass elif line.startswith("GlobalNetwork"): cur_text_db = set() + ignore = False elif line.startswith("IO"): match = re.match("IO_Tile_(\d+)_(\d+)", line) assert match max_x = max(max_x, int(match.group(1))) max_y = max(max_y, int(match.group(2))) cur_text_db = text_db.setdefault("io", set()) + ignore = False elif line.startswith("Logic"): cur_text_db = text_db.setdefault("logic", set()) + ignore = False elif line.startswith("RAM"): match = re.match(r"RAM_Tile_\d+_(\d+)", line) if int(match.group(1)) % 2 == 1: - cur_text_db = text_db.setdefault("ramb_8k" if mode_8k else "ramb", set()) + cur_text_db = text_db.setdefault("ramb_" + device_class if device_class in ["5k", "8k"] else "ramb", set()) else: - cur_text_db = text_db.setdefault("ramt_8k" if mode_8k else "ramt", set()) - else: + cur_text_db = text_db.setdefault("ramt_" + device_class if device_class in ["5k", "8k"] else "ramt", set()) + ignore = False + elif device_class == "5k" and line.startswith(("IpCon", "DSP")): + ignore = True + elif not ignore: + print("'" + line + "'") assert line.startswith(" ") cur_text_db.add(line) @@ -60,4 +62,3 @@ for tile_type in text_db: for line in sorted(db): print(line) - -- cgit v1.2.3