modified id_regs.py to take a single argument (file in riscv/insns to parse)
added call to id_regs.py in riscv.mk.in
included the auto-generated file in the insn_template.cc
now each instruction has a way - BEFORE the emulated instruction is called -
to identify which registers (RD, RS1-3, FRD, FRS1-3) are going to be used.
"""
import os
+import sys
insns_dir = "./riscv/insns"
def list_insns():
+ if len(sys.argv) == 2:
+ fullfname = sys.argv[1]
+ pth, fname = os.path.split(fullfname)
+ insn = fname[:-2]
+ return [(fullfname, insn)]
+
res = []
for fname in os.listdir(insns_dir):
if not fname.endswith(".h"):
#define INCLUDEFILE "insns/NAME.h"
#define INSNCODE OPCODE
#include "sv_decode.h"
+#include "insns/regs_NAME.h"
#define FN rv32_NAME
#define ISASZ 32
#include "insn_template_sv.cc"
$(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
riscv_junk = \
$(riscv_gen_srcs) \