add ghdl yosys scripts for compiling ls180
[soc-cxxrtl-sim.git] / small_jtag_test / 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 --std=08 %s/%s" % (srcdir, fname))
26
27 # back to original dir
28 #os.chdir(cwd)