import os
import sys
-insns_dir = "./riscv/insns"
+dir_path = os.path.dirname(os.path.realpath(__file__))
+insns_dir = os.path.join(dir_path, 'riscv', 'insns')
def list_insns():
if len(sys.argv) == 2:
fullfname = sys.argv[1]
printf 'DEFINE_INSN(%s)\n' "$${insn}" ; \
done > $@.tmp
mv $@.tmp $@
- python sv_proc_gen.py
+ python $(src_dir)/sv_proc_gen.py
$(riscv_gen_srcs): %.cc: insns/%.h insn_template.cc
sed 's/NAME/$(subst .cc,,$@)/' $(src_dir)/riscv/insn_template.cc | sed 's/OPCODE/$(call get_opcode,$(src_dir)/riscv/encoding.h,$(subst .cc,,$@))/' > $@
- python id_regs.py $(src_dir)/riscv/insns/$(subst .cc,,$@).h
+ python $(src_dir)/id_regs.py $(src_dir)/riscv/insns/$(subst .cc,,$@).h
riscv_junk = \
$(riscv_gen_srcs) \
import os
import sys
-insns_dir = "./riscv/insns"
+dir_path = os.path.dirname(os.path.realpath(__file__))
+riscv_dir = os.path.join(dir_path, "riscv")
+insns_dir = os.path.join(dir_path, "riscv", "insns")
+print(os.getcwd())
def list_insns():
if len(sys.argv) == 2:
fullfname = sys.argv[1]
if __name__ == '__main__':
files = list_insns()
- with open("riscv/sv_insn_decl.h", "w") as f:
+ with open(os.path.join(riscv_dir, "sv_insn_decl.h"), "w") as f:
for (fname, insn) in files:
f.write(sv_hdr_template.format(insn))