use git submodule soclayout for source files, rather than
[soc-cocotb-sim.git] / ls180 / post_pnr / vbe2vst.py
1 #!/usr/bin/env python3
2 """converts NIOLIB and NSXLIB from VBE into VHDL
3 """
4
5 import os
6 import sys
7
8 # use the chroot to set up
9 # https://git.libre-soc.org/?p=dev-env-setup.git;a=blob;f=coriolis2-chroot;hb=HEAD
10 # reason for using the chroot: it's standardised across the ls180 project
11
12 VASY_CMD = "schroot -c coriolis -d /tmp -- ~/alliance/install/bin/vasy"
13 ALLIANCEBASE = "../../alliance-check-toolkit/cells"
14 ALLIANCE_LIBS = ['nsxlib', 'niolib']
15
16 for libname in ALLIANCE_LIBS:
17
18 NSXLIB = "%s/%s" % (ALLIANCEBASE, libname)
19
20 os.system("mkdir -p %s" % libname)
21
22 for fname in os.listdir(NSXLIB):
23 if not fname.endswith(".vbe"):
24 continue
25 print (fname)
26 prefix = fname[:-4] # strip ".vbe"
27 os.system("cp %s/%s /tmp" % (NSXLIB, fname))
28 os.system("rm -f /tmp/%s.vhd" % (prefix))
29 os.system("%s -s -I vbe %s %s" % (VASY_CMD, fname, prefix))
30 os.system("cp /tmp/%s.vhd %s" % (prefix, libname))