add niolib and nsxlib from alliance-check-toolkit
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 9 Apr 2021 12:22:58 +0000 (13:22 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 9 Apr 2021 12:22:58 +0000 (13:22 +0100)
.gitmodules [new file with mode: 0644]
alliance-check-toolkit [new submodule]
small_jtag_test/vbe2vst.py [new file with mode: 0755]
small_jtag_test/vst_correct.py [new file with mode: 0755]

diff --git a/.gitmodules b/.gitmodules
new file mode 100644 (file)
index 0000000..663524b
--- /dev/null
@@ -0,0 +1,3 @@
+[submodule "alliance-check-toolkit"]
+       path = alliance-check-toolkit
+       url = https://gitlab.lip6.fr/vlsi-eda/alliance-check-toolkit.git
diff --git a/alliance-check-toolkit b/alliance-check-toolkit
new file mode 160000 (submodule)
index 0000000..f004b0a
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit f004b0aca69b5918437d558c65cfe05c2fba2929
diff --git a/small_jtag_test/vbe2vst.py b/small_jtag_test/vbe2vst.py
new file mode 100755 (executable)
index 0000000..41bed78
--- /dev/null
@@ -0,0 +1,30 @@
+#!/usr/bin/env python3
+"""converts NIOLIB and NSXLIB from VBE into VHDL
+"""
+
+import os
+import sys
+
+# use the chroot to set up
+# https://git.libre-soc.org/?p=dev-env-setup.git;a=blob;f=coriolis2-chroot;hb=HEAD
+# reason for using the chroot: it's standardised across the ls180 project
+
+VASY_CMD = "schroot -c coriolis -d /tmp -- ~/alliance/install/bin/vasy"
+ALLIANCEBASE = "../alliance-check-toolkit/cells"
+ALLIANCE_LIBS = ['nsxlib', 'niolib']
+
+for libname in ALLIANCE_LIBS:
+
+    NSXLIB = "%s/%s" % (ALLIANCEBASE, libname)
+
+    os.system("mkdir -p %s" % libname)
+
+    for fname in os.listdir(NSXLIB):
+        if not fname.endswith(".vbe"):
+            continue
+        print (fname)
+        prefix = fname[:-4] # strip ".vbe"
+        os.system("cp %s/%s /tmp" % (NSXLIB, fname))
+        os.system("rm -f /tmp/%s.vhd" % (prefix))
+        os.system("%s -s -I vbe %s %s" % (VASY_CMD, fname, prefix))
+        os.system("cp /tmp/%s.vhd %s/%s.vhdl" % (prefix, libname, prefix))
diff --git a/small_jtag_test/vst_correct.py b/small_jtag_test/vst_correct.py
new file mode 100755 (executable)
index 0000000..0aa3b7f
--- /dev/null
@@ -0,0 +1,25 @@
+#!/usr/bin/env python3
+
+"""makes corrections to vst source from coriolis2 P&R
+"""
+
+import os
+import sys
+
+# run through all files
+for fname in os.listdir("vst_src"):
+    if not fname.endswith(".vst"):
+        continue
+    print (fname)
+    # read the file
+    fname = "vst_src/"+fname
+    with open(fname) as f:
+        txt = f.read()
+    # replace vss / vdd : linkage bit with vss/vdd in bit
+    txt = txt.replace("linkage bit", "in bit")
+    # and double-underscores
+    txt = txt.replace("__", "_")
+    fname = fname[:-3] + "vhdl"
+    # write the file
+    with open(fname, "w") as f:
+        f.write(txt)