aboutsummaryrefslogtreecommitdiff
path: root/icefuzz/pinloc/pinlocdb.py
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2015-07-18 13:10:40 +0200
committerClifford Wolf <clifford@clifford.at>2015-07-18 13:10:40 +0200
commit48154cb6f452d3bdb4da36cc267b4b6c45588dc9 (patch)
tree3ec3be9ef7e8db1fb7c764ed8202e0215a8eb7c7 /icefuzz/pinloc/pinlocdb.py
parent13e63e6b65e044e348356731b55610d02cb308b9 (diff)
Imported full dev sources
Diffstat (limited to 'icefuzz/pinloc/pinlocdb.py')
-rw-r--r--icefuzz/pinloc/pinlocdb.py46
1 files changed, 46 insertions, 0 deletions
diff --git a/icefuzz/pinloc/pinlocdb.py b/icefuzz/pinloc/pinlocdb.py
new file mode 100644
index 0000000..31c6476
--- /dev/null
+++ b/icefuzz/pinloc/pinlocdb.py
@@ -0,0 +1,46 @@
+#!/usr/bin/python
+
+from __future__ import division
+from __future__ import print_function
+
+import re
+from sys import argv
+
+ieren_db = [ ]
+pinloc_db = [ ]
+
+for arg in argv[1:]:
+ pin = re.search(r"_([^.]*)", arg).group(1)
+ with open(arg, "r") as f:
+ tile = [0, 0]
+ iob = [0, 0, 0]
+ ioctrl = [0, 0, 0]
+
+ for line in f:
+ match = re.match(r"^\.io_tile (\d+) (\d+)", line)
+ if match:
+ tile = [int(match.group(1)), int(match.group(2))]
+
+ match = re.match(r"^IOB_(\d+)", line)
+ if match:
+ iob = tile + [int(match.group(1))]
+
+ match = re.match(r"^IoCtrl REN_(\d+)", line)
+ if match:
+ ioctrl = tile + [int(match.group(1))]
+
+ ieren_db.append(tuple(iob + ioctrl))
+ pinloc_db.append(tuple(['"' + pin + '"'] + iob))
+
+print()
+print("# ieren_db")
+for entry in sorted(ieren_db):
+ print("(%2d, %2d, %d, %2d, %2d, %d)," % entry)
+
+print()
+print("# pinloc_db")
+for entry in sorted(pinloc_db):
+ print("(%5s, %2d, %2d, %d)," % entry)
+
+print()
+