diff options
author | Clifford Wolf <clifford@clifford.at> | 2017-07-04 12:24:38 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2017-07-04 12:24:38 +0200 |
commit | 3fb5934d547f4105d1aec4dfb71ea8934daf754b (patch) | |
tree | 3db7cc5d97757864159f36d7beeceb600e84cb6f /icefuzz/extract.py | |
parent | 832bcbe4a2a2733cd76d70805390cee55524b0bc (diff) | |
parent | 96511b32b1ee0dbae91f9878094c8f12f5bdafaa (diff) | |
download | icestorm-3fb5934d547f4105d1aec4dfb71ea8934daf754b.tar.gz icestorm-3fb5934d547f4105d1aec4dfb71ea8934daf754b.tar.bz2 icestorm-3fb5934d547f4105d1aec4dfb71ea8934daf754b.zip |
Merge branch 'tannewt'
Diffstat (limited to 'icefuzz/extract.py')
-rw-r--r-- | icefuzz/extract.py | 25 |
1 files changed, 13 insertions, 12 deletions
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) - |