use git submodule soclayout for source files, rather than
[soc-cocotb-sim.git] / ls180 / post_pnr / vhd2obj.py
1 #!/usr/bin/env python3
2
3 """builds nsxlib and other VHD files into object files using ghdl
4 """
5
6 import os
7 import sys
8
9 SRC = [('nsxlib', 'vhd'),
10 ('niolib', 'vhd'),
11 ('vst_src', 'vst')]
12
13 # make and change to obj dir
14 os.system("mkdir -p obj")
15 cwd = os.getcwd()
16 os.chdir("obj")
17
18 for srcdir, suffix in SRC:
19 # run ghdl -a on every vhd / vst file
20 for fname in os.listdir("../%s" % srcdir):
21 if not fname.endswith(".%s" % suffix):
22 continue
23 print (fname)
24 prefix = fname[:-4] # strip ".vhd"
25 os.system("ghdl -a -g --std=08 ../%s/%s" % (srcdir, fname))
26
27 # and chip and corona
28 #os.system("ghdl -a -g --std=08 ../chip_corona/chip_r.vhd")
29 #os.system("ghdl -a -g --std=08 ../chip_corona/corona_cts_r.vhd")
30
31 # back to original dir
32 os.chdir(cwd)