aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xconfigure46
-rw-r--r--configure.ac2
-rw-r--r--hwacha/README2
-rw-r--r--hwacha/decode_hwacha.h64
-rw-r--r--hwacha/decode_hwacha_ut.h34
-rw-r--r--hwacha/disasm.cc72
-rw-r--r--hwacha/hwacha.ac (renamed from hwacha/insns/venqcmd.h)0
-rw-r--r--hwacha/hwacha.cc46
-rw-r--r--hwacha/hwacha.h80
-rw-r--r--hwacha/hwacha.mk.in35
-rw-r--r--hwacha/insn_template_hwacha.cc24
-rw-r--r--hwacha/insn_template_hwacha_ut.cc22
-rw-r--r--hwacha/insns/fmovn.h2
-rw-r--r--hwacha/insns/fmovz.h2
-rw-r--r--hwacha/insns/movn.h2
-rw-r--r--hwacha/insns/movz.h2
-rw-r--r--hwacha/insns/stop.h3
-rw-r--r--hwacha/insns/utidx.h2
-rw-r--r--hwacha/insns/venqcnt.h0
-rw-r--r--hwacha/insns/venqimm1.h0
-rw-r--r--hwacha/insns/venqimm2.h0
-rw-r--r--hwacha/insns/vf.h35
-rw-r--r--hwacha/insns/vfld.h3
-rw-r--r--hwacha/insns/vflsegd.h1
-rw-r--r--hwacha/insns/vflsegstd.h1
-rw-r--r--hwacha/insns/vflsegstw.h1
-rw-r--r--hwacha/insns/vflsegw.h1
-rw-r--r--hwacha/insns/vflstd.h3
-rw-r--r--hwacha/insns/vflstw.h3
-rw-r--r--hwacha/insns/vflw.h3
-rw-r--r--hwacha/insns/vfmst.h4
-rw-r--r--hwacha/insns/vfmsv.h5
-rw-r--r--hwacha/insns/vfmts.h4
-rw-r--r--hwacha/insns/vfmvv.h5
-rw-r--r--hwacha/insns/vfsd.h3
-rw-r--r--hwacha/insns/vfssegd.h1
-rw-r--r--hwacha/insns/vfssegstd.h1
-rw-r--r--hwacha/insns/vfssegstw.h1
-rw-r--r--hwacha/insns/vfssegw.h1
-rw-r--r--hwacha/insns/vfsstd.h3
-rw-r--r--hwacha/insns/vfsstw.h3
-rw-r--r--hwacha/insns/vfsw.h3
-rw-r--r--hwacha/insns/vgetcfg.h1
-rw-r--r--hwacha/insns/vgetvl.h1
-rw-r--r--hwacha/insns/vlb.h2
-rw-r--r--hwacha/insns/vlbu.h2
-rw-r--r--hwacha/insns/vld.h3
-rw-r--r--hwacha/insns/vlh.h2
-rw-r--r--hwacha/insns/vlhu.h2
-rw-r--r--hwacha/insns/vlsegb.h1
-rw-r--r--hwacha/insns/vlsegbu.h1
-rw-r--r--hwacha/insns/vlsegd.h1
-rw-r--r--hwacha/insns/vlsegh.h1
-rw-r--r--hwacha/insns/vlseghu.h1
-rw-r--r--hwacha/insns/vlsegstb.h1
-rw-r--r--hwacha/insns/vlsegstbu.h1
-rw-r--r--hwacha/insns/vlsegstd.h1
-rw-r--r--hwacha/insns/vlsegsth.h1
-rw-r--r--hwacha/insns/vlsegsthu.h1
-rw-r--r--hwacha/insns/vlsegstw.h1
-rw-r--r--hwacha/insns/vlsegstwu.h1
-rw-r--r--hwacha/insns/vlsegw.h1
-rw-r--r--hwacha/insns/vlsegwu.h1
-rw-r--r--hwacha/insns/vlstb.h2
-rw-r--r--hwacha/insns/vlstbu.h2
-rw-r--r--hwacha/insns/vlstd.h3
-rw-r--r--hwacha/insns/vlsth.h2
-rw-r--r--hwacha/insns/vlsthu.h2
-rw-r--r--hwacha/insns/vlstw.h2
-rw-r--r--hwacha/insns/vlstwu.h2
-rw-r--r--hwacha/insns/vlw.h2
-rw-r--r--hwacha/insns/vlwu.h2
-rw-r--r--hwacha/insns/vmst.h3
-rw-r--r--hwacha/insns/vmsv.h6
-rw-r--r--hwacha/insns/vmts.h3
-rw-r--r--hwacha/insns/vmvv.h7
-rw-r--r--hwacha/insns/vsb.h2
-rw-r--r--hwacha/insns/vsd.h3
-rw-r--r--hwacha/insns/vsetcfg.h9
-rw-r--r--hwacha/insns/vsetvl.h6
-rw-r--r--hwacha/insns/vsh.h2
-rw-r--r--hwacha/insns/vssegb.h1
-rw-r--r--hwacha/insns/vssegd.h1
-rw-r--r--hwacha/insns/vssegh.h1
-rw-r--r--hwacha/insns/vssegstb.h1
-rw-r--r--hwacha/insns/vssegstd.h1
-rw-r--r--hwacha/insns/vssegsth.h1
-rw-r--r--hwacha/insns/vssegstw.h1
-rw-r--r--hwacha/insns/vssegw.h1
-rw-r--r--hwacha/insns/vsstb.h2
-rw-r--r--hwacha/insns/vsstd.h3
-rw-r--r--hwacha/insns/vssth.h2
-rw-r--r--hwacha/insns/vsstw.h2
-rw-r--r--hwacha/insns/vsw.h2
-rw-r--r--hwacha/insns/vtcfg.h5
-rw-r--r--hwacha/insns/vtcfgivl.h0
-rw-r--r--hwacha/insns/vvcfg.h5
-rw-r--r--hwacha/insns/vvcfgivl.h6
-rw-r--r--hwacha/insns/vxcptevac.h0
-rw-r--r--hwacha/insns/vxcpthold.h0
-rw-r--r--hwacha/insns/vxcptwait.h0
l---------hwacha/insns_ut/ut_add.h1
l---------hwacha/insns_ut/ut_addi.h1
l---------hwacha/insns_ut/ut_addiw.h1
l---------hwacha/insns_ut/ut_addw.h1
l---------hwacha/insns_ut/ut_amoadd_d.h1
l---------hwacha/insns_ut/ut_amoadd_w.h1
l---------hwacha/insns_ut/ut_amoand_d.h1
l---------hwacha/insns_ut/ut_amoand_w.h1
l---------hwacha/insns_ut/ut_amomax_d.h1
l---------hwacha/insns_ut/ut_amomax_w.h1
l---------hwacha/insns_ut/ut_amomaxu_d.h1
l---------hwacha/insns_ut/ut_amomaxu_w.h1
l---------hwacha/insns_ut/ut_amomin_d.h1
l---------hwacha/insns_ut/ut_amomin_w.h1
l---------hwacha/insns_ut/ut_amominu_d.h1
l---------hwacha/insns_ut/ut_amominu_w.h1
l---------hwacha/insns_ut/ut_amoor_d.h1
l---------hwacha/insns_ut/ut_amoor_w.h1
l---------hwacha/insns_ut/ut_amoswap_d.h1
l---------hwacha/insns_ut/ut_amoswap_w.h1
l---------hwacha/insns_ut/ut_amoxor_d.h1
l---------hwacha/insns_ut/ut_amoxor_w.h1
l---------hwacha/insns_ut/ut_and.h1
l---------hwacha/insns_ut/ut_andi.h1
l---------hwacha/insns_ut/ut_auipc.h1
l---------hwacha/insns_ut/ut_div.h1
l---------hwacha/insns_ut/ut_divu.h1
l---------hwacha/insns_ut/ut_divuw.h1
l---------hwacha/insns_ut/ut_divw.h1
l---------hwacha/insns_ut/ut_fadd_d.h1
l---------hwacha/insns_ut/ut_fadd_s.h1
l---------hwacha/insns_ut/ut_fcvt_d_l.h1
l---------hwacha/insns_ut/ut_fcvt_d_lu.h1
l---------hwacha/insns_ut/ut_fcvt_d_s.h1
l---------hwacha/insns_ut/ut_fcvt_d_w.h1
l---------hwacha/insns_ut/ut_fcvt_d_wu.h1
l---------hwacha/insns_ut/ut_fcvt_l_d.h1
l---------hwacha/insns_ut/ut_fcvt_l_s.h1
l---------hwacha/insns_ut/ut_fcvt_lu_d.h1
l---------hwacha/insns_ut/ut_fcvt_lu_s.h1
l---------hwacha/insns_ut/ut_fcvt_s_d.h1
l---------hwacha/insns_ut/ut_fcvt_s_l.h1
l---------hwacha/insns_ut/ut_fcvt_s_lu.h1
l---------hwacha/insns_ut/ut_fcvt_s_w.h1
l---------hwacha/insns_ut/ut_fcvt_s_wu.h1
l---------hwacha/insns_ut/ut_fcvt_w_d.h1
l---------hwacha/insns_ut/ut_fcvt_w_s.h1
l---------hwacha/insns_ut/ut_fcvt_wu_d.h1
l---------hwacha/insns_ut/ut_fcvt_wu_s.h1
l---------hwacha/insns_ut/ut_fdiv_d.h1
l---------hwacha/insns_ut/ut_fdiv_s.h1
l---------hwacha/insns_ut/ut_fence.h1
l---------hwacha/insns_ut/ut_feq_d.h1
l---------hwacha/insns_ut/ut_feq_s.h1
l---------hwacha/insns_ut/ut_fld.h1
l---------hwacha/insns_ut/ut_fle_d.h1
l---------hwacha/insns_ut/ut_fle_s.h1
l---------hwacha/insns_ut/ut_flt_d.h1
l---------hwacha/insns_ut/ut_flt_s.h1
l---------hwacha/insns_ut/ut_flw.h1
l---------hwacha/insns_ut/ut_fmadd_d.h1
l---------hwacha/insns_ut/ut_fmadd_s.h1
l---------hwacha/insns_ut/ut_fmax_d.h1
l---------hwacha/insns_ut/ut_fmax_s.h1
l---------hwacha/insns_ut/ut_fmin_d.h1
l---------hwacha/insns_ut/ut_fmin_s.h1
-rw-r--r--hwacha/insns_ut/ut_fmovn.h1
-rw-r--r--hwacha/insns_ut/ut_fmovz.h1
l---------hwacha/insns_ut/ut_fmsub_d.h1
l---------hwacha/insns_ut/ut_fmsub_s.h1
l---------hwacha/insns_ut/ut_fmul_d.h1
l---------hwacha/insns_ut/ut_fmul_s.h1
l---------hwacha/insns_ut/ut_fmv_d_x.h1
l---------hwacha/insns_ut/ut_fmv_s_x.h1
l---------hwacha/insns_ut/ut_fmv_x_d.h1
l---------hwacha/insns_ut/ut_fmv_x_s.h1
l---------hwacha/insns_ut/ut_fnmadd_d.h1
l---------hwacha/insns_ut/ut_fnmadd_s.h1
l---------hwacha/insns_ut/ut_fnmsub_d.h1
l---------hwacha/insns_ut/ut_fnmsub_s.h1
l---------hwacha/insns_ut/ut_frsr.h1
l---------hwacha/insns_ut/ut_fsd.h1
l---------hwacha/insns_ut/ut_fsgnj_d.h1
l---------hwacha/insns_ut/ut_fsgnj_s.h1
l---------hwacha/insns_ut/ut_fsgnjn_d.h1
l---------hwacha/insns_ut/ut_fsgnjn_s.h1
l---------hwacha/insns_ut/ut_fsgnjx_d.h1
l---------hwacha/insns_ut/ut_fsgnjx_s.h1
l---------hwacha/insns_ut/ut_fsqrt_d.h1
l---------hwacha/insns_ut/ut_fsqrt_s.h1
l---------hwacha/insns_ut/ut_fssr.h1
l---------hwacha/insns_ut/ut_fsub_d.h1
l---------hwacha/insns_ut/ut_fsub_s.h1
l---------hwacha/insns_ut/ut_fsw.h1
l---------hwacha/insns_ut/ut_lb.h1
l---------hwacha/insns_ut/ut_lbu.h1
l---------hwacha/insns_ut/ut_ld.h1
l---------hwacha/insns_ut/ut_lh.h1
l---------hwacha/insns_ut/ut_lhu.h1
l---------hwacha/insns_ut/ut_lui.h1
l---------hwacha/insns_ut/ut_lw.h1
l---------hwacha/insns_ut/ut_lwu.h1
-rw-r--r--hwacha/insns_ut/ut_movn.h1
-rw-r--r--hwacha/insns_ut/ut_movz.h1
l---------hwacha/insns_ut/ut_mul.h1
l---------hwacha/insns_ut/ut_mulh.h1
l---------hwacha/insns_ut/ut_mulhsu.h1
l---------hwacha/insns_ut/ut_mulhu.h1
l---------hwacha/insns_ut/ut_mulw.h1
l---------hwacha/insns_ut/ut_or.h1
l---------hwacha/insns_ut/ut_ori.h1
l---------hwacha/insns_ut/ut_rem.h1
l---------hwacha/insns_ut/ut_remu.h1
l---------hwacha/insns_ut/ut_remuw.h1
l---------hwacha/insns_ut/ut_remw.h1
l---------hwacha/insns_ut/ut_sb.h1
l---------hwacha/insns_ut/ut_sd.h1
l---------hwacha/insns_ut/ut_sh.h1
l---------hwacha/insns_ut/ut_sll.h1
l---------hwacha/insns_ut/ut_slli.h1
l---------hwacha/insns_ut/ut_slliw.h1
l---------hwacha/insns_ut/ut_sllw.h1
l---------hwacha/insns_ut/ut_slt.h1
l---------hwacha/insns_ut/ut_slti.h1
l---------hwacha/insns_ut/ut_sltiu.h1
l---------hwacha/insns_ut/ut_sltu.h1
l---------hwacha/insns_ut/ut_sra.h1
l---------hwacha/insns_ut/ut_srai.h1
l---------hwacha/insns_ut/ut_sraiw.h1
l---------hwacha/insns_ut/ut_sraw.h1
l---------hwacha/insns_ut/ut_srl.h1
l---------hwacha/insns_ut/ut_srli.h1
l---------hwacha/insns_ut/ut_srliw.h1
l---------hwacha/insns_ut/ut_srlw.h1
-rw-r--r--hwacha/insns_ut/ut_stop.h1
l---------hwacha/insns_ut/ut_sub.h1
l---------hwacha/insns_ut/ut_subw.h1
l---------hwacha/insns_ut/ut_sw.h1
-rw-r--r--hwacha/insns_ut/ut_utidx.h1
l---------hwacha/insns_ut/ut_xor.h1
l---------hwacha/insns_ut/ut_xori.h1
-rw-r--r--hwacha/opcodes_hwacha.h40
-rw-r--r--hwacha/opcodes_hwacha_ut.h141
-rw-r--r--riscv/extension.cc1
-rw-r--r--riscv/insns/cflush.h1
-rw-r--r--riscv/insns/fence_v_g.h0
-rw-r--r--riscv/insns/fence_v_l.h0
-rw-r--r--riscv/riscv.mk.in1
-rw-r--r--riscv/rocc.cc6
-rw-r--r--riscv/rocc.h6
-rw-r--r--riscv/spike.cc1
252 files changed, 718 insertions, 267 deletions
diff --git a/configure b/configure
index 448b9f5..424e82c 100755
--- a/configure
+++ b/configure
@@ -4243,6 +4243,51 @@ fi
# Add subproject to our running list
+ subprojects="$subprojects hwacha"
+
+ # Process the subproject appropriately. If enabled add it to the
+ # $enabled_subprojects running shell variable, set a
+ # SUBPROJECT_ENABLED C define, and include the appropriate
+ # 'subproject.ac'.
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: configuring default subproject : hwacha" >&5
+$as_echo "$as_me: configuring default subproject : hwacha" >&6;}
+ ac_config_files="$ac_config_files hwacha.mk:hwacha/hwacha.mk.in"
+
+ enable_hwacha_sproj="yes"
+ subprojects_enabled="$subprojects_enabled hwacha"
+
+$as_echo "#define HWACHA_ENABLED /**/" >>confdefs.h
+
+
+
+
+
+
+ # Determine if this is a required or an optional subproject
+
+
+
+ # Determine if there is a group with the same name
+
+
+
+ # Create variations of the subproject name suitable for use as a CPP
+ # enabled define, a shell enabled variable, and a shell function
+
+
+
+
+
+
+
+
+
+
+
+ # Add subproject to our running list
+
subprojects="$subprojects softfloat"
# Process the subproject appropriately. If enabled add it to the
@@ -5039,6 +5084,7 @@ for ac_config_target in $ac_config_targets
do
case $ac_config_target in
"riscv.mk") CONFIG_FILES="$CONFIG_FILES riscv.mk:riscv/riscv.mk.in" ;;
+ "hwacha.mk") CONFIG_FILES="$CONFIG_FILES hwacha.mk:hwacha/hwacha.mk.in" ;;
"softfloat.mk") CONFIG_FILES="$CONFIG_FILES softfloat.mk:softfloat/softfloat.mk.in" ;;
"softfloat_riscv.mk") CONFIG_FILES="$CONFIG_FILES softfloat_riscv.mk:softfloat_riscv/softfloat_riscv.mk.in" ;;
"config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
diff --git a/configure.ac b/configure.ac
index 335100b..44fd31a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -81,7 +81,7 @@ AC_SUBST([CXXFLAGS],["-Wall -O2 -std=c++0x"])
# The '*' suffix indicates an optional subproject. The '**' suffix
# indicates an optional subproject which is also the name of a group.
-MCPPBS_SUBPROJECTS([ riscv, softfloat, softfloat_riscv ])
+MCPPBS_SUBPROJECTS([ riscv, hwacha, softfloat, softfloat_riscv ])
#-------------------------------------------------------------------------
# MCPPBS subproject groups
diff --git a/hwacha/README b/hwacha/README
index be5a97c..4e87c55 100644
--- a/hwacha/README
+++ b/hwacha/README
@@ -1,2 +1,2 @@
This directory contains work in progress on Hwacha, a data-parallel
-accelerator. It is not currently usable.
+accelerator.
diff --git a/hwacha/decode_hwacha.h b/hwacha/decode_hwacha.h
new file mode 100644
index 0000000..a99736e
--- /dev/null
+++ b/hwacha/decode_hwacha.h
@@ -0,0 +1,64 @@
+#ifndef _DECODE_HWACHA_H
+#define _DECODE_HWACHA_H
+
+#define XS1 (xs1)
+#define XS2 (xs2)
+#define WRITE_XRD(value) (xd = value)
+
+#define NXPR (h->get_ct_state()->nxpr)
+#define NFPR (h->get_ct_state()->nfpr)
+#define MAXVL (h->get_ct_state()->maxvl)
+#define VL (h->get_ct_state()->vl)
+#define WRITE_NXPR(nxprnext) (h->get_ct_state()->nxpr = (nxprnext))
+#define WRITE_NFPR(nfprnext) (h->get_ct_state()->nfpr = (nfprnext))
+#define WRITE_MAXVL(maxvlnext) (h->get_ct_state()->maxvl = (maxvlnext))
+#define WRITE_VL(vlnext) (h->get_ct_state()->vl = (vlnext))
+
+#define INSN_RS1 (insn.rs1())
+#define INSN_RS2 (insn.rs2())
+#define INSN_RS3 (insn.rs3())
+#define INSN_RD (insn.rd())
+#define INSN_SEG ((insn.i_imm() >> 9)+1)
+
+#define UT_READ_XPR(idx, src) (h->get_ut_state(idx)->XPR[src])
+#define UT_WRITE_XPR(idx, dst, value) (h->get_ut_state(idx)->XPR.write(dst, value))
+#define UT_RS1(idx) (UT_READ_XPR(idx, INSN_RS1))
+#define UT_RS2(idx) (UT_READ_XPR(idx, INSN_RS2))
+#define UT_WRITE_RD(idx, value) (UT_WRITE_XPR(idx, INSN_RD, value))
+
+#define UT_READ_FPR(idx, src) (h->get_ut_state(idx)->FPR[src])
+#define UT_WRITE_FPR(idx, dst, value) (h->get_ut_state(idx)->FPR.write(dst, value))
+#define UT_FRS1(idx) (UT_READ_FPR(idx, INSN_RS1))
+#define UT_FRS2(idx) (UT_READ_FPR(idx, INSN_RS2))
+#define UT_FRS3(idx) (UT_READ_FPR(idx, INSN_RS3))
+#define UT_WRITE_FRD(idx, value) (UT_WRITE_FPR(idx, INSN_RD, value))
+
+#define VEC_SEG_LOAD(dst, func, inc) \
+ VEC_SEG_ST_LOAD(dst, func, INSN_SEG*inc, inc)
+
+#define VEC_SEG_ST_LOAD(dst, func, stride, inc) \
+ reg_t seg_addr = XS1; \
+ for (uint32_t i=0; i<VL; i++) { \
+ reg_t addr = seg_addr; \
+ seg_addr += stride; \
+ for (uint32_t j=0; j<INSN_SEG; j++) { \
+ UT_WRITE_##dst(i, INSN_RD+j, p->get_mmu()->func(addr)); \
+ addr += inc; \
+ } \
+ }
+
+#define VEC_SEG_STORE(src, func, inc) \
+ VEC_SEG_ST_STORE(src, func, INSN_SEG*inc, inc)
+
+#define VEC_SEG_ST_STORE(src, func, stride, inc) \
+ reg_t seg_addr = XS1; \
+ for (uint32_t i=0; i<VL; i++) { \
+ reg_t addr = seg_addr; \
+ seg_addr += stride; \
+ for (uint32_t j=0; j<INSN_SEG; j++) { \
+ p->get_mmu()->func(addr, UT_READ_##src(i, INSN_RD+j)); \
+ addr += inc; \
+ } \
+ }
+
+#endif
diff --git a/hwacha/decode_hwacha_ut.h b/hwacha/decode_hwacha_ut.h
new file mode 100644
index 0000000..675f77c
--- /dev/null
+++ b/hwacha/decode_hwacha_ut.h
@@ -0,0 +1,34 @@
+#ifndef _DECODE_HWACHA_UT_H
+#define _DECODE_HWACHA_UT_H
+
+#include "decode_hwacha.h"
+
+#define UTIDX (i)
+
+#undef RS1
+#undef RS2
+#undef WRITE_RD
+
+#define RS1 UT_RS1(UTIDX)
+#define RS2 UT_RS2(UTIDX)
+#define WRITE_RD(value) UT_WRITE_RD(UTIDX, value)
+
+#undef FRS1
+#undef FRS2
+#undef FRS3
+#undef WRITE_FRD
+
+#define FRS1 UT_FRS1(UTIDX)
+#define FRS2 UT_FRS2(UTIDX)
+#define FRS3 UT_FRS3(UTIDX)
+#define WRITE_FRD(value) UT_WRITE_FRD(UTIDX, value)
+
+// we assume the vector unit has floating-point alus
+#undef require_fp
+#define require_fp
+
+// YUNSUP FIXME
+#undef set_fp_exceptions
+#define set_fp_exceptions
+
+#endif
diff --git a/hwacha/disasm.cc b/hwacha/disasm.cc
deleted file mode 100644
index 086ec6c..0000000
--- a/hwacha/disasm.cc
+++ /dev/null
@@ -1,72 +0,0 @@
-hwacha_disassembler::hwacha_disassembler()
-{
- #define DEFINE_RS1(code) DISASM_INSN(#code, code, 0, xrs1_reg)
- #define DEFINE_RS1_RS2(code) DISASM_INSN(#code, code, 0, xrs1_reg, xrs2_reg)
- #define DEFINE_VEC_XMEM(code) DISASM_INSN(#code, code, 0, vxrd_reg, xrs1_reg)
- #define DEFINE_VEC_XMEMST(code) DISASM_INSN(#code, code, 0, vxrd_reg, xrs1_reg, xrs2_reg)
- #define DEFINE_VEC_FMEM(code) DISASM_INSN(#code, code, 0, vfrd_reg, xrs1_reg)
- #define DEFINE_VEC_FMEMST(code) DISASM_INSN(#code, code, 0, vfrd_reg, xrs1_reg, xrs2_reg)
-
- DEFINE_RS1(vxcptsave);
- DEFINE_RS1(vxcptrestore);
- DEFINE_NOARG(vxcptkill);
-
- DEFINE_RS1(vxcptevac);
- DEFINE_NOARG(vxcpthold);
- DEFINE_RS1_RS2(venqcmd);
- DEFINE_RS1_RS2(venqimm1);
- DEFINE_RS1_RS2(venqimm2);
- DEFINE_RS1_RS2(venqcnt);
-
- DEFINE_VEC_XMEM(vld);
- DEFINE_VEC_XMEM(vlw);
- DEFINE_VEC_XMEM(vlwu);
- DEFINE_VEC_XMEM(vlh);
- DEFINE_VEC_XMEM(vlhu);
- DEFINE_VEC_XMEM(vlb);
- DEFINE_VEC_XMEM(vlbu);
- DEFINE_VEC_FMEM(vfld);
- DEFINE_VEC_FMEM(vflw);
- DEFINE_VEC_XMEMST(vlstd);
- DEFINE_VEC_XMEMST(vlstw);
- DEFINE_VEC_XMEMST(vlstwu);
- DEFINE_VEC_XMEMST(vlsth);
- DEFINE_VEC_XMEMST(vlsthu);
- DEFINE_VEC_XMEMST(vlstb);
- DEFINE_VEC_XMEMST(vlstbu);
- DEFINE_VEC_FMEMST(vflstd);
- DEFINE_VEC_FMEMST(vflstw);
-
- DEFINE_VEC_XMEM(vsd);
- DEFINE_VEC_XMEM(vsw);
- DEFINE_VEC_XMEM(vsh);
- DEFINE_VEC_XMEM(vsb);
- DEFINE_VEC_FMEM(vfsd);
- DEFINE_VEC_FMEM(vfsw);
- DEFINE_VEC_XMEMST(vsstd);
- DEFINE_VEC_XMEMST(vsstw);
- DEFINE_VEC_XMEMST(vssth);
- DEFINE_VEC_XMEMST(vsstb);
- DEFINE_VEC_FMEMST(vfsstd);
- DEFINE_VEC_FMEMST(vfsstw);
-
- DISASM_INSN("vmvv", vmvv, 0, vxrd_reg, vxrs1_reg);
- DISASM_INSN("vmsv", vmsv, 0, vxrd_reg, xrs1_reg);
- DISASM_INSN("vmst", vmst, 0, vxrd_reg, xrs1_reg, xrs2_reg);
- DISASM_INSN("vmts", vmts, 0, xrd_reg, vxrs1_reg, xrs2_reg);
- DISASM_INSN("vfmvv", vfmvv, 0, vfrd_reg, vfrs1_reg);
- DISASM_INSN("vfmsv", vfmsv, 0, vfrd_reg, frs1_reg);
- DISASM_INSN("vfmst", vfmst, 0, vfrd_reg, frs1_reg, frs2_reg);
- DISASM_INSN("vfmts", vfmts, 0, frd_reg, vfrs1_reg, frs2_reg);
-
- DEFINE_RS1_RS2(vvcfg);
- DEFINE_RS1_RS2(vtcfg);
-
- DISASM_INSN("vvcfgivl", vvcfgivl, 0, xrd_reg, xrs1_reg, nxregs_reg, nfregs_reg);
- DISASM_INSN("vtcfgivl", vtcfgivl, 0, xrd_reg, xrs1_reg, nxregs_reg, nfregs_reg);
- DISASM_INSN("vsetvl", vsetvl, 0, xrd_reg, xrs1_reg);
- DISASM_INSN("vf", vf, 0, xrs1_reg, imm);
-
- DEFINE_NOARG(fence_v_l);
- DEFINE_NOARG(fence_v_g);
-}
diff --git a/hwacha/insns/venqcmd.h b/hwacha/hwacha.ac
index e69de29..e69de29 100644
--- a/hwacha/insns/venqcmd.h
+++ b/hwacha/hwacha.ac
diff --git a/hwacha/hwacha.cc b/hwacha/hwacha.cc
new file mode 100644
index 0000000..8eff59c
--- /dev/null
+++ b/hwacha/hwacha.cc
@@ -0,0 +1,46 @@
+#include "hwacha.h"
+
+void ct_state_t::reset()
+{
+ vl = 0;
+ maxvl = 32;
+ nxpr = 32;
+ nfpr = 32;
+
+ vf_pc = -1;
+}
+
+void ut_state_t::reset()
+{
+ run = false;
+ XPR.reset();
+ FPR.reset();
+}
+
+hwacha_t::hwacha_t()
+{
+ ct_state.reset();
+ for (int i=0; i<max_uts; i++)
+ ut_state[i].reset();
+}
+
+std::vector<insn_desc_t> hwacha_t::get_instructions()
+{
+ std::vector<insn_desc_t> insns;
+ #define DECLARE_INSN(name, match, mask) \
+ extern reg_t hwacha_##name(processor_t*, insn_t, reg_t); \
+ insns.push_back((insn_desc_t){match, mask, &::illegal_instruction, hwacha_##name});
+ #include "opcodes_hwacha.h"
+ #undef DECLARE_INSN
+ return insns;
+}
+
+bool hwacha_t::vf_active()
+{
+ for (int i=0; i<get_ct_state()->vl; i++) {
+ if (get_ut_state(i)->run)
+ return true;
+ }
+
+ return false;
+}
diff --git a/hwacha/hwacha.h b/hwacha/hwacha.h
index a92ab4b..ee8de86 100644
--- a/hwacha/hwacha.h
+++ b/hwacha/hwacha.h
@@ -1,49 +1,45 @@
#ifndef _HWACHA_H
#define _HWACHA_H
-// vector stuff
-#define VL vl
-
-#define UT_RS1(idx) uts[idx]->XPR[insn.rtype.rs1]
-#define UT_RS2(idx) uts[idx]->XPR[insn.rtype.rs2]
-#define UT_RD(idx) uts[idx]->XPR.write_port(insn.rtype.rd)
-#define UT_RA(idx) uts[idx]->XPR.write_port(1)
-#define UT_FRS1(idx) uts[idx]->FPR[insn.ftype.rs1]
-#define UT_FRS2(idx) uts[idx]->FPR[insn.ftype.rs2]
-#define UT_FRS3(idx) uts[idx]->FPR[insn.ftype.rs3]
-#define UT_FRD(idx) uts[idx]->FPR.write_port(insn.ftype.rd)
-#define UT_RM(idx) ((insn.ftype.rm != 7) ? insn.ftype.rm : \
- ((uts[idx]->fsr & FSR_RD) >> FSR_RD_SHIFT))
-
-#define UT_LOOP_START for (int i=0;i<VL; i++) {
-#define UT_LOOP_END }
-#define UT_LOOP_RS1 UT_RS1(i)
-#define UT_LOOP_RS2 UT_RS2(i)
-#define UT_LOOP_RD UT_RD(i)
-#define UT_LOOP_RA UT_RA(i)
-#define UT_LOOP_FRS1 UT_FRS1(i)
-#define UT_LOOP_FRS2 UT_FRS2(i)
-#define UT_LOOP_FRS3 UT_FRS3(i)
-#define UT_LOOP_FRD UT_FRD(i)
-#define UT_LOOP_RM UT_RM(i)
-
-#define VEC_LOAD(dst, func, inc) \
- reg_t addr = RS1; \
- UT_LOOP_START \
- UT_LOOP_##dst = mmu.func(addr); \
- addr += inc; \
- UT_LOOP_END
-
-#define VEC_STORE(src, func, inc) \
- reg_t addr = RS1; \
- UT_LOOP_START \
- mmu.func(addr, UT_LOOP_##src); \
- addr += inc; \
- UT_LOOP_END
-
-enum vt_command_t
+#include "extension.h"
+
+struct ct_state_t
+{
+ void reset();
+
+ uint32_t nxpr;
+ uint32_t nfpr;
+ uint32_t maxvl;
+ uint32_t vl;
+
+ reg_t vf_pc;
+};
+
+struct ut_state_t
{
- vt_command_stop,
+ void reset();
+
+ bool run;
+ regfile_t<reg_t, 32, true> XPR;
+ regfile_t<reg_t, 32, false> FPR;
+};
+
+class hwacha_t : public extension_t
+{
+public:
+ hwacha_t();
+ const char* name() { return "hwacha"; }
+ std::vector<insn_desc_t> get_instructions();
+ ct_state_t* get_ct_state() { return &ct_state; }
+ ut_state_t* get_ut_state(int idx) { return &ut_state[idx]; }
+ bool vf_active();
+
+private:
+ static const int max_uts = 2048;
+ ct_state_t ct_state;
+ ut_state_t ut_state[max_uts];
};
+REGISTER_EXTENSION(hwacha, []() { return new hwacha_t; })
+
#endif
diff --git a/hwacha/hwacha.mk.in b/hwacha/hwacha.mk.in
new file mode 100644
index 0000000..cf698d3
--- /dev/null
+++ b/hwacha/hwacha.mk.in
@@ -0,0 +1,35 @@
+get_insn_list = $(shell cat $(1) | sed 's/DECLARE_INSN(\(.*\),.*,.*)/\1/')
+get_opcode = $(shell grep \\\<$(2)\\\> $(1) | sed 's/DECLARE_INSN(.*,\(.*\),.*)/\1/')
+
+hwacha_subproject_deps = \
+ riscv \
+ softfloat \
+
+hwacha_install_prog_srcs = \
+
+hwacha_hdrs = \
+ hwacha.h \
+ decode_hwacha.h \
+ decode_hwacha_ut.h \
+ opcodes_hwacha.h \
+ opcodes_hwacha_ut.h \
+
+hwacha_srcs = \
+ hwacha.cc \
+ $(hwacha_gen_srcs) \
+ $(hwacha_ut_gen_srcs) \
+
+hwacha_test_srcs =
+
+hwacha_gen_srcs = \
+ $(addsuffix .cc, $(call get_insn_list,$(src_dir)/hwacha/opcodes_hwacha.h))
+
+$(hwacha_gen_srcs): %.cc: insns/%.h insn_template_hwacha.cc
+ sed 's/NAME/$(subst .cc,,$@)/' $(src_dir)/hwacha/insn_template_hwacha.cc | sed 's/OPCODE/$(call get_opcode,$(src_dir)/hwacha/opcodes_hwacha.h,$(subst .cc,,$@))/' > $@
+
+hwacha_ut_gen_srcs = \
+ $(addsuffix .cc, $(call get_insn_list,$(src_dir)/hwacha/opcodes_hwacha_ut.h))
+
+$(hwacha_ut_gen_srcs): %.cc: insns_ut/%.h insn_template_hwacha_ut.cc
+ sed 's/NAME/$(subst .cc,,$@)/' $(src_dir)/hwacha/insn_template_hwacha_ut.cc | sed 's/OPCODE/$(call get_opcode,$(src_dir)/hwacha/opcodes_hwacha_ut.h,$(subst .cc,,$@))/' > $@
+
diff --git a/hwacha/insn_template_hwacha.cc b/hwacha/insn_template_hwacha.cc
new file mode 100644
index 0000000..6a1a51a
--- /dev/null
+++ b/hwacha/insn_template_hwacha.cc
@@ -0,0 +1,24 @@
+// See LICENSE for license details.
+
+#include "config.h"
+#include "processor.h"
+#include "mmu.h"
+#include "hwacha.h"
+#include "decode_hwacha.h"
+#include "rocc.h"
+#include <assert.h>
+
+reg_t hwacha_NAME(processor_t* p, insn_t insn, reg_t pc)
+{
+ int xprlen = 64;
+ reg_t npc = sext_xprlen(pc + insn_length(OPCODE));
+ hwacha_t* h = static_cast<hwacha_t*>(p->get_extension());
+ rocc_insn_union_t u;
+ u.i = insn;
+ reg_t xs1 = u.r.xs1 ? RS1 : -1;
+ reg_t xs2 = u.r.xs2 ? RS2 : -1;
+ reg_t xd = -1;
+ #include "insns/NAME.h"
+ if (u.r.xd) WRITE_RD(xd);
+ return npc;
+}
diff --git a/hwacha/insn_template_hwacha_ut.cc b/hwacha/insn_template_hwacha_ut.cc
new file mode 100644
index 0000000..7dad75d
--- /dev/null
+++ b/hwacha/insn_template_hwacha_ut.cc
@@ -0,0 +1,22 @@
+// See LICENSE for license details.
+
+#include "config.h"
+#include "processor.h"
+#include "mmu.h"
+#include "softfloat.h"
+#include "platform.h" // softfloat isNaNF32UI, etc.
+#include "internals.h" // ditto
+#include "hwacha.h"
+#include "decode_hwacha_ut.h"
+#include <assert.h>
+
+reg_t hwacha_NAME(processor_t* p, insn_t insn, reg_t pc)
+{
+ int xprlen = 64;
+ reg_t npc = sext_xprlen(pc + insn_length(OPCODE));
+ hwacha_t* h = static_cast<hwacha_t*>(p->get_extension());
+ for (uint32_t i=0; i<VL; i++) {
+ #include "insns_ut/NAME.h"
+ }
+ return npc;
+}
diff --git a/hwacha/insns/fmovn.h b/hwacha/insns/fmovn.h
deleted file mode 100644
index 394b56c..0000000
--- a/hwacha/insns/fmovn.h
+++ /dev/null
@@ -1,2 +0,0 @@
-require_vector;
-if (RS1 & 0x1) FRD = FRS2;
diff --git a/hwacha/insns/fmovz.h b/hwacha/insns/fmovz.h
deleted file mode 100644
index 7862216..0000000
--- a/hwacha/insns/fmovz.h
+++ /dev/null
@@ -1,2 +0,0 @@
-require_vector;
-if (~RS1 & 0x1) FRD = FRS2;
diff --git a/hwacha/insns/movn.h b/hwacha/insns/movn.h
deleted file mode 100644
index 402d6d3..0000000
--- a/hwacha/insns/movn.h
+++ /dev/null
@@ -1,2 +0,0 @@
-require_vector;
-if (RS1 & 0x1) RD = RS2;
diff --git a/hwacha/insns/movz.h b/hwacha/insns/movz.h
deleted file mode 100644
index 74cf8a9..0000000
--- a/hwacha/insns/movz.h
+++ /dev/null
@@ -1,2 +0,0 @@
-require_vector;
-if (~RS1 & 0x1) RD = RS2;
diff --git a/hwacha/insns/stop.h b/hwacha/insns/stop.h
deleted file mode 100644
index 791a82c..0000000
--- a/hwacha/insns/stop.h
+++ /dev/null
@@ -1,3 +0,0 @@
-require_vector;
-utmode = false;
-throw vt_command_stop;
diff --git a/hwacha/insns/utidx.h b/hwacha/insns/utidx.h
deleted file mode 100644
index b3c944c..0000000
--- a/hwacha/insns/utidx.h
+++ /dev/null
@@ -1,2 +0,0 @@
-require_vector;
-RD = utidx;
diff --git a/hwacha/insns/venqcnt.h b/hwacha/insns/venqcnt.h
deleted file mode 100644
index e69de29..0000000
--- a/hwacha/insns/venqcnt.h
+++ /dev/null
diff --git a/hwacha/insns/venqimm1.h b/hwacha/insns/venqimm1.h
deleted file mode 100644
index e69de29..0000000
--- a/hwacha/insns/venqimm1.h
+++ /dev/null
diff --git a/hwacha/insns/venqimm2.h b/hwacha/insns/venqimm2.h
deleted file mode 100644
index e69de29..0000000
--- a/hwacha/insns/venqimm2.h
+++ /dev/null
diff --git a/hwacha/insns/vf.h b/hwacha/insns/vf.h
index 162cbe6..1e5de3c 100644
--- a/hwacha/insns/vf.h
+++ b/hwacha/insns/vf.h
@@ -1,9 +1,28 @@
-require_vector;
-for (int i=0; i<VL; i++)
-{
- uts[i]->pc = ITYPE_EADDR;
- uts[i]->utmode = true;
- uts[i]->run = true;
- while (uts[i]->utmode)
- uts[i]->step(100, false); // XXX
+if (VL) {
+ if (!h->vf_active()) {
+ h->get_ct_state()->vf_pc = XS1 + insn.s_imm();
+ for (uint32_t i=0; i<VL; i++)
+ h->get_ut_state(i)->run = true;
+ }
+
+ mmu_t::insn_fetch_t ut_fetch = p->get_mmu()->load_insn(h->get_ct_state()->vf_pc);
+ insn_t ut_insn = ut_fetch.insn.insn;
+
+ bool matched = false;
+
+ #define DECLARE_INSN(name, match, mask) \
+ extern reg_t hwacha_##name(processor_t*, insn_t, reg_t); \
+ if ((ut_insn.bits() & mask) == match) { \
+ h->get_ct_state()->vf_pc = hwacha_##name(p, ut_insn, h->get_ct_state()->vf_pc); \
+ matched = true; \
+ }
+ #include "opcodes_hwacha_ut.h"
+ #undef DECLARE_INSN
+
+ // YUNSUP FIXME
+ assert(matched);
+
+ // if vf is still running, rewind pc so that it will execute again
+ if (h->vf_active())
+ npc = pc;
}
diff --git a/hwacha/insns/vfld.h b/hwacha/insns/vfld.h
deleted file mode 100644
index 9b40470..0000000
--- a/hwacha/insns/vfld.h
+++ /dev/null
@@ -1,3 +0,0 @@
-require_vector;
-require_fp;
-VEC_LOAD(FRD, load_int64, 8);
diff --git a/hwacha/insns/vflsegd.h b/hwacha/insns/vflsegd.h
index e69de29..1e12ad2 100644
--- a/hwacha/insns/vflsegd.h
+++ b/hwacha/insns/vflsegd.h
@@ -0,0 +1 @@
+VEC_SEG_LOAD(FPR, load_int64, 8);
diff --git a/hwacha/insns/vflsegstd.h b/hwacha/insns/vflsegstd.h
index e69de29..0d866c6 100644
--- a/hwacha/insns/vflsegstd.h
+++ b/hwacha/insns/vflsegstd.h
@@ -0,0 +1 @@
+VEC_SEG_ST_LOAD(FPR, load_int64, XS2, 8);
diff --git a/hwacha/insns/vflsegstw.h b/hwacha/insns/vflsegstw.h
index e69de29..ee57575 100644
--- a/hwacha/insns/vflsegstw.h
+++ b/hwacha/insns/vflsegstw.h
@@ -0,0 +1 @@
+VEC_SEG_ST_LOAD(FPR, load_int32, XS2, 4);
diff --git a/hwacha/insns/vflsegw.h b/hwacha/insns/vflsegw.h
index e69de29..50dcb2b 100644
--- a/hwacha/insns/vflsegw.h
+++ b/hwacha/insns/vflsegw.h
@@ -0,0 +1 @@
+VEC_SEG_LOAD(FPR, load_int32, 4);
diff --git a/hwacha/insns/vflstd.h b/hwacha/insns/vflstd.h
deleted file mode 100644
index fa9b32d..0000000
--- a/hwacha/insns/vflstd.h
+++ /dev/null
@@ -1,3 +0,0 @@
-require_vector;
-require_fp;
-VEC_LOAD(FRD, load_int64, RS2);
diff --git a/hwacha/insns/vflstw.h b/hwacha/insns/vflstw.h
deleted file mode 100644
index 716c818..0000000
--- a/hwacha/insns/vflstw.h
+++ /dev/null
@@ -1,3 +0,0 @@
-require_vector;
-require_fp;
-VEC_LOAD(FRD, load_int32, RS2);
diff --git a/hwacha/insns/vflw.h b/hwacha/insns/vflw.h
deleted file mode 100644
index 75fdd04..0000000
--- a/hwacha/insns/vflw.h
+++ /dev/null
@@ -1,3 +0,0 @@
-require_vector;
-require_fp;
-VEC_LOAD(FRD, load_int32, 4);
diff --git a/hwacha/insns/vfmst.h b/hwacha/insns/vfmst.h
deleted file mode 100644
index 686d7c5..0000000
--- a/hwacha/insns/vfmst.h
+++ /dev/null
@@ -1,4 +0,0 @@
-require_vector;
-require_fp;
-assert(0 <= RS2 && RS2 < MAX_UTS);
-UT_FRD(RS2) = FRS1;
diff --git a/hwacha/insns/vfmsv.h b/hwacha/insns/vfmsv.h
deleted file mode 100644
index a9aa876..0000000
--- a/hwacha/insns/vfmsv.h
+++ /dev/null
@@ -1,5 +0,0 @@
-require_vector;
-require_fp;
-UT_LOOP_START
- UT_LOOP_FRD = FRS1;
-UT_LOOP_END
diff --git a/hwacha/insns/vfmts.h b/hwacha/insns/vfmts.h
deleted file mode 100644
index a6da126..0000000
--- a/hwacha/insns/vfmts.h
+++ /dev/null
@@ -1,4 +0,0 @@
-require_vector;
-require_fp;
-assert(0 <= RS2 && RS2 < MAX_UTS);
-FRD = UT_FRS1(RS2);
diff --git a/hwacha/insns/vfmvv.h b/hwacha/insns/vfmvv.h
deleted file mode 100644
index 279da21..0000000
--- a/hwacha/insns/vfmvv.h
+++ /dev/null
@@ -1,5 +0,0 @@
-require_vector;
-require_fp;
-UT_LOOP_START
- UT_LOOP_FRD = UT_LOOP_FRS1;
-UT_LOOP_END
diff --git a/hwacha/insns/vfsd.h b/hwacha/insns/vfsd.h
deleted file mode 100644
index f619fc8..0000000
--- a/hwacha/insns/vfsd.h
+++ /dev/null
@@ -1,3 +0,0 @@
-require_vector;
-require_fp;
-VEC_STORE(FRD, store_uint64, 8);
diff --git a/hwacha/insns/vfssegd.h b/hwacha/insns/vfssegd.h
index e69de29..c09159b 100644
--- a/hwacha/insns/vfssegd.h
+++ b/hwacha/insns/vfssegd.h
@@ -0,0 +1 @@
+VEC_SEG_STORE(FPR, store_uint64, 8);
diff --git a/hwacha/insns/vfssegstd.h b/hwacha/insns/vfssegstd.h
index e69de29..f3dc6da 100644
--- a/hwacha/insns/vfssegstd.h
+++ b/hwacha/insns/vfssegstd.h
@@ -0,0 +1 @@
+VEC_SEG_ST_STORE(FPR, store_uint64, XS2, 8);
diff --git a/hwacha/insns/vfssegstw.h b/hwacha/insns/vfssegstw.h
index e69de29..922cc3d 100644
--- a/hwacha/insns/vfssegstw.h
+++ b/hwacha/insns/vfssegstw.h
@@ -0,0 +1 @@
+VEC_SEG_ST_STORE(FPR, store_uint32, XS2, 4);
diff --git a/hwacha/insns/vfssegw.h b/hwacha/insns/vfssegw.h
index e69de29..efd162e 100644
--- a/hwacha/insns/vfssegw.h
+++ b/hwacha/insns/vfssegw.h
@@ -0,0 +1 @@
+VEC_SEG_STORE(FPR, store_uint32, 4);
diff --git a/hwacha/insns/vfsstd.h b/hwacha/insns/vfsstd.h
deleted file mode 100644
index b3bb260..0000000
--- a/hwacha/insns/vfsstd.h
+++ /dev/null
@@ -1,3 +0,0 @@
-require_vector;
-require_fp;
-VEC_STORE(FRD, store_uint64, RS2);
diff --git a/hwacha/insns/vfsstw.h b/hwacha/insns/vfsstw.h
deleted file mode 100644
index 9cef9b0..0000000
--- a/hwacha/insns/vfsstw.h
+++ /dev/null
@@ -1,3 +0,0 @@
-require_vector;
-require_fp;
-VEC_STORE(FRD, store_uint32, RS2);
diff --git a/hwacha/insns/vfsw.h b/hwacha/insns/vfsw.h
deleted file mode 100644
index 3fe3d3f..0000000
--- a/hwacha/insns/vfsw.h
+++ /dev/null
@@ -1,3 +0,0 @@
-require_vector;
-require_fp;
-VEC_STORE(FRD, store_uint32, 4);
diff --git a/hwacha/insns/vgetcfg.h b/hwacha/insns/vgetcfg.h
new file mode 100644
index 0000000..7bd1765
--- /dev/null
+++ b/hwacha/insns/vgetcfg.h
@@ -0,0 +1 @@
+WRITE_XRD((NXPR & 0x3f) | ((NFPR & 0x3f) << 6));
diff --git a/hwacha/insns/vgetvl.h b/hwacha/insns/vgetvl.h
new file mode 100644
index 0000000..11df2f9
--- /dev/null
+++ b/hwacha/insns/vgetvl.h
@@ -0,0 +1 @@
+WRITE_XRD(VL);
diff --git a/hwacha/insns/vlb.h b/hwacha/insns/vlb.h
deleted file mode 100644
index 618380a..0000000
--- a/hwacha/insns/vlb.h
+++ /dev/null
@@ -1,2 +0,0 @@
-require_vector;
-VEC_LOAD(RD, load_int8, 1);
diff --git a/hwacha/insns/vlbu.h b/hwacha/insns/vlbu.h
deleted file mode 100644
index f92c8b5..0000000
--- a/hwacha/insns/vlbu.h
+++ /dev/null
@@ -1,2 +0,0 @@
-require_vector;
-VEC_LOAD(RD, load_uint8, 1);
diff --git a/hwacha/insns/vld.h b/hwacha/insns/vld.h
deleted file mode 100644
index fb7a3c5..0000000
--- a/hwacha/insns/vld.h
+++ /dev/null
@@ -1,3 +0,0 @@
-require_vector;
-require_xpr64;
-VEC_LOAD(RD, load_int64, 8);
diff --git a/hwacha/insns/vlh.h b/hwacha/insns/vlh.h
deleted file mode 100644
index 269c2a8..0000000
--- a/hwacha/insns/vlh.h
+++ /dev/null
@@ -1,2 +0,0 @@
-require_vector;
-VEC_LOAD(RD, load_int16, 2);
diff --git a/hwacha/insns/vlhu.h b/hwacha/insns/vlhu.h
deleted file mode 100644
index 7a2019d..0000000
--- a/hwacha/insns/vlhu.h
+++ /dev/null
@@ -1,2 +0,0 @@
-require_vector;
-VEC_LOAD(RD, load_uint16, 2);
diff --git a/hwacha/insns/vlsegb.h b/hwacha/insns/vlsegb.h
index e69de29..6228b70 100644
--- a/hwacha/insns/vlsegb.h
+++ b/hwacha/insns/vlsegb.h
@@ -0,0 +1 @@
+VEC_SEG_LOAD(XPR, load_int8, 1);
diff --git a/hwacha/insns/vlsegbu.h b/hwacha/insns/vlsegbu.h
index e69de29..aeee563 100644
--- a/hwacha/insns/vlsegbu.h
+++ b/hwacha/insns/vlsegbu.h
@@ -0,0 +1 @@
+VEC_SEG_LOAD(XPR, load_uint8, 1);
diff --git a/hwacha/insns/vlsegd.h b/hwacha/insns/vlsegd.h
index e69de29..8e0006d 100644
--- a/hwacha/insns/vlsegd.h
+++ b/hwacha/insns/vlsegd.h
@@ -0,0 +1 @@
+VEC_SEG_LOAD(XPR, load_int64, 8);
diff --git a/hwacha/insns/vlsegh.h b/hwacha/insns/vlsegh.h
index e69de29..057a296 100644
--- a/hwacha/insns/vlsegh.h
+++ b/hwacha/insns/vlsegh.h
@@ -0,0 +1 @@
+VEC_SEG_LOAD(XPR, load_int16, 2);
diff --git a/hwacha/insns/vlseghu.h b/hwacha/insns/vlseghu.h
index e69de29..6d00649 100644
--- a/hwacha/insns/vlseghu.h
+++ b/hwacha/insns/vlseghu.h
@@ -0,0 +1 @@
+VEC_SEG_LOAD(XPR, load_uint16, 2);
diff --git a/hwacha/insns/vlsegstb.h b/hwacha/insns/vlsegstb.h
index e69de29..468c623 100644
--- a/hwacha/insns/vlsegstb.h
+++ b/hwacha/insns/vlsegstb.h
@@ -0,0 +1 @@
+VEC_SEG_ST_LOAD(XPR, load_int8, XS2, 1);
diff --git a/hwacha/insns/vlsegstbu.h b/hwacha/insns/vlsegstbu.h
index e69de29..ebc1bb0 100644
--- a/hwacha/insns/vlsegstbu.h
+++ b/hwacha/insns/vlsegstbu.h
@@ -0,0 +1 @@
+VEC_SEG_ST_LOAD(XPR, load_uint8, XS2, 1);
diff --git a/hwacha/insns/vlsegstd.h b/hwacha/insns/vlsegstd.h
index e69de29..f4582b9 100644
--- a/hwacha/insns/vlsegstd.h
+++ b/hwacha/insns/vlsegstd.h
@@ -0,0 +1 @@
+VEC_SEG_ST_LOAD(XPR, load_int64, XS2, 8);
diff --git a/hwacha/insns/vlsegsth.h b/hwacha/insns/vlsegsth.h
index e69de29..72d18e7 100644
--- a/hwacha/insns/vlsegsth.h
+++ b/hwacha/insns/vlsegsth.h
@@ -0,0 +1 @@
+VEC_SEG_ST_LOAD(XPR, load_int16, XS2, 2);
diff --git a/hwacha/insns/vlsegsthu.h b/hwacha/insns/vlsegsthu.h
index e69de29..0ac9e98 100644
--- a/hwacha/insns/vlsegsthu.h
+++ b/hwacha/insns/vlsegsthu.h
@@ -0,0 +1 @@
+VEC_SEG_ST_LOAD(XPR, load_uint16, XS2, 2);
diff --git a/hwacha/insns/vlsegstw.h b/hwacha/insns/vlsegstw.h
index e69de29..0269bfa 100644
--- a/hwacha/insns/vlsegstw.h
+++ b/hwacha/insns/vlsegstw.h
@@ -0,0 +1 @@
+VEC_SEG_ST_LOAD(XPR, load_int32, XS2, 4);
diff --git a/hwacha/insns/vlsegstwu.h b/hwacha/insns/vlsegstwu.h
index e69de29..f6b52ae 100644
--- a/hwacha/insns/vlsegstwu.h
+++ b/hwacha/insns/vlsegstwu.h
@@ -0,0 +1 @@
+VEC_SEG_ST_LOAD(XPR, load_uint32, XS2, 4);
diff --git a/hwacha/insns/vlsegw.h b/hwacha/insns/vlsegw.h
index e69de29..312056a 100644
--- a/hwacha/insns/vlsegw.h
+++ b/hwacha/insns/vlsegw.h
@@ -0,0 +1 @@
+VEC_SEG_LOAD(XPR, load_int32, 4);
diff --git a/hwacha/insns/vlsegwu.h b/hwacha/insns/vlsegwu.h
index e69de29..7037aad 100644
--- a/hwacha/insns/vlsegwu.h
+++ b/hwacha/insns/vlsegwu.h
@@ -0,0 +1 @@
+VEC_SEG_LOAD(XPR, load_uint32, 4);
diff --git a/hwacha/insns/vlstb.h b/hwacha/insns/vlstb.h
deleted file mode 100644
index 219d90e..0000000
--- a/hwacha/insns/vlstb.h
+++ /dev/null
@@ -1,2 +0,0 @@
-require_vector;
-VEC_LOAD(RD, load_int8, RS2);
diff --git a/hwacha/insns/vlstbu.h b/hwacha/insns/vlstbu.h
deleted file mode 100644
index 09faa29..0000000
--- a/hwacha/insns/vlstbu.h
+++ /dev/null
@@ -1,2 +0,0 @@
-require_vector;
-VEC_LOAD(RD, load_uint8, RS2);
diff --git a/hwacha/insns/vlstd.h b/hwacha/insns/vlstd.h
deleted file mode 100644
index 5e5de9c..0000000
--- a/hwacha/insns/vlstd.h
+++ /dev/null
@@ -1,3 +0,0 @@
-require_vector;
-require_xpr64;
-VEC_LOAD(RD, load_int64, RS2);
diff --git a/hwacha/insns/vlsth.h b/hwacha/insns/vlsth.h
deleted file mode 100644
index af6b5b5..0000000
--- a/hwacha/insns/vlsth.h
+++ /dev/null
@@ -1,2 +0,0 @@
-require_vector;
-VEC_LOAD(RD, load_int16, RS2);
diff --git a/hwacha/insns/vlsthu.h b/hwacha/insns/vlsthu.h
deleted file mode 100644
index 0fe8452..0000000
--- a/hwacha/insns/vlsthu.h
+++ /dev/null
@@ -1,2 +0,0 @@
-require_vector;
-VEC_LOAD(RD, load_uint16, RS2);
diff --git a/hwacha/insns/vlstw.h b/hwacha/insns/vlstw.h
deleted file mode 100644
index 5375dc0..0000000
--- a/hwacha/insns/vlstw.h
+++ /dev/null
@@ -1,2 +0,0 @@
-require_vector;
-VEC_LOAD(RD, load_int32, RS2);
diff --git a/hwacha/insns/vlstwu.h b/hwacha/insns/vlstwu.h
deleted file mode 100644
index 328e23f..0000000
--- a/hwacha/insns/vlstwu.h
+++ /dev/null
@@ -1,2 +0,0 @@
-require_vector;
-VEC_LOAD(RD, load_uint32, RS2);
diff --git a/hwacha/insns/vlw.h b/hwacha/insns/vlw.h
deleted file mode 100644
index 6e35911..0000000
--- a/hwacha/insns/vlw.h
+++ /dev/null
@@ -1,2 +0,0 @@
-require_vector;
-VEC_LOAD(RD, load_int32, 4);
diff --git a/hwacha/insns/vlwu.h b/hwacha/insns/vlwu.h
deleted file mode 100644
index 4fa1489..0000000
--- a/hwacha/insns/vlwu.h
+++ /dev/null
@@ -1,2 +0,0 @@
-require_vector;
-VEC_LOAD(RD, load_uint32, 4);
diff --git a/hwacha/insns/vmst.h b/hwacha/insns/vmst.h
deleted file mode 100644
index f4d03d9..0000000
--- a/hwacha/insns/vmst.h
+++ /dev/null
@@ -1,3 +0,0 @@
-require_vector;
-assert(0 <= RS2 && RS2 < MAX_UTS);
-UT_RD(RS2) = RS1;
diff --git a/hwacha/insns/vmsv.h b/hwacha/insns/vmsv.h
index c6f4c2c..3995194 100644
--- a/hwacha/insns/vmsv.h
+++ b/hwacha/insns/vmsv.h
@@ -1,4 +1,2 @@
-require_vector;
-UT_LOOP_START
- UT_LOOP_RD = RS1;
-UT_LOOP_END
+for (uint32_t i=0; i<VL; i++)
+ UT_WRITE_RD(i, XS1);
diff --git a/hwacha/insns/vmts.h b/hwacha/insns/vmts.h
deleted file mode 100644
index 2d463bc..0000000
--- a/hwacha/insns/vmts.h
+++ /dev/null
@@ -1,3 +0,0 @@
-require_vector;
-assert(0 <= RS2 && RS2 < MAX_UTS);
-RD = UT_RS1(RS2);
diff --git a/hwacha/insns/vmvv.h b/hwacha/insns/vmvv.h
index 91d63d4..831ed2c 100644
--- a/hwacha/insns/vmvv.h
+++ b/hwacha/insns/vmvv.h
@@ -1,4 +1,3 @@
-require_vector;
-UT_LOOP_START
- UT_LOOP_RD = UT_LOOP_RS1;
-UT_LOOP_END
+for (uint32_t i=0; i<VL; i++) {
+ UT_WRITE_RD(i, UT_RS1(i));
+}
diff --git a/hwacha/insns/vsb.h b/hwacha/insns/vsb.h
deleted file mode 100644
index c3d5b9d..0000000
--- a/hwacha/insns/vsb.h
+++ /dev/null
@@ -1,2 +0,0 @@
-require_vector;
-VEC_STORE(RD, store_uint8, 1);
diff --git a/hwacha/insns/vsd.h b/hwacha/insns/vsd.h
deleted file mode 100644
index 9c02069..0000000
--- a/hwacha/insns/vsd.h
+++ /dev/null
@@ -1,3 +0,0 @@
-require_vector;
-require_xpr64;
-VEC_STORE(RD, store_uint64, 8);
diff --git a/hwacha/insns/vsetcfg.h b/hwacha/insns/vsetcfg.h
new file mode 100644
index 0000000..8ca408c
--- /dev/null
+++ b/hwacha/insns/vsetcfg.h
@@ -0,0 +1,9 @@
+uint32_t nxpr = (XS1 & 0x3f) + (insn.i_imm() & 0x3f);
+uint32_t nfpr = ((XS1 >> 6) & 0x3f) + ((insn.i_imm() >> 6) & 0x3f);
+// YUNSUP FIXME
+// raise trap when nxpr/nfpr is larger than possible
+WRITE_NXPR(nxpr);
+WRITE_NFPR(nfpr);
+uint32_t maxvl = 8 * (256 / (nxpr-1 + nfpr));
+WRITE_MAXVL(maxvl);
+WRITE_VL(0);
diff --git a/hwacha/insns/vsetvl.h b/hwacha/insns/vsetvl.h
index c2212ff..7c8db36 100644
--- a/hwacha/insns/vsetvl.h
+++ b/hwacha/insns/vsetvl.h
@@ -1,3 +1,3 @@
-require_vector;
-setvl(RS1);
-RD = VL;
+uint32_t vl = std::min(MAXVL, (uint32_t)XS1);
+WRITE_VL(vl);
+WRITE_XRD(vl);
diff --git a/hwacha/insns/vsh.h b/hwacha/insns/vsh.h
deleted file mode 100644
index 623eda8..0000000
--- a/hwacha/insns/vsh.h
+++ /dev/null
@@ -1,2 +0,0 @@
-require_vector;
-VEC_STORE(RD, store_uint16, 2);
diff --git a/hwacha/insns/vssegb.h b/hwacha/insns/vssegb.h
index e69de29..2043661 100644
--- a/hwacha/insns/vssegb.h
+++ b/hwacha/insns/vssegb.h
@@ -0,0 +1 @@
+VEC_SEG_STORE(XPR, store_uint8, 1);
diff --git a/hwacha/insns/vssegd.h b/hwacha/insns/vssegd.h
index e69de29..c3c6cbe 100644
--- a/hwacha/insns/vssegd.h
+++ b/hwacha/insns/vssegd.h
@@ -0,0 +1 @@
+VEC_SEG_STORE(XPR, store_uint64, 8);
diff --git a/hwacha/insns/vssegh.h b/hwacha/insns/vssegh.h
index e69de29..16ddf20 100644
--- a/hwacha/insns/vssegh.h
+++ b/hwacha/insns/vssegh.h
@@ -0,0 +1 @@
+VEC_SEG_STORE(XPR, store_uint16, 2);
diff --git a/hwacha/insns/vssegstb.h b/hwacha/insns/vssegstb.h
index e69de29..bb8d85f 100644
--- a/hwacha/insns/vssegstb.h
+++ b/hwacha/insns/vssegstb.h
@@ -0,0 +1 @@
+VEC_SEG_ST_STORE(XPR, store_uint8, XS2, 1);
diff --git a/hwacha/insns/vssegstd.h b/hwacha/insns/vssegstd.h
index e69de29..87bd455 100644
--- a/hwacha/insns/vssegstd.h
+++ b/hwacha/insns/vssegstd.h
@@ -0,0 +1 @@
+VEC_SEG_ST_STORE(XPR, store_uint64, XS2, 8);
diff --git a/hwacha/insns/vssegsth.h b/hwacha/insns/vssegsth.h
index e69de29..02c1ff7 100644
--- a/hwacha/insns/vssegsth.h
+++ b/hwacha/insns/vssegsth.h
@@ -0,0 +1 @@
+VEC_SEG_ST_STORE(XPR, store_uint16, XS2, 2);
diff --git a/hwacha/insns/vssegstw.h b/hwacha/insns/vssegstw.h
index e69de29..71fa4a1 100644
--- a/hwacha/insns/vssegstw.h
+++ b/hwacha/insns/vssegstw.h
@@ -0,0 +1 @@
+VEC_SEG_ST_STORE(XPR, store_uint32, XS2, 4);
diff --git a/hwacha/insns/vssegw.h b/hwacha/insns/vssegw.h
index e69de29..076ee5f 100644
--- a/hwacha/insns/vssegw.h
+++ b/hwacha/insns/vssegw.h
@@ -0,0 +1 @@
+VEC_SEG_STORE(XPR, store_uint32, 4);
diff --git a/hwacha/insns/vsstb.h b/hwacha/insns/vsstb.h
deleted file mode 100644
index b83cc50..0000000
--- a/hwacha/insns/vsstb.h
+++ /dev/null
@@ -1,2 +0,0 @@
-require_vector;
-VEC_STORE(RD, store_uint8, RS2);
diff --git a/hwacha/insns/vsstd.h b/hwacha/insns/vsstd.h
deleted file mode 100644
index 26868d2..0000000
--- a/hwacha/insns/vsstd.h
+++ /dev/null
@@ -1,3 +0,0 @@
-require_vector;
-require_xpr64;
-VEC_STORE(RD, store_uint64, RS2);
diff --git a/hwacha/insns/vssth.h b/hwacha/insns/vssth.h
deleted file mode 100644
index 3904331..0000000
--- a/hwacha/insns/vssth.h
+++ /dev/null
@@ -1,2 +0,0 @@
-require_vector;
-VEC_STORE(RD, store_uint16, RS2);
diff --git a/hwacha/insns/vsstw.h b/hwacha/insns/vsstw.h
deleted file mode 100644
index 8f05953..0000000
--- a/hwacha/insns/vsstw.h
+++ /dev/null
@@ -1,2 +0,0 @@
-require_vector;
-VEC_STORE(RD, store_uint32, RS2);
diff --git a/hwacha/insns/vsw.h b/hwacha/insns/vsw.h
deleted file mode 100644
index 662d4e3..0000000
--- a/hwacha/insns/vsw.h
+++ /dev/null
@@ -1,2 +0,0 @@
-require_vector;
-VEC_STORE(RD, store_uint32, 4);
diff --git a/hwacha/insns/vtcfg.h b/hwacha/insns/vtcfg.h
deleted file mode 100644
index 6e8cbd1..0000000
--- a/hwacha/insns/vtcfg.h
+++ /dev/null
@@ -1,5 +0,0 @@
-require_vector;
-nxpr_use = RS1 & 0x3f;
-nfpr_use = RS2 & 0x3f;
-vcfg();
-setvl(0);
diff --git a/hwacha/insns/vtcfgivl.h b/hwacha/insns/vtcfgivl.h
deleted file mode 100644
index e69de29..0000000
--- a/hwacha/insns/vtcfgivl.h
+++ /dev/null
diff --git a/hwacha/insns/vvcfg.h b/hwacha/insns/vvcfg.h
deleted file mode 100644
index 6e8cbd1..0000000
--- a/hwacha/insns/vvcfg.h
+++ /dev/null
@@ -1,5 +0,0 @@
-require_vector;
-nxpr_use = RS1 & 0x3f;
-nfpr_use = RS2 & 0x3f;
-vcfg();
-setvl(0);
diff --git a/hwacha/insns/vvcfgivl.h b/hwacha/insns/vvcfgivl.h
deleted file mode 100644
index 0ded9f8..0000000
--- a/hwacha/insns/vvcfgivl.h
+++ /dev/null
@@ -1,6 +0,0 @@
-require_vector;
-nxpr_use = SIMM & 0x3f;
-nfpr_use = (SIMM >> 6) & 0x3f;
-vcfg();
-setvl(RS1);
-RD = VL;
diff --git a/hwacha/insns/vxcptevac.h b/hwacha/insns/vxcptevac.h
deleted file mode 100644
index e69de29..0000000
--- a/hwacha/insns/vxcptevac.h
+++ /dev/null
diff --git a/hwacha/insns/vxcpthold.h b/hwacha/insns/vxcpthold.h
deleted file mode 100644
index e69de29..0000000
--- a/hwacha/insns/vxcpthold.h
+++ /dev/null
diff --git a/hwacha/insns/vxcptwait.h b/hwacha/insns/vxcptwait.h
deleted file mode 100644
index e69de29..0000000
--- a/hwacha/insns/vxcptwait.h
+++ /dev/null
diff --git a/hwacha/insns_ut/ut_add.h b/hwacha/insns_ut/ut_add.h
new file mode 120000
index 0000000..c918484
--- /dev/null
+++ b/hwacha/insns_ut/ut_add.h
@@ -0,0 +1 @@
+../../riscv/insns/add.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_addi.h b/hwacha/insns_ut/ut_addi.h
new file mode 120000
index 0000000..8c7cce2
--- /dev/null
+++ b/hwacha/insns_ut/ut_addi.h
@@ -0,0 +1 @@
+../../riscv/insns/addi.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_addiw.h b/hwacha/insns_ut/ut_addiw.h
new file mode 120000
index 0000000..5a1ffda
--- /dev/null
+++ b/hwacha/insns_ut/ut_addiw.h
@@ -0,0 +1 @@
+../../riscv/insns/addiw.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_addw.h b/hwacha/insns_ut/ut_addw.h
new file mode 120000
index 0000000..e594986
--- /dev/null
+++ b/hwacha/insns_ut/ut_addw.h
@@ -0,0 +1 @@
+../../riscv/insns/addw.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_amoadd_d.h b/hwacha/insns_ut/ut_amoadd_d.h
new file mode 120000
index 0000000..3f08289
--- /dev/null
+++ b/hwacha/insns_ut/ut_amoadd_d.h
@@ -0,0 +1 @@
+../../riscv/insns/amoadd_d.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_amoadd_w.h b/hwacha/insns_ut/ut_amoadd_w.h
new file mode 120000
index 0000000..a45ed76
--- /dev/null
+++ b/hwacha/insns_ut/ut_amoadd_w.h
@@ -0,0 +1 @@
+../../riscv/insns/amoadd_w.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_amoand_d.h b/hwacha/insns_ut/ut_amoand_d.h
new file mode 120000
index 0000000..fc6c7d2
--- /dev/null
+++ b/hwacha/insns_ut/ut_amoand_d.h
@@ -0,0 +1 @@
+../../riscv/insns/amoand_d.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_amoand_w.h b/hwacha/insns_ut/ut_amoand_w.h
new file mode 120000
index 0000000..c1a3433
--- /dev/null
+++ b/hwacha/insns_ut/ut_amoand_w.h
@@ -0,0 +1 @@
+../../riscv/insns/amoand_w.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_amomax_d.h b/hwacha/insns_ut/ut_amomax_d.h
new file mode 120000
index 0000000..36d16e7
--- /dev/null
+++ b/hwacha/insns_ut/ut_amomax_d.h
@@ -0,0 +1 @@
+../../riscv/insns/amomax_d.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_amomax_w.h b/hwacha/insns_ut/ut_amomax_w.h
new file mode 120000
index 0000000..c8033c0
--- /dev/null
+++ b/hwacha/insns_ut/ut_amomax_w.h
@@ -0,0 +1 @@
+../../riscv/insns/amomax_w.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_amomaxu_d.h b/hwacha/insns_ut/ut_amomaxu_d.h
new file mode 120000
index 0000000..2a38c71
--- /dev/null
+++ b/hwacha/insns_ut/ut_amomaxu_d.h
@@ -0,0 +1 @@
+../../riscv/insns/amomaxu_d.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_amomaxu_w.h b/hwacha/insns_ut/ut_amomaxu_w.h
new file mode 120000
index 0000000..b6d752e
--- /dev/null
+++ b/hwacha/insns_ut/ut_amomaxu_w.h
@@ -0,0 +1 @@
+../../riscv/insns/amomaxu_w.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_amomin_d.h b/hwacha/insns_ut/ut_amomin_d.h
new file mode 120000
index 0000000..62b831f
--- /dev/null
+++ b/hwacha/insns_ut/ut_amomin_d.h
@@ -0,0 +1 @@
+../../riscv/insns/amomin_d.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_amomin_w.h b/hwacha/insns_ut/ut_amomin_w.h
new file mode 120000
index 0000000..3af34f1
--- /dev/null
+++ b/hwacha/insns_ut/ut_amomin_w.h
@@ -0,0 +1 @@
+../../riscv/insns/amomin_w.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_amominu_d.h b/hwacha/insns_ut/ut_amominu_d.h
new file mode 120000
index 0000000..b4b6fb8
--- /dev/null
+++ b/hwacha/insns_ut/ut_amominu_d.h
@@ -0,0 +1 @@
+../../riscv/insns/amominu_d.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_amominu_w.h b/hwacha/insns_ut/ut_amominu_w.h
new file mode 120000
index 0000000..9f7f1b7
--- /dev/null
+++ b/hwacha/insns_ut/ut_amominu_w.h
@@ -0,0 +1 @@
+../../riscv/insns/amominu_w.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_amoor_d.h b/hwacha/insns_ut/ut_amoor_d.h
new file mode 120000
index 0000000..c8cf47c
--- /dev/null
+++ b/hwacha/insns_ut/ut_amoor_d.h
@@ -0,0 +1 @@
+../../riscv/insns/amoor_d.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_amoor_w.h b/hwacha/insns_ut/ut_amoor_w.h
new file mode 120000
index 0000000..0a85136
--- /dev/null
+++ b/hwacha/insns_ut/ut_amoor_w.h
@@ -0,0 +1 @@
+../../riscv/insns/amoor_w.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_amoswap_d.h b/hwacha/insns_ut/ut_amoswap_d.h
new file mode 120000
index 0000000..97d4c3e
--- /dev/null
+++ b/hwacha/insns_ut/ut_amoswap_d.h
@@ -0,0 +1 @@
+../../riscv/insns/amoswap_d.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_amoswap_w.h b/hwacha/insns_ut/ut_amoswap_w.h
new file mode 120000
index 0000000..f97be68
--- /dev/null
+++ b/hwacha/insns_ut/ut_amoswap_w.h
@@ -0,0 +1 @@
+../../riscv/insns/amoswap_w.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_amoxor_d.h b/hwacha/insns_ut/ut_amoxor_d.h
new file mode 120000
index 0000000..684663f
--- /dev/null
+++ b/hwacha/insns_ut/ut_amoxor_d.h
@@ -0,0 +1 @@
+../../riscv/insns/amoxor_d.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_amoxor_w.h b/hwacha/insns_ut/ut_amoxor_w.h
new file mode 120000
index 0000000..553e587
--- /dev/null
+++ b/hwacha/insns_ut/ut_amoxor_w.h
@@ -0,0 +1 @@
+../../riscv/insns/amoxor_w.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_and.h b/hwacha/insns_ut/ut_and.h
new file mode 120000
index 0000000..270e31e
--- /dev/null
+++ b/hwacha/insns_ut/ut_and.h
@@ -0,0 +1 @@
+../../riscv/insns/and.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_andi.h b/hwacha/insns_ut/ut_andi.h
new file mode 120000
index 0000000..c3a8424
--- /dev/null
+++ b/hwacha/insns_ut/ut_andi.h
@@ -0,0 +1 @@
+../../riscv/insns/andi.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_auipc.h b/hwacha/insns_ut/ut_auipc.h
new file mode 120000
index 0000000..2c0a9e5
--- /dev/null
+++ b/hwacha/insns_ut/ut_auipc.h
@@ -0,0 +1 @@
+../../riscv/insns/auipc.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_div.h b/hwacha/insns_ut/ut_div.h
new file mode 120000
index 0000000..5e43e33
--- /dev/null
+++ b/hwacha/insns_ut/ut_div.h
@@ -0,0 +1 @@
+../../riscv/insns/div.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_divu.h b/hwacha/insns_ut/ut_divu.h
new file mode 120000
index 0000000..9726ad2
--- /dev/null
+++ b/hwacha/insns_ut/ut_divu.h
@@ -0,0 +1 @@
+../../riscv/insns/divu.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_divuw.h b/hwacha/insns_ut/ut_divuw.h
new file mode 120000
index 0000000..a67a2e1
--- /dev/null
+++ b/hwacha/insns_ut/ut_divuw.h
@@ -0,0 +1 @@
+../../riscv/insns/divuw.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_divw.h b/hwacha/insns_ut/ut_divw.h
new file mode 120000
index 0000000..5345781
--- /dev/null
+++ b/hwacha/insns_ut/ut_divw.h
@@ -0,0 +1 @@
+../../riscv/insns/divw.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fadd_d.h b/hwacha/insns_ut/ut_fadd_d.h
new file mode 120000
index 0000000..90443b6
--- /dev/null
+++ b/hwacha/insns_ut/ut_fadd_d.h
@@ -0,0 +1 @@
+../../riscv/insns/fadd_d.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fadd_s.h b/hwacha/insns_ut/ut_fadd_s.h
new file mode 120000
index 0000000..a97aea9
--- /dev/null
+++ b/hwacha/insns_ut/ut_fadd_s.h
@@ -0,0 +1 @@
+../../riscv/insns/fadd_s.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fcvt_d_l.h b/hwacha/insns_ut/ut_fcvt_d_l.h
new file mode 120000
index 0000000..56a699e
--- /dev/null
+++ b/hwacha/insns_ut/ut_fcvt_d_l.h
@@ -0,0 +1 @@
+../../riscv/insns/fcvt_d_l.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fcvt_d_lu.h b/hwacha/insns_ut/ut_fcvt_d_lu.h
new file mode 120000
index 0000000..9f1eefd
--- /dev/null
+++ b/hwacha/insns_ut/ut_fcvt_d_lu.h
@@ -0,0 +1 @@
+../../riscv/insns/fcvt_d_lu.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fcvt_d_s.h b/hwacha/insns_ut/ut_fcvt_d_s.h
new file mode 120000
index 0000000..0814b48
--- /dev/null
+++ b/hwacha/insns_ut/ut_fcvt_d_s.h
@@ -0,0 +1 @@
+../../riscv/insns/fcvt_d_s.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fcvt_d_w.h b/hwacha/insns_ut/ut_fcvt_d_w.h
new file mode 120000
index 0000000..7006dc2
--- /dev/null
+++ b/hwacha/insns_ut/ut_fcvt_d_w.h
@@ -0,0 +1 @@
+../../riscv/insns/fcvt_d_w.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fcvt_d_wu.h b/hwacha/insns_ut/ut_fcvt_d_wu.h
new file mode 120000
index 0000000..5b9a63c
--- /dev/null
+++ b/hwacha/insns_ut/ut_fcvt_d_wu.h
@@ -0,0 +1 @@
+../../riscv/insns/fcvt_d_wu.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fcvt_l_d.h b/hwacha/insns_ut/ut_fcvt_l_d.h
new file mode 120000
index 0000000..e738c00
--- /dev/null
+++ b/hwacha/insns_ut/ut_fcvt_l_d.h
@@ -0,0 +1 @@
+../../riscv/insns/fcvt_l_d.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fcvt_l_s.h b/hwacha/insns_ut/ut_fcvt_l_s.h
new file mode 120000
index 0000000..087c5f7
--- /dev/null
+++ b/hwacha/insns_ut/ut_fcvt_l_s.h
@@ -0,0 +1 @@
+../../riscv/insns/fcvt_l_s.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fcvt_lu_d.h b/hwacha/insns_ut/ut_fcvt_lu_d.h
new file mode 120000
index 0000000..14d02c0
--- /dev/null
+++ b/hwacha/insns_ut/ut_fcvt_lu_d.h
@@ -0,0 +1 @@
+../../riscv/insns/fcvt_lu_d.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fcvt_lu_s.h b/hwacha/insns_ut/ut_fcvt_lu_s.h
new file mode 120000
index 0000000..8cd7c72
--- /dev/null
+++ b/hwacha/insns_ut/ut_fcvt_lu_s.h
@@ -0,0 +1 @@
+../../riscv/insns/fcvt_lu_s.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fcvt_s_d.h b/hwacha/insns_ut/ut_fcvt_s_d.h
new file mode 120000
index 0000000..02ab869
--- /dev/null
+++ b/hwacha/insns_ut/ut_fcvt_s_d.h
@@ -0,0 +1 @@
+../../riscv/insns/fcvt_s_d.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fcvt_s_l.h b/hwacha/insns_ut/ut_fcvt_s_l.h
new file mode 120000
index 0000000..1c37ef8
--- /dev/null
+++ b/hwacha/insns_ut/ut_fcvt_s_l.h
@@ -0,0 +1 @@
+../../riscv/insns/fcvt_s_l.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fcvt_s_lu.h b/hwacha/insns_ut/ut_fcvt_s_lu.h
new file mode 120000
index 0000000..ee9e992
--- /dev/null
+++ b/hwacha/insns_ut/ut_fcvt_s_lu.h
@@ -0,0 +1 @@
+../../riscv/insns/fcvt_s_lu.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fcvt_s_w.h b/hwacha/insns_ut/ut_fcvt_s_w.h
new file mode 120000
index 0000000..f9492c4
--- /dev/null
+++ b/hwacha/insns_ut/ut_fcvt_s_w.h
@@ -0,0 +1 @@
+../../riscv/insns/fcvt_s_w.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fcvt_s_wu.h b/hwacha/insns_ut/ut_fcvt_s_wu.h
new file mode 120000
index 0000000..b8cc0b3
--- /dev/null
+++ b/hwacha/insns_ut/ut_fcvt_s_wu.h
@@ -0,0 +1 @@
+../../riscv/insns/fcvt_s_wu.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fcvt_w_d.h b/hwacha/insns_ut/ut_fcvt_w_d.h
new file mode 120000
index 0000000..9be0029
--- /dev/null
+++ b/hwacha/insns_ut/ut_fcvt_w_d.h
@@ -0,0 +1 @@
+../../riscv/insns/fcvt_w_d.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fcvt_w_s.h b/hwacha/insns_ut/ut_fcvt_w_s.h
new file mode 120000
index 0000000..66050c8
--- /dev/null
+++ b/hwacha/insns_ut/ut_fcvt_w_s.h
@@ -0,0 +1 @@
+../../riscv/insns/fcvt_w_s.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fcvt_wu_d.h b/hwacha/insns_ut/ut_fcvt_wu_d.h
new file mode 120000
index 0000000..2f7807b
--- /dev/null
+++ b/hwacha/insns_ut/ut_fcvt_wu_d.h
@@ -0,0 +1 @@
+../../riscv/insns/fcvt_wu_d.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fcvt_wu_s.h b/hwacha/insns_ut/ut_fcvt_wu_s.h
new file mode 120000
index 0000000..aa141ac
--- /dev/null
+++ b/hwacha/insns_ut/ut_fcvt_wu_s.h
@@ -0,0 +1 @@
+../../riscv/insns/fcvt_wu_s.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fdiv_d.h b/hwacha/insns_ut/ut_fdiv_d.h
new file mode 120000
index 0000000..3e6c162
--- /dev/null
+++ b/hwacha/insns_ut/ut_fdiv_d.h
@@ -0,0 +1 @@
+../../riscv/insns/fdiv_d.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fdiv_s.h b/hwacha/insns_ut/ut_fdiv_s.h
new file mode 120000
index 0000000..ab1f1f6
--- /dev/null
+++ b/hwacha/insns_ut/ut_fdiv_s.h
@@ -0,0 +1 @@
+../../riscv/insns/fdiv_s.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fence.h b/hwacha/insns_ut/ut_fence.h
new file mode 120000
index 0000000..c3ebdd4
--- /dev/null
+++ b/hwacha/insns_ut/ut_fence.h
@@ -0,0 +1 @@
+../../riscv/insns/fence.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_feq_d.h b/hwacha/insns_ut/ut_feq_d.h
new file mode 120000
index 0000000..3c2b873
--- /dev/null
+++ b/hwacha/insns_ut/ut_feq_d.h
@@ -0,0 +1 @@
+../../riscv/insns/feq_d.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_feq_s.h b/hwacha/insns_ut/ut_feq_s.h
new file mode 120000
index 0000000..e3b0e29
--- /dev/null
+++ b/hwacha/insns_ut/ut_feq_s.h
@@ -0,0 +1 @@
+../../riscv/insns/feq_s.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fld.h b/hwacha/insns_ut/ut_fld.h
new file mode 120000
index 0000000..4368897
--- /dev/null
+++ b/hwacha/insns_ut/ut_fld.h
@@ -0,0 +1 @@
+../../riscv/insns/fld.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fle_d.h b/hwacha/insns_ut/ut_fle_d.h
new file mode 120000
index 0000000..8a6170a
--- /dev/null
+++ b/hwacha/insns_ut/ut_fle_d.h
@@ -0,0 +1 @@
+../../riscv/insns/fle_d.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fle_s.h b/hwacha/insns_ut/ut_fle_s.h
new file mode 120000
index 0000000..46b1ac3
--- /dev/null
+++ b/hwacha/insns_ut/ut_fle_s.h
@@ -0,0 +1 @@
+../../riscv/insns/fle_s.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_flt_d.h b/hwacha/insns_ut/ut_flt_d.h
new file mode 120000
index 0000000..fd77b3b
--- /dev/null
+++ b/hwacha/insns_ut/ut_flt_d.h
@@ -0,0 +1 @@
+../../riscv/insns/flt_d.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_flt_s.h b/hwacha/insns_ut/ut_flt_s.h
new file mode 120000
index 0000000..3c665e5
--- /dev/null
+++ b/hwacha/insns_ut/ut_flt_s.h
@@ -0,0 +1 @@
+../../riscv/insns/flt_s.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_flw.h b/hwacha/insns_ut/ut_flw.h
new file mode 120000
index 0000000..056f569
--- /dev/null
+++ b/hwacha/insns_ut/ut_flw.h
@@ -0,0 +1 @@
+../../riscv/insns/flw.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fmadd_d.h b/hwacha/insns_ut/ut_fmadd_d.h
new file mode 120000
index 0000000..1df086c
--- /dev/null
+++ b/hwacha/insns_ut/ut_fmadd_d.h
@@ -0,0 +1 @@
+../../riscv/insns/fmadd_d.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fmadd_s.h b/hwacha/insns_ut/ut_fmadd_s.h
new file mode 120000
index 0000000..4283c41
--- /dev/null
+++ b/hwacha/insns_ut/ut_fmadd_s.h
@@ -0,0 +1 @@
+../../riscv/insns/fmadd_s.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fmax_d.h b/hwacha/insns_ut/ut_fmax_d.h
new file mode 120000
index 0000000..e095874
--- /dev/null
+++ b/hwacha/insns_ut/ut_fmax_d.h
@@ -0,0 +1 @@
+../../riscv/insns/fmax_d.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fmax_s.h b/hwacha/insns_ut/ut_fmax_s.h
new file mode 120000
index 0000000..ec86ec5
--- /dev/null
+++ b/hwacha/insns_ut/ut_fmax_s.h
@@ -0,0 +1 @@
+../../riscv/insns/fmax_s.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fmin_d.h b/hwacha/insns_ut/ut_fmin_d.h
new file mode 120000
index 0000000..3df7a1c
--- /dev/null
+++ b/hwacha/insns_ut/ut_fmin_d.h
@@ -0,0 +1 @@
+../../riscv/insns/fmin_d.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fmin_s.h b/hwacha/insns_ut/ut_fmin_s.h
new file mode 120000
index 0000000..2950bb6
--- /dev/null
+++ b/hwacha/insns_ut/ut_fmin_s.h
@@ -0,0 +1 @@
+../../riscv/insns/fmin_s.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fmovn.h b/hwacha/insns_ut/ut_fmovn.h
new file mode 100644
index 0000000..6bd5e9d
--- /dev/null
+++ b/hwacha/insns_ut/ut_fmovn.h
@@ -0,0 +1 @@
+if (RS1 & 0x1) WRITE_FRD(FRS2);
diff --git a/hwacha/insns_ut/ut_fmovz.h b/hwacha/insns_ut/ut_fmovz.h
new file mode 100644
index 0000000..c070d2c
--- /dev/null
+++ b/hwacha/insns_ut/ut_fmovz.h
@@ -0,0 +1 @@
+if (~RS1 & 0x1) WRITE_FRD(FRS2);
diff --git a/hwacha/insns_ut/ut_fmsub_d.h b/hwacha/insns_ut/ut_fmsub_d.h
new file mode 120000
index 0000000..a1f5ba1
--- /dev/null
+++ b/hwacha/insns_ut/ut_fmsub_d.h
@@ -0,0 +1 @@
+../../riscv/insns/fmsub_d.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fmsub_s.h b/hwacha/insns_ut/ut_fmsub_s.h
new file mode 120000
index 0000000..1e898cf
--- /dev/null
+++ b/hwacha/insns_ut/ut_fmsub_s.h
@@ -0,0 +1 @@
+../../riscv/insns/fmsub_s.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fmul_d.h b/hwacha/insns_ut/ut_fmul_d.h
new file mode 120000
index 0000000..9147067
--- /dev/null
+++ b/hwacha/insns_ut/ut_fmul_d.h
@@ -0,0 +1 @@
+../../riscv/insns/fmul_d.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fmul_s.h b/hwacha/insns_ut/ut_fmul_s.h
new file mode 120000
index 0000000..7c98e0a
--- /dev/null
+++ b/hwacha/insns_ut/ut_fmul_s.h
@@ -0,0 +1 @@
+../../riscv/insns/fmul_s.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fmv_d_x.h b/hwacha/insns_ut/ut_fmv_d_x.h
new file mode 120000
index 0000000..9e43c93
--- /dev/null
+++ b/hwacha/insns_ut/ut_fmv_d_x.h
@@ -0,0 +1 @@
+../../riscv/insns/fmv_d_x.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fmv_s_x.h b/hwacha/insns_ut/ut_fmv_s_x.h
new file mode 120000
index 0000000..4106ef4
--- /dev/null
+++ b/hwacha/insns_ut/ut_fmv_s_x.h
@@ -0,0 +1 @@
+../../riscv/insns/fmv_s_x.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fmv_x_d.h b/hwacha/insns_ut/ut_fmv_x_d.h
new file mode 120000
index 0000000..6de3157
--- /dev/null
+++ b/hwacha/insns_ut/ut_fmv_x_d.h
@@ -0,0 +1 @@
+../../riscv/insns/fmv_x_d.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fmv_x_s.h b/hwacha/insns_ut/ut_fmv_x_s.h
new file mode 120000
index 0000000..4d26ecc
--- /dev/null
+++ b/hwacha/insns_ut/ut_fmv_x_s.h
@@ -0,0 +1 @@
+../../riscv/insns/fmv_x_s.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fnmadd_d.h b/hwacha/insns_ut/ut_fnmadd_d.h
new file mode 120000
index 0000000..439c088
--- /dev/null
+++ b/hwacha/insns_ut/ut_fnmadd_d.h
@@ -0,0 +1 @@
+../../riscv/insns/fnmadd_d.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fnmadd_s.h b/hwacha/insns_ut/ut_fnmadd_s.h
new file mode 120000
index 0000000..4b3d954
--- /dev/null
+++ b/hwacha/insns_ut/ut_fnmadd_s.h
@@ -0,0 +1 @@
+../../riscv/insns/fnmadd_s.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fnmsub_d.h b/hwacha/insns_ut/ut_fnmsub_d.h
new file mode 120000
index 0000000..5c33936
--- /dev/null
+++ b/hwacha/insns_ut/ut_fnmsub_d.h
@@ -0,0 +1 @@
+../../riscv/insns/fnmsub_d.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fnmsub_s.h b/hwacha/insns_ut/ut_fnmsub_s.h
new file mode 120000
index 0000000..ffd0f1d
--- /dev/null
+++ b/hwacha/insns_ut/ut_fnmsub_s.h
@@ -0,0 +1 @@
+../../riscv/insns/fnmsub_s.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_frsr.h b/hwacha/insns_ut/ut_frsr.h
new file mode 120000
index 0000000..d7cf986
--- /dev/null
+++ b/hwacha/insns_ut/ut_frsr.h
@@ -0,0 +1 @@
+../../riscv/insns/frsr.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fsd.h b/hwacha/insns_ut/ut_fsd.h
new file mode 120000
index 0000000..0466f22
--- /dev/null
+++ b/hwacha/insns_ut/ut_fsd.h
@@ -0,0 +1 @@
+../../riscv/insns/fsd.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fsgnj_d.h b/hwacha/insns_ut/ut_fsgnj_d.h
new file mode 120000
index 0000000..39870ef
--- /dev/null
+++ b/hwacha/insns_ut/ut_fsgnj_d.h
@@ -0,0 +1 @@
+../../riscv/insns/fsgnj_d.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fsgnj_s.h b/hwacha/insns_ut/ut_fsgnj_s.h
new file mode 120000
index 0000000..b187302
--- /dev/null
+++ b/hwacha/insns_ut/ut_fsgnj_s.h
@@ -0,0 +1 @@
+../../riscv/insns/fsgnj_s.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fsgnjn_d.h b/hwacha/insns_ut/ut_fsgnjn_d.h
new file mode 120000
index 0000000..5e5af56
--- /dev/null
+++ b/hwacha/insns_ut/ut_fsgnjn_d.h
@@ -0,0 +1 @@
+../../riscv/insns/fsgnjn_d.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fsgnjn_s.h b/hwacha/insns_ut/ut_fsgnjn_s.h
new file mode 120000
index 0000000..d833f76
--- /dev/null
+++ b/hwacha/insns_ut/ut_fsgnjn_s.h
@@ -0,0 +1 @@
+../../riscv/insns/fsgnjn_s.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fsgnjx_d.h b/hwacha/insns_ut/ut_fsgnjx_d.h
new file mode 120000
index 0000000..6e53ea4
--- /dev/null
+++ b/hwacha/insns_ut/ut_fsgnjx_d.h
@@ -0,0 +1 @@
+../../riscv/insns/fsgnjx_d.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fsgnjx_s.h b/hwacha/insns_ut/ut_fsgnjx_s.h
new file mode 120000
index 0000000..6792056
--- /dev/null
+++ b/hwacha/insns_ut/ut_fsgnjx_s.h
@@ -0,0 +1 @@
+../../riscv/insns/fsgnjx_s.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fsqrt_d.h b/hwacha/insns_ut/ut_fsqrt_d.h
new file mode 120000
index 0000000..72bfaf4
--- /dev/null
+++ b/hwacha/insns_ut/ut_fsqrt_d.h
@@ -0,0 +1 @@
+../../riscv/insns/fsqrt_d.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fsqrt_s.h b/hwacha/insns_ut/ut_fsqrt_s.h
new file mode 120000
index 0000000..36eca16
--- /dev/null
+++ b/hwacha/insns_ut/ut_fsqrt_s.h
@@ -0,0 +1 @@
+../../riscv/insns/fsqrt_s.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fssr.h b/hwacha/insns_ut/ut_fssr.h
new file mode 120000
index 0000000..1ca6bea
--- /dev/null
+++ b/hwacha/insns_ut/ut_fssr.h
@@ -0,0 +1 @@
+../../riscv/insns/fssr.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fsub_d.h b/hwacha/insns_ut/ut_fsub_d.h
new file mode 120000
index 0000000..098fad0
--- /dev/null
+++ b/hwacha/insns_ut/ut_fsub_d.h
@@ -0,0 +1 @@
+../../riscv/insns/fsub_d.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fsub_s.h b/hwacha/insns_ut/ut_fsub_s.h
new file mode 120000
index 0000000..6b01668
--- /dev/null
+++ b/hwacha/insns_ut/ut_fsub_s.h
@@ -0,0 +1 @@
+../../riscv/insns/fsub_s.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_fsw.h b/hwacha/insns_ut/ut_fsw.h
new file mode 120000
index 0000000..0079240
--- /dev/null
+++ b/hwacha/insns_ut/ut_fsw.h
@@ -0,0 +1 @@
+../../riscv/insns/fsw.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_lb.h b/hwacha/insns_ut/ut_lb.h
new file mode 120000
index 0000000..0b0d8ef
--- /dev/null
+++ b/hwacha/insns_ut/ut_lb.h
@@ -0,0 +1 @@
+../../riscv/insns/lb.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_lbu.h b/hwacha/insns_ut/ut_lbu.h
new file mode 120000
index 0000000..857c658
--- /dev/null
+++ b/hwacha/insns_ut/ut_lbu.h
@@ -0,0 +1 @@
+../../riscv/insns/lbu.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_ld.h b/hwacha/insns_ut/ut_ld.h
new file mode 120000
index 0000000..6da0f61
--- /dev/null
+++ b/hwacha/insns_ut/ut_ld.h
@@ -0,0 +1 @@
+../../riscv/insns/ld.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_lh.h b/hwacha/insns_ut/ut_lh.h
new file mode 120000
index 0000000..c12eb1d
--- /dev/null
+++ b/hwacha/insns_ut/ut_lh.h
@@ -0,0 +1 @@
+../../riscv/insns/lh.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_lhu.h b/hwacha/insns_ut/ut_lhu.h
new file mode 120000
index 0000000..1bde33f
--- /dev/null
+++ b/hwacha/insns_ut/ut_lhu.h
@@ -0,0 +1 @@
+../../riscv/insns/lhu.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_lui.h b/hwacha/insns_ut/ut_lui.h
new file mode 120000
index 0000000..723da3d
--- /dev/null
+++ b/hwacha/insns_ut/ut_lui.h
@@ -0,0 +1 @@
+../../riscv/insns/lui.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_lw.h b/hwacha/insns_ut/ut_lw.h
new file mode 120000
index 0000000..05d6159
--- /dev/null
+++ b/hwacha/insns_ut/ut_lw.h
@@ -0,0 +1 @@
+../../riscv/insns/lw.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_lwu.h b/hwacha/insns_ut/ut_lwu.h
new file mode 120000
index 0000000..4f446ae
--- /dev/null
+++ b/hwacha/insns_ut/ut_lwu.h
@@ -0,0 +1 @@
+../../riscv/insns/lwu.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_movn.h b/hwacha/insns_ut/ut_movn.h
new file mode 100644
index 0000000..90a6cd9
--- /dev/null
+++ b/hwacha/insns_ut/ut_movn.h
@@ -0,0 +1 @@
+if (RS1 & 0x1) WRITE_RD(RS2);
diff --git a/hwacha/insns_ut/ut_movz.h b/hwacha/insns_ut/ut_movz.h
new file mode 100644
index 0000000..ce14162
--- /dev/null
+++ b/hwacha/insns_ut/ut_movz.h
@@ -0,0 +1 @@
+if (~RS1 & 0x1) WRITE_RD(RS2);
diff --git a/hwacha/insns_ut/ut_mul.h b/hwacha/insns_ut/ut_mul.h
new file mode 120000
index 0000000..8b0ef35
--- /dev/null
+++ b/hwacha/insns_ut/ut_mul.h
@@ -0,0 +1 @@
+../../riscv/insns/mul.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_mulh.h b/hwacha/insns_ut/ut_mulh.h
new file mode 120000
index 0000000..b631d76
--- /dev/null
+++ b/hwacha/insns_ut/ut_mulh.h
@@ -0,0 +1 @@
+../../riscv/insns/mulh.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_mulhsu.h b/hwacha/insns_ut/ut_mulhsu.h
new file mode 120000
index 0000000..50db4ea
--- /dev/null
+++ b/hwacha/insns_ut/ut_mulhsu.h
@@ -0,0 +1 @@
+../../riscv/insns/mulhsu.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_mulhu.h b/hwacha/insns_ut/ut_mulhu.h
new file mode 120000
index 0000000..0551583
--- /dev/null
+++ b/hwacha/insns_ut/ut_mulhu.h
@@ -0,0 +1 @@
+../../riscv/insns/mulhu.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_mulw.h b/hwacha/insns_ut/ut_mulw.h
new file mode 120000
index 0000000..e23b6dd
--- /dev/null
+++ b/hwacha/insns_ut/ut_mulw.h
@@ -0,0 +1 @@
+../../riscv/insns/mulw.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_or.h b/hwacha/insns_ut/ut_or.h
new file mode 120000
index 0000000..ec31003
--- /dev/null
+++ b/hwacha/insns_ut/ut_or.h
@@ -0,0 +1 @@
+../../riscv/insns/or.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_ori.h b/hwacha/insns_ut/ut_ori.h
new file mode 120000
index 0000000..c816d3a
--- /dev/null
+++ b/hwacha/insns_ut/ut_ori.h
@@ -0,0 +1 @@
+../../riscv/insns/ori.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_rem.h b/hwacha/insns_ut/ut_rem.h
new file mode 120000
index 0000000..6ecd10d
--- /dev/null
+++ b/hwacha/insns_ut/ut_rem.h
@@ -0,0 +1 @@
+../../riscv/insns/rem.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_remu.h b/hwacha/insns_ut/ut_remu.h
new file mode 120000
index 0000000..a211846
--- /dev/null
+++ b/hwacha/insns_ut/ut_remu.h
@@ -0,0 +1 @@
+../../riscv/insns/remu.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_remuw.h b/hwacha/insns_ut/ut_remuw.h
new file mode 120000
index 0000000..62d0679
--- /dev/null
+++ b/hwacha/insns_ut/ut_remuw.h
@@ -0,0 +1 @@
+../../riscv/insns/remuw.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_remw.h b/hwacha/insns_ut/ut_remw.h
new file mode 120000
index 0000000..af976fa
--- /dev/null
+++ b/hwacha/insns_ut/ut_remw.h
@@ -0,0 +1 @@
+../../riscv/insns/remw.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_sb.h b/hwacha/insns_ut/ut_sb.h
new file mode 120000
index 0000000..a86f0b1
--- /dev/null
+++ b/hwacha/insns_ut/ut_sb.h
@@ -0,0 +1 @@
+../../riscv/insns/sb.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_sd.h b/hwacha/insns_ut/ut_sd.h
new file mode 120000
index 0000000..3b7e0af
--- /dev/null
+++ b/hwacha/insns_ut/ut_sd.h
@@ -0,0 +1 @@
+../../riscv/insns/sd.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_sh.h b/hwacha/insns_ut/ut_sh.h
new file mode 120000
index 0000000..db646db
--- /dev/null
+++ b/hwacha/insns_ut/ut_sh.h
@@ -0,0 +1 @@
+../../riscv/insns/sh.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_sll.h b/hwacha/insns_ut/ut_sll.h
new file mode 120000
index 0000000..ef52f87
--- /dev/null
+++ b/hwacha/insns_ut/ut_sll.h
@@ -0,0 +1 @@
+../../riscv/insns/sll.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_slli.h b/hwacha/insns_ut/ut_slli.h
new file mode 120000
index 0000000..31e63d4
--- /dev/null
+++ b/hwacha/insns_ut/ut_slli.h
@@ -0,0 +1 @@
+../../riscv/insns/slli.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_slliw.h b/hwacha/insns_ut/ut_slliw.h
new file mode 120000
index 0000000..62565f3
--- /dev/null
+++ b/hwacha/insns_ut/ut_slliw.h
@@ -0,0 +1 @@
+../../riscv/insns/slliw.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_sllw.h b/hwacha/insns_ut/ut_sllw.h
new file mode 120000
index 0000000..0977579
--- /dev/null
+++ b/hwacha/insns_ut/ut_sllw.h
@@ -0,0 +1 @@
+../../riscv/insns/sllw.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_slt.h b/hwacha/insns_ut/ut_slt.h
new file mode 120000
index 0000000..5b36a82
--- /dev/null
+++ b/hwacha/insns_ut/ut_slt.h
@@ -0,0 +1 @@
+../../riscv/insns/slt.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_slti.h b/hwacha/insns_ut/ut_slti.h
new file mode 120000
index 0000000..a5eda3b
--- /dev/null
+++ b/hwacha/insns_ut/ut_slti.h
@@ -0,0 +1 @@
+../../riscv/insns/slti.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_sltiu.h b/hwacha/insns_ut/ut_sltiu.h
new file mode 120000
index 0000000..5ce2315
--- /dev/null
+++ b/hwacha/insns_ut/ut_sltiu.h
@@ -0,0 +1 @@
+../../riscv/insns/sltiu.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_sltu.h b/hwacha/insns_ut/ut_sltu.h
new file mode 120000
index 0000000..0d42166
--- /dev/null
+++ b/hwacha/insns_ut/ut_sltu.h
@@ -0,0 +1 @@
+../../riscv/insns/sltu.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_sra.h b/hwacha/insns_ut/ut_sra.h
new file mode 120000
index 0000000..ff64ebb
--- /dev/null
+++ b/hwacha/insns_ut/ut_sra.h
@@ -0,0 +1 @@
+../../riscv/insns/sra.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_srai.h b/hwacha/insns_ut/ut_srai.h
new file mode 120000
index 0000000..458c697
--- /dev/null
+++ b/hwacha/insns_ut/ut_srai.h
@@ -0,0 +1 @@
+../../riscv/insns/srai.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_sraiw.h b/hwacha/insns_ut/ut_sraiw.h
new file mode 120000
index 0000000..652cc61
--- /dev/null
+++ b/hwacha/insns_ut/ut_sraiw.h
@@ -0,0 +1 @@
+../../riscv/insns/sraiw.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_sraw.h b/hwacha/insns_ut/ut_sraw.h
new file mode 120000
index 0000000..b1f279f
--- /dev/null
+++ b/hwacha/insns_ut/ut_sraw.h
@@ -0,0 +1 @@
+../../riscv/insns/sraw.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_srl.h b/hwacha/insns_ut/ut_srl.h
new file mode 120000
index 0000000..0b7119c
--- /dev/null
+++ b/hwacha/insns_ut/ut_srl.h
@@ -0,0 +1 @@
+../../riscv/insns/srl.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_srli.h b/hwacha/insns_ut/ut_srli.h
new file mode 120000
index 0000000..477d500
--- /dev/null
+++ b/hwacha/insns_ut/ut_srli.h
@@ -0,0 +1 @@
+../../riscv/insns/srli.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_srliw.h b/hwacha/insns_ut/ut_srliw.h
new file mode 120000
index 0000000..0bf24cb
--- /dev/null
+++ b/hwacha/insns_ut/ut_srliw.h
@@ -0,0 +1 @@
+../../riscv/insns/srliw.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_srlw.h b/hwacha/insns_ut/ut_srlw.h
new file mode 120000
index 0000000..000c061
--- /dev/null
+++ b/hwacha/insns_ut/ut_srlw.h
@@ -0,0 +1 @@
+../../riscv/insns/srlw.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_stop.h b/hwacha/insns_ut/ut_stop.h
new file mode 100644
index 0000000..c8656cf
--- /dev/null
+++ b/hwacha/insns_ut/ut_stop.h
@@ -0,0 +1 @@
+h->get_ut_state(UTIDX)->run = false;
diff --git a/hwacha/insns_ut/ut_sub.h b/hwacha/insns_ut/ut_sub.h
new file mode 120000
index 0000000..9fcae83
--- /dev/null
+++ b/hwacha/insns_ut/ut_sub.h
@@ -0,0 +1 @@
+../../riscv/insns/sub.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_subw.h b/hwacha/insns_ut/ut_subw.h
new file mode 120000
index 0000000..c6da9f7
--- /dev/null
+++ b/hwacha/insns_ut/ut_subw.h
@@ -0,0 +1 @@
+../../riscv/insns/subw.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_sw.h b/hwacha/insns_ut/ut_sw.h
new file mode 120000
index 0000000..15db598
--- /dev/null
+++ b/hwacha/insns_ut/ut_sw.h
@@ -0,0 +1 @@
+../../riscv/insns/sw.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_utidx.h b/hwacha/insns_ut/ut_utidx.h
new file mode 100644
index 0000000..f7ee7f8
--- /dev/null
+++ b/hwacha/insns_ut/ut_utidx.h
@@ -0,0 +1 @@
+WRITE_RD(UTIDX);
diff --git a/hwacha/insns_ut/ut_xor.h b/hwacha/insns_ut/ut_xor.h
new file mode 120000
index 0000000..f112aff
--- /dev/null
+++ b/hwacha/insns_ut/ut_xor.h
@@ -0,0 +1 @@
+../../riscv/insns/xor.h \ No newline at end of file
diff --git a/hwacha/insns_ut/ut_xori.h b/hwacha/insns_ut/ut_xori.h
new file mode 120000
index 0000000..fc9d643
--- /dev/null
+++ b/hwacha/insns_ut/ut_xori.h
@@ -0,0 +1 @@
+../../riscv/insns/xori.h \ No newline at end of file
diff --git a/hwacha/opcodes_hwacha.h b/hwacha/opcodes_hwacha.h
new file mode 100644
index 0000000..75cbfa6
--- /dev/null
+++ b/hwacha/opcodes_hwacha.h
@@ -0,0 +1,40 @@
+DECLARE_INSN(vf, 0x10202b, 0x1f0707f)
+DECLARE_INSN(vflsegd, 0x1600205b, 0x1ff0707f)
+DECLARE_INSN(vflsegstd, 0x1600305b, 0x1e00707f)
+DECLARE_INSN(vflsegstw, 0x1400305b, 0x1e00707f)
+DECLARE_INSN(vflsegw, 0x1400205b, 0x1ff0707f)
+DECLARE_INSN(vfssegd, 0x1600207b, 0x1ff0707f)
+DECLARE_INSN(vfssegstd, 0x1600307b, 0x1e00707f)
+DECLARE_INSN(vfssegstw, 0x1400307b, 0x1e00707f)
+DECLARE_INSN(vfssegw, 0x1400207b, 0x1ff0707f)
+DECLARE_INSN(vgetcfg, 0x400b, 0xfffff07f)
+DECLARE_INSN(vgetvl, 0x200400b, 0xfffff07f)
+DECLARE_INSN(vlsegb, 0x205b, 0x1ff0707f)
+DECLARE_INSN(vlsegbu, 0x800205b, 0x1ff0707f)
+DECLARE_INSN(vlsegd, 0x600205b, 0x1ff0707f)
+DECLARE_INSN(vlsegh, 0x200205b, 0x1ff0707f)
+DECLARE_INSN(vlseghu, 0xa00205b, 0x1ff0707f)
+DECLARE_INSN(vlsegstb, 0x305b, 0x1e00707f)
+DECLARE_INSN(vlsegstbu, 0x800305b, 0x1e00707f)
+DECLARE_INSN(vlsegstd, 0x600305b, 0x1e00707f)
+DECLARE_INSN(vlsegsth, 0x200305b, 0x1e00707f)
+DECLARE_INSN(vlsegsthu, 0xa00305b, 0x1e00707f)
+DECLARE_INSN(vlsegstw, 0x400305b, 0x1e00707f)
+DECLARE_INSN(vlsegstwu, 0xc00305b, 0x1e00707f)
+DECLARE_INSN(vlsegw, 0x400205b, 0x1ff0707f)
+DECLARE_INSN(vlsegwu, 0xc00205b, 0x1ff0707f)
+DECLARE_INSN(vmsv, 0x200202b, 0xfff0707f)
+DECLARE_INSN(vmvv, 0x200002b, 0xfff0707f)
+DECLARE_INSN(vsetcfg, 0x200b, 0x7fff)
+DECLARE_INSN(vsetvl, 0x600b, 0xfff0707f)
+DECLARE_INSN(vssegb, 0x207b, 0x1ff0707f)
+DECLARE_INSN(vssegd, 0x600207b, 0x1ff0707f)
+DECLARE_INSN(vssegh, 0x200207b, 0x1ff0707f)
+DECLARE_INSN(vssegstb, 0x307b, 0x1e00707f)
+DECLARE_INSN(vssegstd, 0x600307b, 0x1e00707f)
+DECLARE_INSN(vssegsth, 0x200307b, 0x1e00707f)
+DECLARE_INSN(vssegstw, 0x400307b, 0x1e00707f)
+DECLARE_INSN(vssegw, 0x400207b, 0x1ff0707f)
+DECLARE_INSN(vxcptkill, 0x400302b, 0xffffffff)
+DECLARE_INSN(vxcptrestore, 0x200302b, 0xfff07fff)
+DECLARE_INSN(vxcptsave, 0x302b, 0xfff07fff)
diff --git a/hwacha/opcodes_hwacha_ut.h b/hwacha/opcodes_hwacha_ut.h
new file mode 100644
index 0000000..bd9e8b9
--- /dev/null
+++ b/hwacha/opcodes_hwacha_ut.h
@@ -0,0 +1,141 @@
+DECLARE_INSN(ut_movn, 0x2007077, 0xfe00707f)
+DECLARE_INSN(ut_movz, 0x7077, 0xfe00707f)
+DECLARE_INSN(ut_fmovn, 0x6007077, 0xfe00707f)
+DECLARE_INSN(ut_fmovz, 0x4007077, 0xfe00707f)
+DECLARE_INSN(ut_stop, 0x5077, 0xffffffff)
+DECLARE_INSN(ut_utidx, 0x6077, 0xfffff07f)
+DECLARE_INSN(ut_fmv_s_x, 0xf0000053, 0xfff0707f)
+DECLARE_INSN(ut_amoxor_w, 0x2000202f, 0xf800707f)
+DECLARE_INSN(ut_remuw, 0x200703b, 0xfe00707f)
+DECLARE_INSN(ut_fmin_d, 0xc2000053, 0xfe00707f)
+DECLARE_INSN(ut_amomax_d, 0xa000302f, 0xf800707f)
+DECLARE_INSN(ut_fmin_s, 0xc0000053, 0xfe00707f)
+DECLARE_INSN(ut_slliw, 0x4000101b, 0xfe00707f)
+DECLARE_INSN(ut_lb, 0x3, 0x707f)
+DECLARE_INSN(ut_fcvt_s_wu, 0x78000053, 0xfff0007f)
+DECLARE_INSN(ut_fcvt_d_l, 0x62000053, 0xfff0007f)
+DECLARE_INSN(ut_lh, 0x1003, 0x707f)
+DECLARE_INSN(ut_frsr, 0xe8000053, 0xfffff07f)
+DECLARE_INSN(ut_fcvt_d_w, 0x72000053, 0xfff0007f)
+DECLARE_INSN(ut_lw, 0x2003, 0x707f)
+DECLARE_INSN(ut_add, 0x33, 0xfe00707f)
+DECLARE_INSN(ut_fcvt_d_s, 0x82000053, 0xfff0007f)
+DECLARE_INSN(ut_fmax_d, 0xca000053, 0xfe00707f)
+DECLARE_INSN(ut_fcvt_s_d, 0x88000053, 0xfff0007f)
+DECLARE_INSN(ut_fadd_d, 0x2000053, 0xfe00007f)
+DECLARE_INSN(ut_sltiu, 0x3013, 0x707f)
+DECLARE_INSN(ut_fcvt_s_w, 0x70000053, 0xfff0007f)
+DECLARE_INSN(ut_mul, 0x2000033, 0xfe00707f)
+DECLARE_INSN(ut_amominu_d, 0xc000302f, 0xf800707f)
+DECLARE_INSN(ut_srli, 0x5013, 0xfc00707f)
+DECLARE_INSN(ut_amominu_w, 0xc000202f, 0xf800707f)
+DECLARE_INSN(ut_divuw, 0x200503b, 0xfe00707f)
+DECLARE_INSN(ut_mulw, 0x200003b, 0xfe00707f)
+DECLARE_INSN(ut_srlw, 0x503b, 0xfe00707f)
+DECLARE_INSN(ut_div, 0x2004033, 0xfe00707f)
+DECLARE_INSN(ut_fdiv_d, 0x1a000053, 0xfe00007f)
+DECLARE_INSN(ut_fence, 0xf, 0x707f)
+DECLARE_INSN(ut_fnmsub_s, 0x4b, 0x600007f)
+DECLARE_INSN(ut_fcvt_l_s, 0x40000053, 0xfff0007f)
+DECLARE_INSN(ut_fle_s, 0xb8000053, 0xfe00707f)
+DECLARE_INSN(ut_fdiv_s, 0x18000053, 0xfe00007f)
+DECLARE_INSN(ut_fle_d, 0xba000053, 0xfe00707f)
+DECLARE_INSN(ut_fnmsub_d, 0x200004b, 0x600007f)
+DECLARE_INSN(ut_addw, 0x3b, 0xfe00707f)
+DECLARE_INSN(ut_sll, 0x1033, 0xfe00707f)
+DECLARE_INSN(ut_xor, 0x4033, 0xfe00707f)
+DECLARE_INSN(ut_sub, 0x40000033, 0xfe00707f)
+DECLARE_INSN(ut_rem, 0x2006033, 0xfe00707f)
+DECLARE_INSN(ut_srliw, 0x501b, 0xfe00707f)
+DECLARE_INSN(ut_lui, 0x37, 0x7f)
+DECLARE_INSN(ut_fcvt_s_lu, 0x68000053, 0xfff0007f)
+DECLARE_INSN(ut_addi, 0x13, 0x707f)
+DECLARE_INSN(ut_mulh, 0x2001033, 0xfe00707f)
+DECLARE_INSN(ut_fmul_s, 0x10000053, 0xfe00007f)
+DECLARE_INSN(ut_srai, 0x40005013, 0xfc00707f)
+DECLARE_INSN(ut_amoand_d, 0x6000302f, 0xf800707f)
+DECLARE_INSN(ut_flt_d, 0xb2000053, 0xfe00707f)
+DECLARE_INSN(ut_sraw, 0x4000503b, 0xfe00707f)
+DECLARE_INSN(ut_fmul_d, 0x12000053, 0xfe00007f)
+DECLARE_INSN(ut_ld, 0x3003, 0x707f)
+DECLARE_INSN(ut_ori, 0x6013, 0x707f)
+DECLARE_INSN(ut_flt_s, 0xb0000053, 0xfe00707f)
+DECLARE_INSN(ut_addiw, 0x1b, 0x707f)
+DECLARE_INSN(ut_amoand_w, 0x6000202f, 0xf800707f)
+DECLARE_INSN(ut_feq_s, 0xa8000053, 0xfe00707f)
+DECLARE_INSN(ut_fsgnjx_d, 0x3a000053, 0xfe00707f)
+DECLARE_INSN(ut_sra, 0x40005033, 0xfe00707f)
+DECLARE_INSN(ut_sraiw, 0x4000501b, 0xfe00707f)
+DECLARE_INSN(ut_srl, 0x5033, 0xfe00707f)
+DECLARE_INSN(ut_fsub_d, 0xa000053, 0xfe00007f)
+DECLARE_INSN(ut_fsgnjx_s, 0x38000053, 0xfe00707f)
+DECLARE_INSN(ut_feq_d, 0xaa000053, 0xfe00707f)
+DECLARE_INSN(ut_fcvt_d_wu, 0x7a000053, 0xfff0007f)
+DECLARE_INSN(ut_or, 0x6033, 0xfe00707f)
+DECLARE_INSN(ut_fcvt_wu_d, 0x5a000053, 0xfff0007f)
+DECLARE_INSN(ut_subw, 0x4000003b, 0xfe00707f)
+DECLARE_INSN(ut_fmax_s, 0xc8000053, 0xfe00707f)
+DECLARE_INSN(ut_amomaxu_d, 0xe000302f, 0xf800707f)
+DECLARE_INSN(ut_xori, 0x4013, 0x707f)
+DECLARE_INSN(ut_amoxor_d, 0x2000302f, 0xf800707f)
+DECLARE_INSN(ut_amomaxu_w, 0xe000202f, 0xf800707f)
+DECLARE_INSN(ut_fcvt_wu_s, 0x58000053, 0xfff0007f)
+DECLARE_INSN(ut_andi, 0x7013, 0x707f)
+DECLARE_INSN(ut_fmv_x_s, 0xe0000053, 0xfff0707f)
+DECLARE_INSN(ut_fsgnjn_d, 0x32000053, 0xfe00707f)
+DECLARE_INSN(ut_fnmadd_s, 0x4f, 0x600007f)
+DECLARE_INSN(ut_lwu, 0x6003, 0x707f)
+DECLARE_INSN(ut_fmv_x_d, 0xe2000053, 0xfff0707f)
+DECLARE_INSN(ut_fnmadd_d, 0x200004f, 0x600007f)
+DECLARE_INSN(ut_amoadd_d, 0x302f, 0xf800707f)
+DECLARE_INSN(ut_fcvt_w_s, 0x50000053, 0xfff0007f)
+DECLARE_INSN(ut_mulhsu, 0x2002033, 0xfe00707f)
+DECLARE_INSN(ut_amoadd_w, 0x202f, 0xf800707f)
+DECLARE_INSN(ut_fcvt_d_lu, 0x6a000053, 0xfff0007f)
+DECLARE_INSN(ut_fcvt_w_d, 0x52000053, 0xfff0007f)
+DECLARE_INSN(ut_slt, 0x2033, 0xfe00707f)
+DECLARE_INSN(ut_sllw, 0x103b, 0xfe00707f)
+DECLARE_INSN(ut_amoor_d, 0x4000302f, 0xf800707f)
+DECLARE_INSN(ut_slti, 0x2013, 0x707f)
+DECLARE_INSN(ut_remu, 0x2007033, 0xfe00707f)
+DECLARE_INSN(ut_flw, 0x2007, 0x707f)
+DECLARE_INSN(ut_remw, 0x200603b, 0xfe00707f)
+DECLARE_INSN(ut_sltu, 0x3033, 0xfe00707f)
+DECLARE_INSN(ut_slli, 0x40001013, 0xfc00707f)
+DECLARE_INSN(ut_amoor_w, 0x4000202f, 0xf800707f)
+DECLARE_INSN(ut_fld, 0x3007, 0x707f)
+DECLARE_INSN(ut_fsub_s, 0x8000053, 0xfe00007f)
+DECLARE_INSN(ut_and, 0x7033, 0xfe00707f)
+DECLARE_INSN(ut_fmv_d_x, 0xf2000053, 0xfff0707f)
+DECLARE_INSN(ut_lbu, 0x4003, 0x707f)
+DECLARE_INSN(ut_fsgnj_s, 0x28000053, 0xfe00707f)
+DECLARE_INSN(ut_amomax_w, 0xa000202f, 0xf800707f)
+DECLARE_INSN(ut_fsgnj_d, 0x2a000053, 0xfe00707f)
+DECLARE_INSN(ut_mulhu, 0x2003033, 0xfe00707f)
+DECLARE_INSN(ut_fcvt_l_d, 0x42000053, 0xfff0007f)
+DECLARE_INSN(ut_fssr, 0xf8000053, 0xfff0707f)
+DECLARE_INSN(ut_fcvt_lu_s, 0x48000053, 0xfff0007f)
+DECLARE_INSN(ut_fcvt_s_l, 0x60000053, 0xfff0007f)
+DECLARE_INSN(ut_auipc, 0x17, 0x7f)
+DECLARE_INSN(ut_fcvt_lu_d, 0x4a000053, 0xfff0007f)
+DECLARE_INSN(ut_fmadd_s, 0x43, 0x600007f)
+DECLARE_INSN(ut_fsqrt_s, 0x20000053, 0xfff0007f)
+DECLARE_INSN(ut_amomin_w, 0x8000202f, 0xf800707f)
+DECLARE_INSN(ut_fsgnjn_s, 0x30000053, 0xfe00707f)
+DECLARE_INSN(ut_amoswap_d, 0x800302f, 0xf800707f)
+DECLARE_INSN(ut_fsqrt_d, 0x22000053, 0xfff0007f)
+DECLARE_INSN(ut_fmadd_d, 0x2000043, 0x600007f)
+DECLARE_INSN(ut_divw, 0x200403b, 0xfe00707f)
+DECLARE_INSN(ut_amomin_d, 0x8000302f, 0xf800707f)
+DECLARE_INSN(ut_divu, 0x2005033, 0xfe00707f)
+DECLARE_INSN(ut_amoswap_w, 0x800202f, 0xf800707f)
+DECLARE_INSN(ut_fadd_s, 0x53, 0xfe00007f)
+DECLARE_INSN(ut_fsd, 0x3027, 0x707f)
+DECLARE_INSN(ut_sw, 0x2023, 0x707f)
+DECLARE_INSN(ut_fmsub_s, 0x47, 0x600007f)
+DECLARE_INSN(ut_lhu, 0x5003, 0x707f)
+DECLARE_INSN(ut_sh, 0x1023, 0x707f)
+DECLARE_INSN(ut_fsw, 0x2027, 0x707f)
+DECLARE_INSN(ut_sb, 0x23, 0x707f)
+DECLARE_INSN(ut_fmsub_d, 0x2000047, 0x600007f)
+DECLARE_INSN(ut_sd, 0x3023, 0x707f)
diff --git a/riscv/extension.cc b/riscv/extension.cc
index 718ef6d..c6e1ec3 100644
--- a/riscv/extension.cc
+++ b/riscv/extension.cc
@@ -1,6 +1,7 @@
#include "extension.h"
#include "trap.h"
#include "dummy-rocc.h"
+#include "hwacha.h"
std::map<std::string, std::function<extension_t*()>>& extensions()
{
diff --git a/riscv/insns/cflush.h b/riscv/insns/cflush.h
deleted file mode 100644
index 5117ca0..0000000
--- a/riscv/insns/cflush.h
+++ /dev/null
@@ -1 +0,0 @@
-require_supervisor;
diff --git a/riscv/insns/fence_v_g.h b/riscv/insns/fence_v_g.h
deleted file mode 100644
index e69de29..0000000
--- a/riscv/insns/fence_v_g.h
+++ /dev/null
diff --git a/riscv/insns/fence_v_l.h b/riscv/insns/fence_v_l.h
deleted file mode 100644
index e69de29..0000000
--- a/riscv/insns/fence_v_l.h
+++ /dev/null
diff --git a/riscv/riscv.mk.in b/riscv/riscv.mk.in
index fc2982e..3c4480a 100644
--- a/riscv/riscv.mk.in
+++ b/riscv/riscv.mk.in
@@ -4,6 +4,7 @@ get_opcode = $(shell grep \\\<$(2)\\\> $(1) | sed 's/DECLARE_INSN(.*,\(.*\),.*)/
riscv_subproject_deps = \
softfloat_riscv \
softfloat \
+ hwacha \
riscv_install_prog_srcs = \
spike.cc \
diff --git a/riscv/rocc.cc b/riscv/rocc.cc
index 2354f9f..fe221ca 100644
--- a/riscv/rocc.cc
+++ b/riscv/rocc.cc
@@ -2,12 +2,6 @@
#include "trap.h"
#include <cstdlib>
-union rocc_insn_union_t
-{
- rocc_insn_t r;
- insn_t i;
-};
-
#define customX(n) \
static reg_t c##n(processor_t* p, insn_t insn, reg_t pc) \
{ \
diff --git a/riscv/rocc.h b/riscv/rocc.h
index 13980bb..e4148ec 100644
--- a/riscv/rocc.h
+++ b/riscv/rocc.h
@@ -15,6 +15,12 @@ struct rocc_insn_t
unsigned funct : 7;
};
+union rocc_insn_union_t
+{
+ rocc_insn_t r;
+ insn_t i;
+};
+
class rocc_t : public extension_t
{
public:
diff --git a/riscv/spike.cc b/riscv/spike.cc
index 0ab1616..fb2b7da 100644
--- a/riscv/spike.cc
+++ b/riscv/spike.cc
@@ -23,6 +23,7 @@ static void help()
fprintf(stderr, " --ic=<S>:<W>:<B> Instantiate a cache model with S sets,\n");
fprintf(stderr, " --dc=<S>:<W>:<B> W ways, and B-byte blocks (with S and\n");
fprintf(stderr, " --l2=<S>:<W>:<B> B both powers of 2).\n");
+ fprintf(stderr, " --extension=<name> Specify RoCC Extension\n");
exit(1);
}