add vst corrections program
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 1 Apr 2021 13:40:06 +0000 (14:40 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 1 Apr 2021 13:40:06 +0000 (14:40 +0100)
ls180/vst_correct.py [new file with mode: 0644]

diff --git a/ls180/vst_correct.py b/ls180/vst_correct.py
new file mode 100644 (file)
index 0000000..68bd2a0
--- /dev/null
@@ -0,0 +1,24 @@
+#!/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("__", "_")
+    # write the file
+    with open(fname, "w") as f:
+        f.write(txt)