aboutsummaryrefslogtreecommitdiffstats
path: root/icefuzz/extract.py
diff options
context:
space:
mode:
authorScott Shawcroft <scott.shawcroft@gmail.com>2017-06-22 17:38:38 -0700
committerScott Shawcroft <scott.shawcroft@gmail.com>2017-06-22 17:38:38 -0700
commit58a6110be198089d784b5ad3e2ecb611182bd5ea (patch)
tree3f15bebbc4b95584c93ad0f3412b53b7f55c8d5e /icefuzz/extract.py
parented8c4e8c034ffca4424f92fa683ff631c4205b50 (diff)
downloadicestorm-58a6110be198089d784b5ad3e2ecb611182bd5ea.tar.gz
icestorm-58a6110be198089d784b5ad3e2ecb611182bd5ea.tar.bz2
icestorm-58a6110be198089d784b5ad3e2ecb611182bd5ea.zip
Add icefuzz support for the UP5K and rework underlying device specification for more flexibility.
Diffstat (limited to 'icefuzz/extract.py')
-rw-r--r--icefuzz/extract.py25
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)
-