add vst pre-pnr test
[soc-cxxrtl-sim.git] / small_jtag_test / vhd2obj.py
diff --git a/small_jtag_test/vhd2obj.py b/small_jtag_test/vhd2obj.py
new file mode 100755 (executable)
index 0000000..31740ba
--- /dev/null
@@ -0,0 +1,28 @@
+#!/usr/bin/env python3
+
+"""builds nsxlib and other VHD files into object files using ghdl
+"""
+
+import os
+import sys
+
+SRC = [('nsxlib', 'vhd'),
+       ('niolib', 'vhd'),
+       ('vst_src', 'vst')]
+
+# make and change to obj dir
+os.system("mkdir -p obj")
+#cwd = os.getcwd()
+#os.chdir("obj")
+
+for srcdir, suffix in SRC:
+    # run ghdl -a on every vhd / vst file
+    for fname in os.listdir("%s" % srcdir):
+        if not fname.endswith(".%s" % suffix):
+            continue
+        print (fname)
+        prefix = fname[:-4] # strip ".vhd"
+        os.system("ghdl -a --std=08 %s/%s" % (srcdir, fname))
+
+# back to original dir
+#os.chdir(cwd)