From: Luke Kenneth Casson Leighton <lkcl@lkcl.net>
Date: Tue, 13 Apr 2021 16:38:10 +0000 (+0100)
Subject: more post-processing of vst files
X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b3d213b0c4f60bc2b96f949c22133eb40e40d175;p=soc-cocotb-sim.git

more post-processing of vst files
---

diff --git a/ls180/post_pnr/cocotb/Makefile b/ls180/post_pnr/cocotb/Makefile
index 9cd849a..cb4cc70 100644
--- a/ls180/post_pnr/cocotb/Makefile
+++ b/ls180/post_pnr/cocotb/Makefile
@@ -12,13 +12,13 @@ VSTDIR=$(TOPDIR)/vst_src
 CHIPDIR=$(TOPDIR)/chip_corona
 NSXLIBDIR=$(TOPDIR)/nsxlib
 NIOLIBDIR=$(TOPDIR)/niolib
+#  $(CHIPDIR)/chip_r.vhd 
+#  $(CHIPDIR)/corona_cts_r.vhd 
 VHDL_SOURCES = \
-  $(CHIPDIR)/chip_r.vhd \
-  $(CHIPDIR)/corona_cts_r.vhd \
   $(wildcard $(VSTDIR)/*.vst) \
   $(wildcard $(NSXLIBDIR)/*.vhd) \
   $(wildcard $(NIOLIBDIR)/*.vhd)
-TOPLEVEL=chip_r
+TOPLEVEL=chip
 TOPLEVEL_LANG=vhdl
 MODULE=test
 SIM=ghdl
diff --git a/ls180/post_pnr/vst_correct.py b/ls180/post_pnr/vst_correct.py
index d78d08d..0f45466 100755
--- a/ls180/post_pnr/vst_correct.py
+++ b/ls180/post_pnr/vst_correct.py
@@ -37,6 +37,9 @@ for fname in os.listdir("vst_src"):
         txt = txt.replace("sys_rst : gpio",
                           "p_sys_rst: gpio")
 
+        # corona instance needs renaming too
+        txt = txt.replace("corona : corona", "instance_corona : corona")
+
         # temporary hack to rename niolib to avoid name-clashes
         for cell in ['gpio', 'vss', 'vdd', 'iovss', 'iovdd']:
             txt = txt.replace(": %s" % cell, ": cmpt_%s" % cell)
@@ -60,6 +63,12 @@ for fname in os.listdir("vst_src"):
             res.append(line)
         # re-join lines
         txt = '\n'.join(res)
+        # easier to just post-process-correct the iovdd std_logic
+        for port in ['vss', 'vdd', 'iovss', 'iovdd']:
+            txt = txt.replace("%-9s: inout std_logic" % port,
+                              "%-9s: in bit" % port)
+
+        
     # write the file
     with open(fname, "w") as f:
         f.write(txt)