From: Andrew Waterman Date: Sun, 24 Apr 2011 23:35:13 +0000 (-0700) Subject: [xcc,sim,opcodes] added more RVC instructions X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d5518cd4d9804498204ce8e79ac04870f383966e;p=riscv-isa-sim.git [xcc,sim,opcodes] added more RVC instructions --- diff --git a/riscv/decode.h b/riscv/decode.h index f411c10..63e71cd 100644 --- a/riscv/decode.h +++ b/riscv/decode.h @@ -210,21 +210,27 @@ private: #define INSN_IS_RVC(x) (((x) & 0x3) < 0x3) -#define CRD do_writeback(XPR, (insn.bits >> 5) & 0x1f) +#define CRD_REGNUM ((insn.bits >> 5) & 0x1f) +#define CRD do_writeback(XPR, CRD_REGNUM) #define CRS1 XPR[(insn.bits >> 10) & 0x1f] #define CRS2 XPR[(insn.bits >> 5) & 0x1f] #define CIMM6 ((int32_t)((insn.bits >> 10) & 0x3f) << 26 >> 26) -#define CIMM5 ((int32_t)((insn.bits >> 5) & 0x1f) << 27 >> 27) +#define CIMM5U ((insn.bits >> 5) & 0x1f) +#define CIMM5 ((int32_t)CIMM5U << 27 >> 27) #define CIMM10 ((int32_t)((insn.bits >> 5) & 0x3ff) << 22 >> 22) #define CBRANCH_TARGET (pc + (CIMM5 << BRANCH_ALIGN_BITS)) #define CJUMP_TARGET (pc + (CIMM10 << JUMP_ALIGN_BITS)) static const int rvc_rs1_regmap[8] = { 20, 21, 2, 3, 4, 5, 6, 7 }; #define rvc_rd_regmap rvc_rs1_regmap +#define rvc_rs2b_regmap rvc_rs1_regmap static const int rvc_rs2_regmap[8] = { 20, 21, 2, 3, 4, 5, 6, 0 }; -#define CRDS do_writeback(XPR, rvc_rd_regmap[(insn.bits >> 13) & 0x7]) +#define CRDS XPR[rvc_rd_regmap[(insn.bits >> 13) & 0x7]] +#define FCRDS FPR[rvc_rd_regmap[(insn.bits >> 13) & 0x7]] #define CRS1S XPR[rvc_rs1_regmap[(insn.bits >> 10) & 0x7]] #define CRS2S XPR[rvc_rs2_regmap[(insn.bits >> 13) & 0x7]] +#define CRS2BS XPR[rvc_rs2b_regmap[(insn.bits >> 5) & 0x7]] +#define FCRS2S FPR[rvc_rs2_regmap[(insn.bits >> 13) & 0x7]] // vector stuff #define VL vl diff --git a/riscv/execute.h b/riscv/execute.h index fbc595a..c4ff806 100644 --- a/riscv/execute.h +++ b/riscv/execute.h @@ -3,12 +3,12 @@ switch((insn.bits >> 0x0) & 0x7f) { case 0x0: { - #include "insns/c_addi.h" + #include "insns/c_li.h" break; } case 0x1: { - #include "insns/c_li.h" + #include "insns/c_addi.h" break; } case 0x2: @@ -669,231 +669,118 @@ switch((insn.bits >> 0x0) & 0x7f) #include "insns/c_bne.h" break; } - case 0x13: - { - switch((insn.bits >> 0x7) & 0x7) - { - case 0x0: - { - #include "insns/addi.h" - break; - } - case 0x1: - { - if((insn.bits & 0x3f03ff) == 0x93) - { - #include "insns/slli.h" - break; - } - throw trap_illegal_instruction; - } - case 0x2: - { - #include "insns/slti.h" - break; - } - case 0x3: - { - #include "insns/sltiu.h" - break; - } - case 0x4: - { - #include "insns/xori.h" - break; - } - case 0x5: - { - if((insn.bits & 0x3f03ff) == 0x293) - { - #include "insns/srli.h" - break; - } - if((insn.bits & 0x3f03ff) == 0x10293) - { - #include "insns/srai.h" - break; - } - throw trap_illegal_instruction; - } - case 0x6: - { - #include "insns/ori.h" - break; - } - case 0x7: - { - #include "insns/andi.h" - break; - } - default: - { - throw trap_illegal_instruction; - } - } - break; - } - case 0x1b: - { - switch((insn.bits >> 0x7) & 0x7) - { - case 0x0: - { - #include "insns/addiw.h" - break; - } - case 0x1: - { - if((insn.bits & 0x3f83ff) == 0x9b) - { - #include "insns/slliw.h" - break; - } - throw trap_illegal_instruction; - } - case 0x5: - { - if((insn.bits & 0x3f83ff) == 0x29b) - { - #include "insns/srliw.h" - break; - } - if((insn.bits & 0x3f83ff) == 0x1029b) - { - #include "insns/sraiw.h" - break; - } - throw trap_illegal_instruction; - } - default: - { - throw trap_illegal_instruction; - } - } - break; - } - case 0x20: - { - #include "insns/c_addi.h" - break; - } - case 0x21: - { - #include "insns/c_li.h" - break; - } - case 0x22: + case 0x12: { switch((insn.bits >> 0x7) & 0x7) { case 0x0: { - if((insn.bits & 0x801f) == 0x2) + if((insn.bits & 0x801f) == 0x12) { - #include "insns/c_move.h" + #include "insns/c_lw0.h" break; } - if((insn.bits & 0x801f) == 0x8002) + if((insn.bits & 0x801f) == 0x8012) { - #include "insns/c_j.h" + #include "insns/c_ld0.h" break; } throw trap_illegal_instruction; } case 0x1: { - if((insn.bits & 0x801f) == 0x2) + if((insn.bits & 0x801f) == 0x12) { - #include "insns/c_move.h" + #include "insns/c_lw0.h" break; } - if((insn.bits & 0x801f) == 0x8002) + if((insn.bits & 0x801f) == 0x8012) { - #include "insns/c_j.h" + #include "insns/c_ld0.h" break; } throw trap_illegal_instruction; } case 0x2: { - if((insn.bits & 0x801f) == 0x2) + if((insn.bits & 0x801f) == 0x12) { - #include "insns/c_move.h" + #include "insns/c_lw0.h" break; } - if((insn.bits & 0x801f) == 0x8002) + if((insn.bits & 0x801f) == 0x8012) { - #include "insns/c_j.h" + #include "insns/c_ld0.h" break; } throw trap_illegal_instruction; } case 0x3: { - if((insn.bits & 0x801f) == 0x2) + if((insn.bits & 0x801f) == 0x12) { - #include "insns/c_move.h" + #include "insns/c_lw0.h" break; } - if((insn.bits & 0x801f) == 0x8002) + if((insn.bits & 0x801f) == 0x8012) { - #include "insns/c_j.h" + #include "insns/c_ld0.h" break; } throw trap_illegal_instruction; } case 0x4: { - if((insn.bits & 0x801f) == 0x2) + if((insn.bits & 0x801f) == 0x12) { - #include "insns/c_move.h" + #include "insns/c_lw0.h" break; } - if((insn.bits & 0x801f) == 0x8002) + if((insn.bits & 0x801f) == 0x8012) { - #include "insns/c_j.h" + #include "insns/c_ld0.h" break; } throw trap_illegal_instruction; } case 0x5: { - if((insn.bits & 0x801f) == 0x2) + if((insn.bits & 0x801f) == 0x12) { - #include "insns/c_move.h" + #include "insns/c_lw0.h" break; } - if((insn.bits & 0x801f) == 0x8002) + if((insn.bits & 0x801f) == 0x8012) { - #include "insns/c_j.h" + #include "insns/c_ld0.h" break; } throw trap_illegal_instruction; } case 0x6: { - if((insn.bits & 0x801f) == 0x2) + if((insn.bits & 0x801f) == 0x12) { - #include "insns/c_move.h" + #include "insns/c_lw0.h" break; } - if((insn.bits & 0x801f) == 0x8002) + if((insn.bits & 0x801f) == 0x8012) { - #include "insns/c_j.h" + #include "insns/c_ld0.h" break; } throw trap_illegal_instruction; } case 0x7: { - if((insn.bits & 0x801f) == 0x2) + if((insn.bits & 0x801f) == 0x12) { - #include "insns/c_move.h" + #include "insns/c_lw0.h" break; } - if((insn.bits & 0x801f) == 0x8002) + if((insn.bits & 0x801f) == 0x8012) { - #include "insns/c_j.h" + #include "insns/c_ld0.h" break; } throw trap_illegal_instruction; @@ -905,64 +792,61 @@ switch((insn.bits >> 0x0) & 0x7f) } break; } - case 0x23: + case 0x13: { switch((insn.bits >> 0x7) & 0x7) { case 0x0: { - #include "insns/sb.h" + #include "insns/addi.h" break; } case 0x1: { - #include "insns/sh.h" - break; + if((insn.bits & 0x3f03ff) == 0x93) + { + #include "insns/slli.h" + break; + } + throw trap_illegal_instruction; } case 0x2: { - #include "insns/sw.h" + #include "insns/slti.h" break; } case 0x3: { - #include "insns/sd.h" + #include "insns/sltiu.h" break; } - default: + case 0x4: { + #include "insns/xori.h" + break; + } + case 0x5: + { + if((insn.bits & 0x3f03ff) == 0x293) + { + #include "insns/srli.h" + break; + } + if((insn.bits & 0x3f03ff) == 0x10293) + { + #include "insns/srai.h" + break; + } throw trap_illegal_instruction; } - } - break; - } - case 0x24: - { - #include "insns/c_ldsp.h" - break; - } - case 0x25: - { - #include "insns/c_lwsp.h" - break; - } - case 0x26: - { - #include "insns/c_sdsp.h" - break; - } - case 0x27: - { - switch((insn.bits >> 0x7) & 0x7) - { - case 0x2: + case 0x6: { - #include "insns/fsw.h" + #include "insns/ori.h" break; } - case 0x3: + case 0x7: { - #include "insns/fsd.h" + #include "insns/andi.h" break; } default: @@ -972,393 +856,338 @@ switch((insn.bits >> 0x0) & 0x7f) } break; } - case 0x28: + case 0x14: { - #include "insns/c_swsp.h" + #include "insns/c_flw.h" break; } - case 0x29: + case 0x15: { - #include "insns/c_ld.h" + #include "insns/c_fld.h" break; } - case 0x2a: + case 0x16: { - #include "insns/c_lw.h" + #include "insns/c_fsw.h" break; } - case 0x2b: + case 0x18: + { + #include "insns/c_fsd.h" + break; + } + case 0x19: { switch((insn.bits >> 0x7) & 0x7) { - case 0x2: + case 0x0: { - if((insn.bits & 0x1ffff) == 0x192b) - { - #include "insns/amominu_w.h" - break; - } - if((insn.bits & 0x1ffff) == 0x92b) + if((insn.bits & 0x1c1f) == 0x19) { - #include "insns/amoand_w.h" + #include "insns/c_slli.h" break; } - if((insn.bits & 0x1ffff) == 0x1d2b) + if((insn.bits & 0x1c1f) == 0x819) { - #include "insns/amomaxu_w.h" + #include "insns/c_srli.h" break; } - if((insn.bits & 0x1ffff) == 0x152b) + if((insn.bits & 0x1c1f) == 0x1419) { - #include "insns/amomax_w.h" + #include "insns/c_srai32.h" break; } - if((insn.bits & 0x1ffff) == 0x12b) + if((insn.bits & 0x1c1f) == 0xc19) { - #include "insns/amoadd_w.h" + #include "insns/c_srli32.h" break; } - if((insn.bits & 0x1ffff) == 0xd2b) + if((insn.bits & 0x1c1f) == 0x1819) { - #include "insns/amoor_w.h" + #include "insns/c_slliw.h" break; } - if((insn.bits & 0x1ffff) == 0x112b) + if((insn.bits & 0x1c1f) == 0x1019) { - #include "insns/amomin_w.h" + #include "insns/c_srai.h" break; } - if((insn.bits & 0x1ffff) == 0x52b) + if((insn.bits & 0x1c1f) == 0x419) { - #include "insns/amoswap_w.h" + #include "insns/c_slli32.h" break; } throw trap_illegal_instruction; } - case 0x3: + case 0x1: { - if((insn.bits & 0x1ffff) == 0x19ab) + if((insn.bits & 0x1c1f) == 0x19) { - #include "insns/amominu_d.h" + #include "insns/c_slli.h" break; } - if((insn.bits & 0x1ffff) == 0x9ab) + if((insn.bits & 0x1c1f) == 0x819) { - #include "insns/amoand_d.h" + #include "insns/c_srli.h" break; } - if((insn.bits & 0x1ffff) == 0x1dab) + if((insn.bits & 0x1c1f) == 0x1419) { - #include "insns/amomaxu_d.h" + #include "insns/c_srai32.h" break; } - if((insn.bits & 0x1ffff) == 0x1ab) + if((insn.bits & 0x1c1f) == 0xc19) { - #include "insns/amoadd_d.h" + #include "insns/c_srli32.h" break; } - if((insn.bits & 0x1ffff) == 0x15ab) + if((insn.bits & 0x1c1f) == 0x1819) { - #include "insns/amomax_d.h" + #include "insns/c_slliw.h" break; } - if((insn.bits & 0x1ffff) == 0xdab) - { - #include "insns/amoor_d.h" - break; - } - if((insn.bits & 0x1ffff) == 0x5ab) + if((insn.bits & 0x1c1f) == 0x1019) { - #include "insns/amoswap_d.h" + #include "insns/c_srai.h" break; } - if((insn.bits & 0x1ffff) == 0x11ab) + if((insn.bits & 0x1c1f) == 0x419) { - #include "insns/amomin_d.h" + #include "insns/c_slli32.h" break; } throw trap_illegal_instruction; } - default: - { - throw trap_illegal_instruction; - } - } - break; - } - case 0x2c: - { - #include "insns/c_sd.h" - break; - } - case 0x2d: - { - #include "insns/c_sw.h" - break; - } - case 0x2f: - { - switch((insn.bits >> 0x7) & 0x7) - { - case 0x1: - { - #include "insns/fence_i.h" - break; - } case 0x2: { - #include "insns/fence.h" - break; - } - case 0x4: - { - #include "insns/fence_l_v.h" - break; - } - case 0x5: - { - #include "insns/fence_g_v.h" - break; - } - case 0x6: - { - #include "insns/fence_l_cv.h" - break; - } - case 0x7: - { - #include "insns/fence_g_cv.h" - break; - } - default: - { - throw trap_illegal_instruction; - } - } - break; - } - case 0x30: - { - #include "insns/c_beq.h" - break; - } - case 0x31: - { - #include "insns/c_bne.h" - break; - } - case 0x33: - { - switch((insn.bits >> 0x7) & 0x7) - { - case 0x0: - { - if((insn.bits & 0x1ffff) == 0x33) + if((insn.bits & 0x1c1f) == 0x19) { - #include "insns/add.h" + #include "insns/c_slli.h" break; } - if((insn.bits & 0x1ffff) == 0x433) + if((insn.bits & 0x1c1f) == 0x819) { - #include "insns/mul.h" + #include "insns/c_srli.h" break; } - if((insn.bits & 0x1ffff) == 0x10033) + if((insn.bits & 0x1c1f) == 0x1419) { - #include "insns/sub.h" + #include "insns/c_srai32.h" break; } - throw trap_illegal_instruction; - } - case 0x1: - { - if((insn.bits & 0x1ffff) == 0xb3) + if((insn.bits & 0x1c1f) == 0xc19) { - #include "insns/sll.h" + #include "insns/c_srli32.h" break; } - if((insn.bits & 0x1ffff) == 0x4b3) + if((insn.bits & 0x1c1f) == 0x1819) { - #include "insns/mulh.h" + #include "insns/c_slliw.h" break; } - throw trap_illegal_instruction; - } - case 0x2: - { - if((insn.bits & 0x1ffff) == 0x533) + if((insn.bits & 0x1c1f) == 0x1019) { - #include "insns/mulhsu.h" + #include "insns/c_srai.h" break; } - if((insn.bits & 0x1ffff) == 0x133) + if((insn.bits & 0x1c1f) == 0x419) { - #include "insns/slt.h" + #include "insns/c_slli32.h" break; } throw trap_illegal_instruction; } case 0x3: { - if((insn.bits & 0x1ffff) == 0x1b3) + if((insn.bits & 0x1c1f) == 0x19) { - #include "insns/sltu.h" + #include "insns/c_slli.h" break; } - if((insn.bits & 0x1ffff) == 0x5b3) + if((insn.bits & 0x1c1f) == 0x819) { - #include "insns/mulhu.h" + #include "insns/c_srli.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1419) + { + #include "insns/c_srai32.h" + break; + } + if((insn.bits & 0x1c1f) == 0xc19) + { + #include "insns/c_srli32.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1819) + { + #include "insns/c_slliw.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1019) + { + #include "insns/c_srai.h" + break; + } + if((insn.bits & 0x1c1f) == 0x419) + { + #include "insns/c_slli32.h" break; } throw trap_illegal_instruction; } case 0x4: { - if((insn.bits & 0x1ffff) == 0x633) + if((insn.bits & 0x1c1f) == 0x19) { - #include "insns/div.h" + #include "insns/c_slli.h" break; } - if((insn.bits & 0x1ffff) == 0x233) + if((insn.bits & 0x1c1f) == 0x819) { - #include "insns/xor.h" + #include "insns/c_srli.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1419) + { + #include "insns/c_srai32.h" + break; + } + if((insn.bits & 0x1c1f) == 0xc19) + { + #include "insns/c_srli32.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1819) + { + #include "insns/c_slliw.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1019) + { + #include "insns/c_srai.h" + break; + } + if((insn.bits & 0x1c1f) == 0x419) + { + #include "insns/c_slli32.h" break; } throw trap_illegal_instruction; } case 0x5: { - if((insn.bits & 0x1ffff) == 0x102b3) + if((insn.bits & 0x1c1f) == 0x19) { - #include "insns/sra.h" + #include "insns/c_slli.h" break; } - if((insn.bits & 0x1ffff) == 0x2b3) + if((insn.bits & 0x1c1f) == 0x819) { - #include "insns/srl.h" + #include "insns/c_srli.h" break; } - if((insn.bits & 0x1ffff) == 0x6b3) + if((insn.bits & 0x1c1f) == 0x1419) { - #include "insns/divu.h" + #include "insns/c_srai32.h" + break; + } + if((insn.bits & 0x1c1f) == 0xc19) + { + #include "insns/c_srli32.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1819) + { + #include "insns/c_slliw.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1019) + { + #include "insns/c_srai.h" + break; + } + if((insn.bits & 0x1c1f) == 0x419) + { + #include "insns/c_slli32.h" break; } throw trap_illegal_instruction; } case 0x6: { - if((insn.bits & 0x1ffff) == 0x733) + if((insn.bits & 0x1c1f) == 0x19) { - #include "insns/rem.h" + #include "insns/c_slli.h" break; } - if((insn.bits & 0x1ffff) == 0x333) + if((insn.bits & 0x1c1f) == 0x819) { - #include "insns/or.h" + #include "insns/c_srli.h" break; } - throw trap_illegal_instruction; - } - case 0x7: - { - if((insn.bits & 0x1ffff) == 0x7b3) + if((insn.bits & 0x1c1f) == 0x1419) { - #include "insns/remu.h" + #include "insns/c_srai32.h" break; } - if((insn.bits & 0x1ffff) == 0x3b3) + if((insn.bits & 0x1c1f) == 0xc19) { - #include "insns/and.h" + #include "insns/c_srli32.h" break; } - throw trap_illegal_instruction; - } - default: - { - throw trap_illegal_instruction; - } - } - break; - } - case 0x37: - { - #include "insns/lui.h" - break; - } - case 0x3b: - { - switch((insn.bits >> 0x7) & 0x7) - { - case 0x0: - { - if((insn.bits & 0x1ffff) == 0x43b) + if((insn.bits & 0x1c1f) == 0x1819) { - #include "insns/mulw.h" + #include "insns/c_slliw.h" break; } - if((insn.bits & 0x1ffff) == 0x3b) + if((insn.bits & 0x1c1f) == 0x1019) { - #include "insns/addw.h" + #include "insns/c_srai.h" break; } - if((insn.bits & 0x1ffff) == 0x1003b) + if((insn.bits & 0x1c1f) == 0x419) { - #include "insns/subw.h" + #include "insns/c_slli32.h" break; } throw trap_illegal_instruction; } - case 0x1: + case 0x7: { - if((insn.bits & 0x1ffff) == 0xbb) + if((insn.bits & 0x1c1f) == 0x19) { - #include "insns/sllw.h" + #include "insns/c_slli.h" break; } - throw trap_illegal_instruction; - } - case 0x4: - { - if((insn.bits & 0x1ffff) == 0x63b) + if((insn.bits & 0x1c1f) == 0x819) { - #include "insns/divw.h" + #include "insns/c_srli.h" break; } - throw trap_illegal_instruction; - } - case 0x5: - { - if((insn.bits & 0x1ffff) == 0x6bb) + if((insn.bits & 0x1c1f) == 0x1419) { - #include "insns/divuw.h" + #include "insns/c_srai32.h" break; } - if((insn.bits & 0x1ffff) == 0x2bb) + if((insn.bits & 0x1c1f) == 0xc19) { - #include "insns/srlw.h" + #include "insns/c_srli32.h" break; } - if((insn.bits & 0x1ffff) == 0x102bb) + if((insn.bits & 0x1c1f) == 0x1819) { - #include "insns/sraw.h" + #include "insns/c_slliw.h" break; } - throw trap_illegal_instruction; - } - case 0x6: - { - if((insn.bits & 0x1ffff) == 0x73b) + if((insn.bits & 0x1c1f) == 0x1019) { - #include "insns/remw.h" + #include "insns/c_srai.h" break; } - throw trap_illegal_instruction; - } - case 0x7: - { - if((insn.bits & 0x1ffff) == 0x7bb) + if((insn.bits & 0x1c1f) == 0x419) { - #include "insns/remuw.h" + #include "insns/c_slli32.h" break; } throw trap_illegal_instruction; @@ -1370,128 +1199,118 @@ switch((insn.bits >> 0x0) & 0x7f) } break; } - case 0x40: - { - #include "insns/c_addi.h" - break; - } - case 0x41: - { - #include "insns/c_li.h" - break; - } - case 0x42: + case 0x1a: { switch((insn.bits >> 0x7) & 0x7) { case 0x0: { - if((insn.bits & 0x801f) == 0x2) + if((insn.bits & 0x801f) == 0x1a) { - #include "insns/c_move.h" + #include "insns/c_add.h" break; } - if((insn.bits & 0x801f) == 0x8002) + if((insn.bits & 0x801f) == 0x801a) { - #include "insns/c_j.h" + #include "insns/c_sub.h" break; } throw trap_illegal_instruction; } case 0x1: { - if((insn.bits & 0x801f) == 0x2) + if((insn.bits & 0x801f) == 0x1a) { - #include "insns/c_move.h" + #include "insns/c_add.h" break; } - if((insn.bits & 0x801f) == 0x8002) + if((insn.bits & 0x801f) == 0x801a) { - #include "insns/c_j.h" + #include "insns/c_sub.h" break; } throw trap_illegal_instruction; } case 0x2: { - if((insn.bits & 0x801f) == 0x2) + if((insn.bits & 0x801f) == 0x1a) { - #include "insns/c_move.h" + #include "insns/c_add.h" break; } - if((insn.bits & 0x801f) == 0x8002) + if((insn.bits & 0x801f) == 0x801a) { - #include "insns/c_j.h" + #include "insns/c_sub.h" break; } throw trap_illegal_instruction; } case 0x3: { - if((insn.bits & 0x801f) == 0x2) + if((insn.bits & 0x801f) == 0x1a) { - #include "insns/c_move.h" + #include "insns/c_add.h" break; } - if((insn.bits & 0x801f) == 0x8002) + if((insn.bits & 0x801f) == 0x801a) { - #include "insns/c_j.h" + #include "insns/c_sub.h" break; } throw trap_illegal_instruction; } case 0x4: { - if((insn.bits & 0x801f) == 0x2) + if((insn.bits & 0x801f) == 0x1a) { - #include "insns/c_move.h" + #include "insns/c_add.h" break; } - if((insn.bits & 0x801f) == 0x8002) + if((insn.bits & 0x801f) == 0x801a) { - #include "insns/c_j.h" + #include "insns/c_sub.h" break; } throw trap_illegal_instruction; } case 0x5: { - if((insn.bits & 0x801f) == 0x2) + if((insn.bits & 0x801f) == 0x1a) { - #include "insns/c_move.h" + #include "insns/c_add.h" break; } - if((insn.bits & 0x801f) == 0x8002) + if((insn.bits & 0x801f) == 0x801a) { - #include "insns/c_j.h" + #include "insns/c_sub.h" break; } throw trap_illegal_instruction; } case 0x6: { - if((insn.bits & 0x801f) == 0x2) + if((insn.bits & 0x801f) == 0x1a) { - #include "insns/c_move.h" + #include "insns/c_add.h" break; } - if((insn.bits & 0x801f) == 0x8002) + if((insn.bits & 0x801f) == 0x801a) { - #include "insns/c_j.h" + #include "insns/c_sub.h" break; } throw trap_illegal_instruction; } case 0x7: { - if((insn.bits & 0x801f) == 0x2) + if((insn.bits & 0x801f) == 0x1a) { - #include "insns/c_move.h" + #include "insns/c_add.h" break; } - if((insn.bits & 0x801f) == 0x8002) + if((insn.bits & 0x801f) == 0x801a) { - #include "insns/c_j.h" + #include "insns/c_sub.h" break; } throw trap_illegal_instruction; @@ -1503,29 +1322,37 @@ switch((insn.bits >> 0x0) & 0x7f) } break; } - case 0x43: + case 0x1b: { switch((insn.bits >> 0x7) & 0x7) { case 0x0: { - #include "insns/fmadd_s.h" + #include "insns/addiw.h" break; } case 0x1: { - #include "insns/fmadd_d.h" - break; - } - case 0x4: - { - #include "insns/fmadd_s.h" - break; + if((insn.bits & 0x3f83ff) == 0x9b) + { + #include "insns/slliw.h" + break; + } + throw trap_illegal_instruction; } case 0x5: { - #include "insns/fmadd_d.h" - break; + if((insn.bits & 0x3f83ff) == 0x29b) + { + #include "insns/srliw.h" + break; + } + if((insn.bits & 0x3f83ff) == 0x1029b) + { + #include "insns/sraiw.h" + break; + } + throw trap_illegal_instruction; } default: { @@ -1534,130 +1361,48 @@ switch((insn.bits >> 0x0) & 0x7f) } break; } - case 0x44: - { - #include "insns/c_ldsp.h" - break; - } - case 0x45: - { - #include "insns/c_lwsp.h" - break; - } - case 0x46: - { - #include "insns/c_sdsp.h" - break; - } - case 0x47: + case 0x1c: { switch((insn.bits >> 0x7) & 0x7) { case 0x0: { - #include "insns/fmsub_s.h" + #include "insns/c_add3.h" break; } case 0x1: { - #include "insns/fmsub_d.h" - break; - } - case 0x4: - { - #include "insns/fmsub_s.h" - break; - } - case 0x5: - { - #include "insns/fmsub_d.h" + #include "insns/c_add3.h" break; } - default: - { - throw trap_illegal_instruction; - } - } - break; - } - case 0x48: - { - #include "insns/c_swsp.h" - break; - } - case 0x49: - { - #include "insns/c_ld.h" - break; - } - case 0x4a: - { - #include "insns/c_lw.h" - break; - } - case 0x4b: - { - switch((insn.bits >> 0x7) & 0x7) - { - case 0x0: + case 0x2: { - #include "insns/fnmsub_s.h" + #include "insns/c_sub3.h" break; } - case 0x1: + case 0x3: { - #include "insns/fnmsub_d.h" + #include "insns/c_sub3.h" break; } case 0x4: { - #include "insns/fnmsub_s.h" + #include "insns/c_or3.h" break; } case 0x5: { - #include "insns/fnmsub_d.h" - break; - } - default: - { - throw trap_illegal_instruction; - } - } - break; - } - case 0x4c: - { - #include "insns/c_sd.h" - break; - } - case 0x4d: - { - #include "insns/c_sw.h" - break; - } - case 0x4f: - { - switch((insn.bits >> 0x7) & 0x7) - { - case 0x0: - { - #include "insns/fnmadd_s.h" - break; - } - case 0x1: - { - #include "insns/fnmadd_d.h" + #include "insns/c_or3.h" break; } - case 0x4: + case 0x6: { - #include "insns/fnmadd_s.h" + #include "insns/c_and3.h" break; } - case 0x5: + case 0x7: { - #include "insns/fnmadd_d.h" + #include "insns/c_and3.h" break; } default: @@ -1667,540 +1412,3398 @@ switch((insn.bits >> 0x0) & 0x7f) } break; } - case 0x50: + case 0x20: { - #include "insns/c_beq.h" + #include "insns/c_li.h" break; } - case 0x51: + case 0x21: { - #include "insns/c_bne.h" + #include "insns/c_addi.h" break; } - case 0x53: + case 0x22: { switch((insn.bits >> 0x7) & 0x7) { case 0x0: { - if((insn.bits & 0x3ff1ff) == 0x9053) - { - #include "insns/fcvt_lu_s.h" - break; - } - if((insn.bits & 0x1ffff) == 0x18053) + if((insn.bits & 0x801f) == 0x2) { - #include "insns/fmin_s.h" + #include "insns/c_move.h" break; } - if((insn.bits & 0x3ff1ff) == 0x11053) + if((insn.bits & 0x801f) == 0x8002) { - #include "insns/fcvt_s_d.h" + #include "insns/c_j.h" break; } - if((insn.bits & 0x3ff1ff) == 0xe053) + throw trap_illegal_instruction; + } + case 0x1: + { + if((insn.bits & 0x801f) == 0x2) { - #include "insns/fcvt_s_w.h" + #include "insns/c_move.h" break; } - if((insn.bits & 0x7c1ffff) == 0x1c053) + if((insn.bits & 0x801f) == 0x8002) { - #include "insns/mftx_s.h" + #include "insns/c_j.h" break; } - if((insn.bits & 0x3ff1ff) == 0x8053) + throw trap_illegal_instruction; + } + case 0x2: + { + if((insn.bits & 0x801f) == 0x2) { - #include "insns/fcvt_l_s.h" + #include "insns/c_move.h" break; } - if((insn.bits & 0x1ffff) == 0x17053) + if((insn.bits & 0x801f) == 0x8002) { - #include "insns/fle_s.h" + #include "insns/c_j.h" break; } - if((insn.bits & 0x7ffffff) == 0x1d053) + throw trap_illegal_instruction; + } + case 0x3: + { + if((insn.bits & 0x801f) == 0x2) { - #include "insns/mffsr.h" + #include "insns/c_move.h" break; } - if((insn.bits & 0x1f1ff) == 0x3053) + if((insn.bits & 0x801f) == 0x8002) { - #include "insns/fdiv_s.h" + #include "insns/c_j.h" break; } - if((insn.bits & 0x3fffff) == 0x1f053) + throw trap_illegal_instruction; + } + case 0x4: + { + if((insn.bits & 0x801f) == 0x2) { - #include "insns/mtfsr.h" + #include "insns/c_move.h" break; } - if((insn.bits & 0x3ff1ff) == 0xd053) + if((insn.bits & 0x801f) == 0x8002) { - #include "insns/fcvt_s_lu.h" + #include "insns/c_j.h" break; } - if((insn.bits & 0x1f1ff) == 0x2053) + throw trap_illegal_instruction; + } + case 0x5: + { + if((insn.bits & 0x801f) == 0x2) { - #include "insns/fmul_s.h" + #include "insns/c_move.h" break; } - if((insn.bits & 0x1ffff) == 0x16053) + if((insn.bits & 0x801f) == 0x8002) { - #include "insns/flt_s.h" + #include "insns/c_j.h" break; } - if((insn.bits & 0x1ffff) == 0x15053) + throw trap_illegal_instruction; + } + case 0x6: + { + if((insn.bits & 0x801f) == 0x2) { - #include "insns/feq_s.h" + #include "insns/c_move.h" break; } - if((insn.bits & 0x1ffff) == 0x7053) + if((insn.bits & 0x801f) == 0x8002) { - #include "insns/fsgnjx_s.h" + #include "insns/c_j.h" break; } - if((insn.bits & 0x1ffff) == 0x19053) + throw trap_illegal_instruction; + } + case 0x7: + { + if((insn.bits & 0x801f) == 0x2) { - #include "insns/fmax_s.h" + #include "insns/c_move.h" break; } - if((insn.bits & 0x3ff1ff) == 0xb053) + if((insn.bits & 0x801f) == 0x8002) { - #include "insns/fcvt_wu_s.h" + #include "insns/c_j.h" break; } - if((insn.bits & 0x3ff1ff) == 0xa053) - { - #include "insns/fcvt_w_s.h" - break; + throw trap_illegal_instruction; + } + default: + { + throw trap_illegal_instruction; + } + } + break; + } + case 0x23: + { + switch((insn.bits >> 0x7) & 0x7) + { + case 0x0: + { + #include "insns/sb.h" + break; + } + case 0x1: + { + #include "insns/sh.h" + break; + } + case 0x2: + { + #include "insns/sw.h" + break; + } + case 0x3: + { + #include "insns/sd.h" + break; + } + default: + { + throw trap_illegal_instruction; + } + } + break; + } + case 0x24: + { + #include "insns/c_ldsp.h" + break; + } + case 0x25: + { + #include "insns/c_lwsp.h" + break; + } + case 0x26: + { + #include "insns/c_sdsp.h" + break; + } + case 0x27: + { + switch((insn.bits >> 0x7) & 0x7) + { + case 0x2: + { + #include "insns/fsw.h" + break; + } + case 0x3: + { + #include "insns/fsd.h" + break; + } + default: + { + throw trap_illegal_instruction; + } + } + break; + } + case 0x28: + { + #include "insns/c_swsp.h" + break; + } + case 0x29: + { + #include "insns/c_ld.h" + break; + } + case 0x2a: + { + #include "insns/c_lw.h" + break; + } + case 0x2b: + { + switch((insn.bits >> 0x7) & 0x7) + { + case 0x2: + { + if((insn.bits & 0x1ffff) == 0x192b) + { + #include "insns/amominu_w.h" + break; + } + if((insn.bits & 0x1ffff) == 0x92b) + { + #include "insns/amoand_w.h" + break; + } + if((insn.bits & 0x1ffff) == 0x1d2b) + { + #include "insns/amomaxu_w.h" + break; + } + if((insn.bits & 0x1ffff) == 0x152b) + { + #include "insns/amomax_w.h" + break; + } + if((insn.bits & 0x1ffff) == 0x12b) + { + #include "insns/amoadd_w.h" + break; + } + if((insn.bits & 0x1ffff) == 0xd2b) + { + #include "insns/amoor_w.h" + break; + } + if((insn.bits & 0x1ffff) == 0x112b) + { + #include "insns/amomin_w.h" + break; + } + if((insn.bits & 0x1ffff) == 0x52b) + { + #include "insns/amoswap_w.h" + break; + } + throw trap_illegal_instruction; + } + case 0x3: + { + if((insn.bits & 0x1ffff) == 0x19ab) + { + #include "insns/amominu_d.h" + break; + } + if((insn.bits & 0x1ffff) == 0x9ab) + { + #include "insns/amoand_d.h" + break; + } + if((insn.bits & 0x1ffff) == 0x1dab) + { + #include "insns/amomaxu_d.h" + break; + } + if((insn.bits & 0x1ffff) == 0x1ab) + { + #include "insns/amoadd_d.h" + break; + } + if((insn.bits & 0x1ffff) == 0x15ab) + { + #include "insns/amomax_d.h" + break; + } + if((insn.bits & 0x1ffff) == 0xdab) + { + #include "insns/amoor_d.h" + break; + } + if((insn.bits & 0x1ffff) == 0x5ab) + { + #include "insns/amoswap_d.h" + break; + } + if((insn.bits & 0x1ffff) == 0x11ab) + { + #include "insns/amomin_d.h" + break; + } + throw trap_illegal_instruction; + } + default: + { + throw trap_illegal_instruction; + } + } + break; + } + case 0x2c: + { + #include "insns/c_sd.h" + break; + } + case 0x2d: + { + #include "insns/c_sw.h" + break; + } + case 0x2f: + { + switch((insn.bits >> 0x7) & 0x7) + { + case 0x1: + { + #include "insns/fence_i.h" + break; + } + case 0x2: + { + #include "insns/fence.h" + break; + } + case 0x4: + { + #include "insns/fence_l_v.h" + break; + } + case 0x5: + { + #include "insns/fence_g_v.h" + break; + } + case 0x6: + { + #include "insns/fence_l_cv.h" + break; + } + case 0x7: + { + #include "insns/fence_g_cv.h" + break; + } + default: + { + throw trap_illegal_instruction; + } + } + break; + } + case 0x30: + { + #include "insns/c_beq.h" + break; + } + case 0x31: + { + #include "insns/c_bne.h" + break; + } + case 0x32: + { + switch((insn.bits >> 0x7) & 0x7) + { + case 0x0: + { + if((insn.bits & 0x801f) == 0x12) + { + #include "insns/c_lw0.h" + break; + } + if((insn.bits & 0x801f) == 0x8012) + { + #include "insns/c_ld0.h" + break; + } + throw trap_illegal_instruction; + } + case 0x1: + { + if((insn.bits & 0x801f) == 0x12) + { + #include "insns/c_lw0.h" + break; + } + if((insn.bits & 0x801f) == 0x8012) + { + #include "insns/c_ld0.h" + break; + } + throw trap_illegal_instruction; + } + case 0x2: + { + if((insn.bits & 0x801f) == 0x12) + { + #include "insns/c_lw0.h" + break; + } + if((insn.bits & 0x801f) == 0x8012) + { + #include "insns/c_ld0.h" + break; + } + throw trap_illegal_instruction; + } + case 0x3: + { + if((insn.bits & 0x801f) == 0x12) + { + #include "insns/c_lw0.h" + break; + } + if((insn.bits & 0x801f) == 0x8012) + { + #include "insns/c_ld0.h" + break; + } + throw trap_illegal_instruction; + } + case 0x4: + { + if((insn.bits & 0x801f) == 0x12) + { + #include "insns/c_lw0.h" + break; + } + if((insn.bits & 0x801f) == 0x8012) + { + #include "insns/c_ld0.h" + break; + } + throw trap_illegal_instruction; + } + case 0x5: + { + if((insn.bits & 0x801f) == 0x12) + { + #include "insns/c_lw0.h" + break; + } + if((insn.bits & 0x801f) == 0x8012) + { + #include "insns/c_ld0.h" + break; + } + throw trap_illegal_instruction; + } + case 0x6: + { + if((insn.bits & 0x801f) == 0x12) + { + #include "insns/c_lw0.h" + break; + } + if((insn.bits & 0x801f) == 0x8012) + { + #include "insns/c_ld0.h" + break; + } + throw trap_illegal_instruction; + } + case 0x7: + { + if((insn.bits & 0x801f) == 0x12) + { + #include "insns/c_lw0.h" + break; + } + if((insn.bits & 0x801f) == 0x8012) + { + #include "insns/c_ld0.h" + break; + } + throw trap_illegal_instruction; + } + default: + { + throw trap_illegal_instruction; + } + } + break; + } + case 0x33: + { + switch((insn.bits >> 0x7) & 0x7) + { + case 0x0: + { + if((insn.bits & 0x1ffff) == 0x33) + { + #include "insns/add.h" + break; + } + if((insn.bits & 0x1ffff) == 0x433) + { + #include "insns/mul.h" + break; + } + if((insn.bits & 0x1ffff) == 0x10033) + { + #include "insns/sub.h" + break; + } + throw trap_illegal_instruction; + } + case 0x1: + { + if((insn.bits & 0x1ffff) == 0xb3) + { + #include "insns/sll.h" + break; + } + if((insn.bits & 0x1ffff) == 0x4b3) + { + #include "insns/mulh.h" + break; + } + throw trap_illegal_instruction; + } + case 0x2: + { + if((insn.bits & 0x1ffff) == 0x533) + { + #include "insns/mulhsu.h" + break; + } + if((insn.bits & 0x1ffff) == 0x133) + { + #include "insns/slt.h" + break; + } + throw trap_illegal_instruction; + } + case 0x3: + { + if((insn.bits & 0x1ffff) == 0x1b3) + { + #include "insns/sltu.h" + break; + } + if((insn.bits & 0x1ffff) == 0x5b3) + { + #include "insns/mulhu.h" + break; + } + throw trap_illegal_instruction; + } + case 0x4: + { + if((insn.bits & 0x1ffff) == 0x633) + { + #include "insns/div.h" + break; + } + if((insn.bits & 0x1ffff) == 0x233) + { + #include "insns/xor.h" + break; + } + throw trap_illegal_instruction; + } + case 0x5: + { + if((insn.bits & 0x1ffff) == 0x102b3) + { + #include "insns/sra.h" + break; + } + if((insn.bits & 0x1ffff) == 0x2b3) + { + #include "insns/srl.h" + break; + } + if((insn.bits & 0x1ffff) == 0x6b3) + { + #include "insns/divu.h" + break; + } + throw trap_illegal_instruction; + } + case 0x6: + { + if((insn.bits & 0x1ffff) == 0x733) + { + #include "insns/rem.h" + break; + } + if((insn.bits & 0x1ffff) == 0x333) + { + #include "insns/or.h" + break; + } + throw trap_illegal_instruction; + } + case 0x7: + { + if((insn.bits & 0x1ffff) == 0x7b3) + { + #include "insns/remu.h" + break; + } + if((insn.bits & 0x1ffff) == 0x3b3) + { + #include "insns/and.h" + break; + } + throw trap_illegal_instruction; + } + default: + { + throw trap_illegal_instruction; + } + } + break; + } + case 0x34: + { + #include "insns/c_flw.h" + break; + } + case 0x35: + { + #include "insns/c_fld.h" + break; + } + case 0x36: + { + #include "insns/c_fsw.h" + break; + } + case 0x37: + { + #include "insns/lui.h" + break; + } + case 0x38: + { + #include "insns/c_fsd.h" + break; + } + case 0x39: + { + switch((insn.bits >> 0x7) & 0x7) + { + case 0x0: + { + if((insn.bits & 0x1c1f) == 0x19) + { + #include "insns/c_slli.h" + break; + } + if((insn.bits & 0x1c1f) == 0x819) + { + #include "insns/c_srli.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1419) + { + #include "insns/c_srai32.h" + break; + } + if((insn.bits & 0x1c1f) == 0xc19) + { + #include "insns/c_srli32.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1819) + { + #include "insns/c_slliw.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1019) + { + #include "insns/c_srai.h" + break; + } + if((insn.bits & 0x1c1f) == 0x419) + { + #include "insns/c_slli32.h" + break; + } + throw trap_illegal_instruction; + } + case 0x1: + { + if((insn.bits & 0x1c1f) == 0x19) + { + #include "insns/c_slli.h" + break; + } + if((insn.bits & 0x1c1f) == 0x819) + { + #include "insns/c_srli.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1419) + { + #include "insns/c_srai32.h" + break; + } + if((insn.bits & 0x1c1f) == 0xc19) + { + #include "insns/c_srli32.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1819) + { + #include "insns/c_slliw.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1019) + { + #include "insns/c_srai.h" + break; + } + if((insn.bits & 0x1c1f) == 0x419) + { + #include "insns/c_slli32.h" + break; + } + throw trap_illegal_instruction; + } + case 0x2: + { + if((insn.bits & 0x1c1f) == 0x19) + { + #include "insns/c_slli.h" + break; + } + if((insn.bits & 0x1c1f) == 0x819) + { + #include "insns/c_srli.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1419) + { + #include "insns/c_srai32.h" + break; + } + if((insn.bits & 0x1c1f) == 0xc19) + { + #include "insns/c_srli32.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1819) + { + #include "insns/c_slliw.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1019) + { + #include "insns/c_srai.h" + break; + } + if((insn.bits & 0x1c1f) == 0x419) + { + #include "insns/c_slli32.h" + break; + } + throw trap_illegal_instruction; + } + case 0x3: + { + if((insn.bits & 0x1c1f) == 0x19) + { + #include "insns/c_slli.h" + break; + } + if((insn.bits & 0x1c1f) == 0x819) + { + #include "insns/c_srli.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1419) + { + #include "insns/c_srai32.h" + break; + } + if((insn.bits & 0x1c1f) == 0xc19) + { + #include "insns/c_srli32.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1819) + { + #include "insns/c_slliw.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1019) + { + #include "insns/c_srai.h" + break; + } + if((insn.bits & 0x1c1f) == 0x419) + { + #include "insns/c_slli32.h" + break; + } + throw trap_illegal_instruction; + } + case 0x4: + { + if((insn.bits & 0x1c1f) == 0x19) + { + #include "insns/c_slli.h" + break; + } + if((insn.bits & 0x1c1f) == 0x819) + { + #include "insns/c_srli.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1419) + { + #include "insns/c_srai32.h" + break; + } + if((insn.bits & 0x1c1f) == 0xc19) + { + #include "insns/c_srli32.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1819) + { + #include "insns/c_slliw.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1019) + { + #include "insns/c_srai.h" + break; + } + if((insn.bits & 0x1c1f) == 0x419) + { + #include "insns/c_slli32.h" + break; + } + throw trap_illegal_instruction; + } + case 0x5: + { + if((insn.bits & 0x1c1f) == 0x19) + { + #include "insns/c_slli.h" + break; + } + if((insn.bits & 0x1c1f) == 0x819) + { + #include "insns/c_srli.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1419) + { + #include "insns/c_srai32.h" + break; + } + if((insn.bits & 0x1c1f) == 0xc19) + { + #include "insns/c_srli32.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1819) + { + #include "insns/c_slliw.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1019) + { + #include "insns/c_srai.h" + break; + } + if((insn.bits & 0x1c1f) == 0x419) + { + #include "insns/c_slli32.h" + break; + } + throw trap_illegal_instruction; + } + case 0x6: + { + if((insn.bits & 0x1c1f) == 0x19) + { + #include "insns/c_slli.h" + break; + } + if((insn.bits & 0x1c1f) == 0x819) + { + #include "insns/c_srli.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1419) + { + #include "insns/c_srai32.h" + break; + } + if((insn.bits & 0x1c1f) == 0xc19) + { + #include "insns/c_srli32.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1819) + { + #include "insns/c_slliw.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1019) + { + #include "insns/c_srai.h" + break; + } + if((insn.bits & 0x1c1f) == 0x419) + { + #include "insns/c_slli32.h" + break; + } + throw trap_illegal_instruction; + } + case 0x7: + { + if((insn.bits & 0x1c1f) == 0x19) + { + #include "insns/c_slli.h" + break; + } + if((insn.bits & 0x1c1f) == 0x819) + { + #include "insns/c_srli.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1419) + { + #include "insns/c_srai32.h" + break; + } + if((insn.bits & 0x1c1f) == 0xc19) + { + #include "insns/c_srli32.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1819) + { + #include "insns/c_slliw.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1019) + { + #include "insns/c_srai.h" + break; + } + if((insn.bits & 0x1c1f) == 0x419) + { + #include "insns/c_slli32.h" + break; + } + throw trap_illegal_instruction; + } + default: + { + throw trap_illegal_instruction; + } + } + break; + } + case 0x3a: + { + switch((insn.bits >> 0x7) & 0x7) + { + case 0x0: + { + if((insn.bits & 0x801f) == 0x1a) + { + #include "insns/c_add.h" + break; + } + if((insn.bits & 0x801f) == 0x801a) + { + #include "insns/c_sub.h" + break; + } + throw trap_illegal_instruction; + } + case 0x1: + { + if((insn.bits & 0x801f) == 0x1a) + { + #include "insns/c_add.h" + break; + } + if((insn.bits & 0x801f) == 0x801a) + { + #include "insns/c_sub.h" + break; + } + throw trap_illegal_instruction; + } + case 0x2: + { + if((insn.bits & 0x801f) == 0x1a) + { + #include "insns/c_add.h" + break; + } + if((insn.bits & 0x801f) == 0x801a) + { + #include "insns/c_sub.h" + break; + } + throw trap_illegal_instruction; + } + case 0x3: + { + if((insn.bits & 0x801f) == 0x1a) + { + #include "insns/c_add.h" + break; + } + if((insn.bits & 0x801f) == 0x801a) + { + #include "insns/c_sub.h" + break; + } + throw trap_illegal_instruction; + } + case 0x4: + { + if((insn.bits & 0x801f) == 0x1a) + { + #include "insns/c_add.h" + break; + } + if((insn.bits & 0x801f) == 0x801a) + { + #include "insns/c_sub.h" + break; + } + throw trap_illegal_instruction; + } + case 0x5: + { + if((insn.bits & 0x801f) == 0x1a) + { + #include "insns/c_add.h" + break; + } + if((insn.bits & 0x801f) == 0x801a) + { + #include "insns/c_sub.h" + break; + } + throw trap_illegal_instruction; + } + case 0x6: + { + if((insn.bits & 0x801f) == 0x1a) + { + #include "insns/c_add.h" + break; + } + if((insn.bits & 0x801f) == 0x801a) + { + #include "insns/c_sub.h" + break; + } + throw trap_illegal_instruction; + } + case 0x7: + { + if((insn.bits & 0x801f) == 0x1a) + { + #include "insns/c_add.h" + break; + } + if((insn.bits & 0x801f) == 0x801a) + { + #include "insns/c_sub.h" + break; + } + throw trap_illegal_instruction; + } + default: + { + throw trap_illegal_instruction; + } + } + break; + } + case 0x3b: + { + switch((insn.bits >> 0x7) & 0x7) + { + case 0x0: + { + if((insn.bits & 0x1ffff) == 0x43b) + { + #include "insns/mulw.h" + break; + } + if((insn.bits & 0x1ffff) == 0x3b) + { + #include "insns/addw.h" + break; + } + if((insn.bits & 0x1ffff) == 0x1003b) + { + #include "insns/subw.h" + break; + } + throw trap_illegal_instruction; + } + case 0x1: + { + if((insn.bits & 0x1ffff) == 0xbb) + { + #include "insns/sllw.h" + break; + } + throw trap_illegal_instruction; + } + case 0x4: + { + if((insn.bits & 0x1ffff) == 0x63b) + { + #include "insns/divw.h" + break; + } + throw trap_illegal_instruction; + } + case 0x5: + { + if((insn.bits & 0x1ffff) == 0x6bb) + { + #include "insns/divuw.h" + break; + } + if((insn.bits & 0x1ffff) == 0x2bb) + { + #include "insns/srlw.h" + break; + } + if((insn.bits & 0x1ffff) == 0x102bb) + { + #include "insns/sraw.h" + break; + } + throw trap_illegal_instruction; + } + case 0x6: + { + if((insn.bits & 0x1ffff) == 0x73b) + { + #include "insns/remw.h" + break; + } + throw trap_illegal_instruction; + } + case 0x7: + { + if((insn.bits & 0x1ffff) == 0x7bb) + { + #include "insns/remuw.h" + break; + } + throw trap_illegal_instruction; + } + default: + { + throw trap_illegal_instruction; + } + } + break; + } + case 0x3c: + { + switch((insn.bits >> 0x7) & 0x7) + { + case 0x0: + { + #include "insns/c_add3.h" + break; + } + case 0x1: + { + #include "insns/c_add3.h" + break; + } + case 0x2: + { + #include "insns/c_sub3.h" + break; + } + case 0x3: + { + #include "insns/c_sub3.h" + break; + } + case 0x4: + { + #include "insns/c_or3.h" + break; + } + case 0x5: + { + #include "insns/c_or3.h" + break; + } + case 0x6: + { + #include "insns/c_and3.h" + break; + } + case 0x7: + { + #include "insns/c_and3.h" + break; + } + default: + { + throw trap_illegal_instruction; + } + } + break; + } + case 0x40: + { + #include "insns/c_li.h" + break; + } + case 0x41: + { + #include "insns/c_addi.h" + break; + } + case 0x42: + { + switch((insn.bits >> 0x7) & 0x7) + { + case 0x0: + { + if((insn.bits & 0x801f) == 0x2) + { + #include "insns/c_move.h" + break; + } + if((insn.bits & 0x801f) == 0x8002) + { + #include "insns/c_j.h" + break; + } + throw trap_illegal_instruction; + } + case 0x1: + { + if((insn.bits & 0x801f) == 0x2) + { + #include "insns/c_move.h" + break; + } + if((insn.bits & 0x801f) == 0x8002) + { + #include "insns/c_j.h" + break; + } + throw trap_illegal_instruction; + } + case 0x2: + { + if((insn.bits & 0x801f) == 0x2) + { + #include "insns/c_move.h" + break; + } + if((insn.bits & 0x801f) == 0x8002) + { + #include "insns/c_j.h" + break; + } + throw trap_illegal_instruction; + } + case 0x3: + { + if((insn.bits & 0x801f) == 0x2) + { + #include "insns/c_move.h" + break; + } + if((insn.bits & 0x801f) == 0x8002) + { + #include "insns/c_j.h" + break; + } + throw trap_illegal_instruction; + } + case 0x4: + { + if((insn.bits & 0x801f) == 0x2) + { + #include "insns/c_move.h" + break; + } + if((insn.bits & 0x801f) == 0x8002) + { + #include "insns/c_j.h" + break; + } + throw trap_illegal_instruction; + } + case 0x5: + { + if((insn.bits & 0x801f) == 0x2) + { + #include "insns/c_move.h" + break; + } + if((insn.bits & 0x801f) == 0x8002) + { + #include "insns/c_j.h" + break; + } + throw trap_illegal_instruction; + } + case 0x6: + { + if((insn.bits & 0x801f) == 0x2) + { + #include "insns/c_move.h" + break; + } + if((insn.bits & 0x801f) == 0x8002) + { + #include "insns/c_j.h" + break; + } + throw trap_illegal_instruction; + } + case 0x7: + { + if((insn.bits & 0x801f) == 0x2) + { + #include "insns/c_move.h" + break; + } + if((insn.bits & 0x801f) == 0x8002) + { + #include "insns/c_j.h" + break; + } + throw trap_illegal_instruction; + } + default: + { + throw trap_illegal_instruction; + } + } + break; + } + case 0x43: + { + switch((insn.bits >> 0x7) & 0x7) + { + case 0x0: + { + #include "insns/fmadd_s.h" + break; + } + case 0x1: + { + #include "insns/fmadd_d.h" + break; + } + case 0x4: + { + #include "insns/fmadd_s.h" + break; + } + case 0x5: + { + #include "insns/fmadd_d.h" + break; + } + default: + { + throw trap_illegal_instruction; + } + } + break; + } + case 0x44: + { + #include "insns/c_ldsp.h" + break; + } + case 0x45: + { + #include "insns/c_lwsp.h" + break; + } + case 0x46: + { + #include "insns/c_sdsp.h" + break; + } + case 0x47: + { + switch((insn.bits >> 0x7) & 0x7) + { + case 0x0: + { + #include "insns/fmsub_s.h" + break; + } + case 0x1: + { + #include "insns/fmsub_d.h" + break; + } + case 0x4: + { + #include "insns/fmsub_s.h" + break; + } + case 0x5: + { + #include "insns/fmsub_d.h" + break; + } + default: + { + throw trap_illegal_instruction; + } + } + break; + } + case 0x48: + { + #include "insns/c_swsp.h" + break; + } + case 0x49: + { + #include "insns/c_ld.h" + break; + } + case 0x4a: + { + #include "insns/c_lw.h" + break; + } + case 0x4b: + { + switch((insn.bits >> 0x7) & 0x7) + { + case 0x0: + { + #include "insns/fnmsub_s.h" + break; + } + case 0x1: + { + #include "insns/fnmsub_d.h" + break; + } + case 0x4: + { + #include "insns/fnmsub_s.h" + break; + } + case 0x5: + { + #include "insns/fnmsub_d.h" + break; + } + default: + { + throw trap_illegal_instruction; + } + } + break; + } + case 0x4c: + { + #include "insns/c_sd.h" + break; + } + case 0x4d: + { + #include "insns/c_sw.h" + break; + } + case 0x4f: + { + switch((insn.bits >> 0x7) & 0x7) + { + case 0x0: + { + #include "insns/fnmadd_s.h" + break; + } + case 0x1: + { + #include "insns/fnmadd_d.h" + break; + } + case 0x4: + { + #include "insns/fnmadd_s.h" + break; + } + case 0x5: + { + #include "insns/fnmadd_d.h" + break; + } + default: + { + throw trap_illegal_instruction; + } + } + break; + } + case 0x50: + { + #include "insns/c_beq.h" + break; + } + case 0x51: + { + #include "insns/c_bne.h" + break; + } + case 0x52: + { + switch((insn.bits >> 0x7) & 0x7) + { + case 0x0: + { + if((insn.bits & 0x801f) == 0x12) + { + #include "insns/c_lw0.h" + break; + } + if((insn.bits & 0x801f) == 0x8012) + { + #include "insns/c_ld0.h" + break; + } + throw trap_illegal_instruction; + } + case 0x1: + { + if((insn.bits & 0x801f) == 0x12) + { + #include "insns/c_lw0.h" + break; + } + if((insn.bits & 0x801f) == 0x8012) + { + #include "insns/c_ld0.h" + break; + } + throw trap_illegal_instruction; + } + case 0x2: + { + if((insn.bits & 0x801f) == 0x12) + { + #include "insns/c_lw0.h" + break; + } + if((insn.bits & 0x801f) == 0x8012) + { + #include "insns/c_ld0.h" + break; + } + throw trap_illegal_instruction; + } + case 0x3: + { + if((insn.bits & 0x801f) == 0x12) + { + #include "insns/c_lw0.h" + break; + } + if((insn.bits & 0x801f) == 0x8012) + { + #include "insns/c_ld0.h" + break; + } + throw trap_illegal_instruction; + } + case 0x4: + { + if((insn.bits & 0x801f) == 0x12) + { + #include "insns/c_lw0.h" + break; + } + if((insn.bits & 0x801f) == 0x8012) + { + #include "insns/c_ld0.h" + break; + } + throw trap_illegal_instruction; + } + case 0x5: + { + if((insn.bits & 0x801f) == 0x12) + { + #include "insns/c_lw0.h" + break; + } + if((insn.bits & 0x801f) == 0x8012) + { + #include "insns/c_ld0.h" + break; + } + throw trap_illegal_instruction; + } + case 0x6: + { + if((insn.bits & 0x801f) == 0x12) + { + #include "insns/c_lw0.h" + break; + } + if((insn.bits & 0x801f) == 0x8012) + { + #include "insns/c_ld0.h" + break; + } + throw trap_illegal_instruction; + } + case 0x7: + { + if((insn.bits & 0x801f) == 0x12) + { + #include "insns/c_lw0.h" + break; + } + if((insn.bits & 0x801f) == 0x8012) + { + #include "insns/c_ld0.h" + break; + } + throw trap_illegal_instruction; + } + default: + { + throw trap_illegal_instruction; + } + } + break; + } + case 0x53: + { + switch((insn.bits >> 0x7) & 0x7) + { + case 0x0: + { + if((insn.bits & 0x3ff1ff) == 0x9053) + { + #include "insns/fcvt_lu_s.h" + break; + } + if((insn.bits & 0x1ffff) == 0x18053) + { + #include "insns/fmin_s.h" + break; + } + if((insn.bits & 0x3ff1ff) == 0x11053) + { + #include "insns/fcvt_s_d.h" + break; + } + if((insn.bits & 0x3ff1ff) == 0xe053) + { + #include "insns/fcvt_s_w.h" + break; + } + if((insn.bits & 0x7c1ffff) == 0x1c053) + { + #include "insns/mftx_s.h" + break; + } + if((insn.bits & 0x3ff1ff) == 0x8053) + { + #include "insns/fcvt_l_s.h" + break; + } + if((insn.bits & 0x1ffff) == 0x17053) + { + #include "insns/fle_s.h" + break; + } + if((insn.bits & 0x7ffffff) == 0x1d053) + { + #include "insns/mffsr.h" + break; + } + if((insn.bits & 0x1f1ff) == 0x3053) + { + #include "insns/fdiv_s.h" + break; + } + if((insn.bits & 0x3fffff) == 0x1f053) + { + #include "insns/mtfsr.h" + break; + } + if((insn.bits & 0x3ff1ff) == 0xd053) + { + #include "insns/fcvt_s_lu.h" + break; + } + if((insn.bits & 0x1f1ff) == 0x2053) + { + #include "insns/fmul_s.h" + break; + } + if((insn.bits & 0x1ffff) == 0x16053) + { + #include "insns/flt_s.h" + break; + } + if((insn.bits & 0x1ffff) == 0x15053) + { + #include "insns/feq_s.h" + break; + } + if((insn.bits & 0x1ffff) == 0x7053) + { + #include "insns/fsgnjx_s.h" + break; + } + if((insn.bits & 0x1ffff) == 0x19053) + { + #include "insns/fmax_s.h" + break; + } + if((insn.bits & 0x3ff1ff) == 0xb053) + { + #include "insns/fcvt_wu_s.h" + break; + } + if((insn.bits & 0x3ff1ff) == 0xa053) + { + #include "insns/fcvt_w_s.h" + break; + } + if((insn.bits & 0x3fffff) == 0x1e053) + { + #include "insns/mxtf_s.h" + break; + } + if((insn.bits & 0x1f1ff) == 0x1053) + { + #include "insns/fsub_s.h" + break; + } + if((insn.bits & 0x1ffff) == 0x5053) + { + #include "insns/fsgnj_s.h" + break; + } + if((insn.bits & 0x3ff1ff) == 0xf053) + { + #include "insns/fcvt_s_wu.h" + break; + } + if((insn.bits & 0x3ff1ff) == 0xc053) + { + #include "insns/fcvt_s_l.h" + break; + } + if((insn.bits & 0x3ff1ff) == 0x4053) + { + #include "insns/fsqrt_s.h" + break; + } + if((insn.bits & 0x1ffff) == 0x6053) + { + #include "insns/fsgnjn_s.h" + break; + } + if((insn.bits & 0x1f1ff) == 0x53) + { + #include "insns/fadd_s.h" + break; + } + throw trap_illegal_instruction; + } + case 0x1: + { + if((insn.bits & 0x1ffff) == 0x180d3) + { + #include "insns/fmin_d.h" + break; + } + if((insn.bits & 0x3ff1ff) == 0xc0d3) + { + #include "insns/fcvt_d_l.h" + break; + } + if((insn.bits & 0x3fffff) == 0xe0d3) + { + #include "insns/fcvt_d_w.h" + break; + } + if((insn.bits & 0x3fffff) == 0x100d3) + { + #include "insns/fcvt_d_s.h" + break; + } + if((insn.bits & 0x1ffff) == 0x190d3) + { + #include "insns/fmax_d.h" + break; + } + if((insn.bits & 0x7c1ffff) == 0x1c0d3) + { + #include "insns/mftx_d.h" + break; + } + if((insn.bits & 0x1ffff) == 0x170d3) + { + #include "insns/fle_d.h" + break; + } + if((insn.bits & 0x1ffff) == 0x160d3) + { + #include "insns/flt_d.h" + break; + } + if((insn.bits & 0x1f1ff) == 0x20d3) + { + #include "insns/fmul_d.h" + break; + } + if((insn.bits & 0x1ffff) == 0x70d3) + { + #include "insns/fsgnjx_d.h" + break; + } + if((insn.bits & 0x1ffff) == 0x150d3) + { + #include "insns/feq_d.h" + break; + } + if((insn.bits & 0x3fffff) == 0xf0d3) + { + #include "insns/fcvt_d_wu.h" + break; + } + if((insn.bits & 0x3ff1ff) == 0xb0d3) + { + #include "insns/fcvt_wu_d.h" + break; + } + if((insn.bits & 0x1ffff) == 0x60d3) + { + #include "insns/fsgnjn_d.h" + break; + } + if((insn.bits & 0x3ff1ff) == 0xd0d3) + { + #include "insns/fcvt_d_lu.h" + break; + } + if((insn.bits & 0x3ff1ff) == 0xa0d3) + { + #include "insns/fcvt_w_d.h" + break; + } + if((insn.bits & 0x3fffff) == 0x1e0d3) + { + #include "insns/mxtf_d.h" + break; + } + if((insn.bits & 0x1ffff) == 0x50d3) + { + #include "insns/fsgnj_d.h" + break; + } + if((insn.bits & 0x3ff1ff) == 0x80d3) + { + #include "insns/fcvt_l_d.h" + break; + } + if((insn.bits & 0x1f1ff) == 0xd3) + { + #include "insns/fadd_d.h" + break; + } + if((insn.bits & 0x3ff1ff) == 0x90d3) + { + #include "insns/fcvt_lu_d.h" + break; + } + if((insn.bits & 0x1f1ff) == 0x10d3) + { + #include "insns/fsub_d.h" + break; + } + if((insn.bits & 0x3ff1ff) == 0x40d3) + { + #include "insns/fsqrt_d.h" + break; + } + if((insn.bits & 0x1f1ff) == 0x30d3) + { + #include "insns/fdiv_d.h" + break; + } + throw trap_illegal_instruction; + } + case 0x4: + { + if((insn.bits & 0x3ff1ff) == 0x9053) + { + #include "insns/fcvt_lu_s.h" + break; + } + if((insn.bits & 0x3ff1ff) == 0x11053) + { + #include "insns/fcvt_s_d.h" + break; + } + if((insn.bits & 0x3ff1ff) == 0xe053) + { + #include "insns/fcvt_s_w.h" + break; + } + if((insn.bits & 0x3ff1ff) == 0x8053) + { + #include "insns/fcvt_l_s.h" + break; + } + if((insn.bits & 0x1f1ff) == 0x3053) + { + #include "insns/fdiv_s.h" + break; + } + if((insn.bits & 0x3ff1ff) == 0xd053) + { + #include "insns/fcvt_s_lu.h" + break; + } + if((insn.bits & 0x1f1ff) == 0x2053) + { + #include "insns/fmul_s.h" + break; + } + if((insn.bits & 0x3ff1ff) == 0xb053) + { + #include "insns/fcvt_wu_s.h" + break; + } + if((insn.bits & 0x3ff1ff) == 0xa053) + { + #include "insns/fcvt_w_s.h" + break; + } + if((insn.bits & 0x1f1ff) == 0x1053) + { + #include "insns/fsub_s.h" + break; + } + if((insn.bits & 0x3ff1ff) == 0xf053) + { + #include "insns/fcvt_s_wu.h" + break; + } + if((insn.bits & 0x3ff1ff) == 0xc053) + { + #include "insns/fcvt_s_l.h" + break; + } + if((insn.bits & 0x3ff1ff) == 0x4053) + { + #include "insns/fsqrt_s.h" + break; + } + if((insn.bits & 0x1f1ff) == 0x53) + { + #include "insns/fadd_s.h" + break; + } + throw trap_illegal_instruction; + } + case 0x5: + { + if((insn.bits & 0x3ff1ff) == 0xc0d3) + { + #include "insns/fcvt_d_l.h" + break; + } + if((insn.bits & 0x1f1ff) == 0x20d3) + { + #include "insns/fmul_d.h" + break; + } + if((insn.bits & 0x3ff1ff) == 0xb0d3) + { + #include "insns/fcvt_wu_d.h" + break; + } + if((insn.bits & 0x3ff1ff) == 0xd0d3) + { + #include "insns/fcvt_d_lu.h" + break; + } + if((insn.bits & 0x3ff1ff) == 0xa0d3) + { + #include "insns/fcvt_w_d.h" + break; + } + if((insn.bits & 0x3ff1ff) == 0x80d3) + { + #include "insns/fcvt_l_d.h" + break; + } + if((insn.bits & 0x1f1ff) == 0xd3) + { + #include "insns/fadd_d.h" + break; + } + if((insn.bits & 0x3ff1ff) == 0x90d3) + { + #include "insns/fcvt_lu_d.h" + break; + } + if((insn.bits & 0x1f1ff) == 0x10d3) + { + #include "insns/fsub_d.h" + break; + } + if((insn.bits & 0x3ff1ff) == 0x40d3) + { + #include "insns/fsqrt_d.h" + break; + } + if((insn.bits & 0x1f1ff) == 0x30d3) + { + #include "insns/fdiv_d.h" + break; + } + throw trap_illegal_instruction; + } + default: + { + throw trap_illegal_instruction; + } + } + break; + } + case 0x54: + { + #include "insns/c_flw.h" + break; + } + case 0x55: + { + #include "insns/c_fld.h" + break; + } + case 0x56: + { + #include "insns/c_fsw.h" + break; + } + case 0x58: + { + #include "insns/c_fsd.h" + break; + } + case 0x59: + { + switch((insn.bits >> 0x7) & 0x7) + { + case 0x0: + { + if((insn.bits & 0x1c1f) == 0x19) + { + #include "insns/c_slli.h" + break; + } + if((insn.bits & 0x1c1f) == 0x819) + { + #include "insns/c_srli.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1419) + { + #include "insns/c_srai32.h" + break; + } + if((insn.bits & 0x1c1f) == 0xc19) + { + #include "insns/c_srli32.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1819) + { + #include "insns/c_slliw.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1019) + { + #include "insns/c_srai.h" + break; + } + if((insn.bits & 0x1c1f) == 0x419) + { + #include "insns/c_slli32.h" + break; + } + throw trap_illegal_instruction; + } + case 0x1: + { + if((insn.bits & 0x1c1f) == 0x19) + { + #include "insns/c_slli.h" + break; + } + if((insn.bits & 0x1c1f) == 0x819) + { + #include "insns/c_srli.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1419) + { + #include "insns/c_srai32.h" + break; + } + if((insn.bits & 0x1c1f) == 0xc19) + { + #include "insns/c_srli32.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1819) + { + #include "insns/c_slliw.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1019) + { + #include "insns/c_srai.h" + break; + } + if((insn.bits & 0x1c1f) == 0x419) + { + #include "insns/c_slli32.h" + break; + } + throw trap_illegal_instruction; + } + case 0x2: + { + if((insn.bits & 0x1c1f) == 0x19) + { + #include "insns/c_slli.h" + break; + } + if((insn.bits & 0x1c1f) == 0x819) + { + #include "insns/c_srli.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1419) + { + #include "insns/c_srai32.h" + break; + } + if((insn.bits & 0x1c1f) == 0xc19) + { + #include "insns/c_srli32.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1819) + { + #include "insns/c_slliw.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1019) + { + #include "insns/c_srai.h" + break; + } + if((insn.bits & 0x1c1f) == 0x419) + { + #include "insns/c_slli32.h" + break; + } + throw trap_illegal_instruction; + } + case 0x3: + { + if((insn.bits & 0x1c1f) == 0x19) + { + #include "insns/c_slli.h" + break; + } + if((insn.bits & 0x1c1f) == 0x819) + { + #include "insns/c_srli.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1419) + { + #include "insns/c_srai32.h" + break; + } + if((insn.bits & 0x1c1f) == 0xc19) + { + #include "insns/c_srli32.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1819) + { + #include "insns/c_slliw.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1019) + { + #include "insns/c_srai.h" + break; + } + if((insn.bits & 0x1c1f) == 0x419) + { + #include "insns/c_slli32.h" + break; + } + throw trap_illegal_instruction; + } + case 0x4: + { + if((insn.bits & 0x1c1f) == 0x19) + { + #include "insns/c_slli.h" + break; + } + if((insn.bits & 0x1c1f) == 0x819) + { + #include "insns/c_srli.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1419) + { + #include "insns/c_srai32.h" + break; + } + if((insn.bits & 0x1c1f) == 0xc19) + { + #include "insns/c_srli32.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1819) + { + #include "insns/c_slliw.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1019) + { + #include "insns/c_srai.h" + break; + } + if((insn.bits & 0x1c1f) == 0x419) + { + #include "insns/c_slli32.h" + break; + } + throw trap_illegal_instruction; + } + case 0x5: + { + if((insn.bits & 0x1c1f) == 0x19) + { + #include "insns/c_slli.h" + break; + } + if((insn.bits & 0x1c1f) == 0x819) + { + #include "insns/c_srli.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1419) + { + #include "insns/c_srai32.h" + break; + } + if((insn.bits & 0x1c1f) == 0xc19) + { + #include "insns/c_srli32.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1819) + { + #include "insns/c_slliw.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1019) + { + #include "insns/c_srai.h" + break; + } + if((insn.bits & 0x1c1f) == 0x419) + { + #include "insns/c_slli32.h" + break; + } + throw trap_illegal_instruction; + } + case 0x6: + { + if((insn.bits & 0x1c1f) == 0x19) + { + #include "insns/c_slli.h" + break; + } + if((insn.bits & 0x1c1f) == 0x819) + { + #include "insns/c_srli.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1419) + { + #include "insns/c_srai32.h" + break; + } + if((insn.bits & 0x1c1f) == 0xc19) + { + #include "insns/c_srli32.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1819) + { + #include "insns/c_slliw.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1019) + { + #include "insns/c_srai.h" + break; + } + if((insn.bits & 0x1c1f) == 0x419) + { + #include "insns/c_slli32.h" + break; + } + throw trap_illegal_instruction; + } + case 0x7: + { + if((insn.bits & 0x1c1f) == 0x19) + { + #include "insns/c_slli.h" + break; + } + if((insn.bits & 0x1c1f) == 0x819) + { + #include "insns/c_srli.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1419) + { + #include "insns/c_srai32.h" + break; + } + if((insn.bits & 0x1c1f) == 0xc19) + { + #include "insns/c_srli32.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1819) + { + #include "insns/c_slliw.h" + break; + } + if((insn.bits & 0x1c1f) == 0x1019) + { + #include "insns/c_srai.h" + break; + } + if((insn.bits & 0x1c1f) == 0x419) + { + #include "insns/c_slli32.h" + break; + } + throw trap_illegal_instruction; + } + default: + { + throw trap_illegal_instruction; + } + } + break; + } + case 0x5a: + { + switch((insn.bits >> 0x7) & 0x7) + { + case 0x0: + { + if((insn.bits & 0x801f) == 0x1a) + { + #include "insns/c_add.h" + break; + } + if((insn.bits & 0x801f) == 0x801a) + { + #include "insns/c_sub.h" + break; + } + throw trap_illegal_instruction; + } + case 0x1: + { + if((insn.bits & 0x801f) == 0x1a) + { + #include "insns/c_add.h" + break; + } + if((insn.bits & 0x801f) == 0x801a) + { + #include "insns/c_sub.h" + break; + } + throw trap_illegal_instruction; + } + case 0x2: + { + if((insn.bits & 0x801f) == 0x1a) + { + #include "insns/c_add.h" + break; + } + if((insn.bits & 0x801f) == 0x801a) + { + #include "insns/c_sub.h" + break; + } + throw trap_illegal_instruction; + } + case 0x3: + { + if((insn.bits & 0x801f) == 0x1a) + { + #include "insns/c_add.h" + break; + } + if((insn.bits & 0x801f) == 0x801a) + { + #include "insns/c_sub.h" + break; + } + throw trap_illegal_instruction; + } + case 0x4: + { + if((insn.bits & 0x801f) == 0x1a) + { + #include "insns/c_add.h" + break; + } + if((insn.bits & 0x801f) == 0x801a) + { + #include "insns/c_sub.h" + break; + } + throw trap_illegal_instruction; + } + case 0x5: + { + if((insn.bits & 0x801f) == 0x1a) + { + #include "insns/c_add.h" + break; + } + if((insn.bits & 0x801f) == 0x801a) + { + #include "insns/c_sub.h" + break; + } + throw trap_illegal_instruction; + } + case 0x6: + { + if((insn.bits & 0x801f) == 0x1a) + { + #include "insns/c_add.h" + break; + } + if((insn.bits & 0x801f) == 0x801a) + { + #include "insns/c_sub.h" + break; + } + throw trap_illegal_instruction; + } + case 0x7: + { + if((insn.bits & 0x801f) == 0x1a) + { + #include "insns/c_add.h" + break; + } + if((insn.bits & 0x801f) == 0x801a) + { + #include "insns/c_sub.h" + break; + } + throw trap_illegal_instruction; + } + default: + { + throw trap_illegal_instruction; + } + } + break; + } + case 0x5c: + { + switch((insn.bits >> 0x7) & 0x7) + { + case 0x0: + { + #include "insns/c_add3.h" + break; + } + case 0x1: + { + #include "insns/c_add3.h" + break; + } + case 0x2: + { + #include "insns/c_sub3.h" + break; + } + case 0x3: + { + #include "insns/c_sub3.h" + break; + } + case 0x4: + { + #include "insns/c_or3.h" + break; + } + case 0x5: + { + #include "insns/c_or3.h" + break; + } + case 0x6: + { + #include "insns/c_and3.h" + break; + } + case 0x7: + { + #include "insns/c_and3.h" + break; + } + default: + { + throw trap_illegal_instruction; + } + } + break; + } + case 0x60: + { + #include "insns/c_li.h" + break; + } + case 0x61: + { + #include "insns/c_addi.h" + break; + } + case 0x62: + { + switch((insn.bits >> 0x7) & 0x7) + { + case 0x0: + { + if((insn.bits & 0x801f) == 0x2) + { + #include "insns/c_move.h" + break; + } + if((insn.bits & 0x801f) == 0x8002) + { + #include "insns/c_j.h" + break; + } + throw trap_illegal_instruction; + } + case 0x1: + { + if((insn.bits & 0x801f) == 0x2) + { + #include "insns/c_move.h" + break; + } + if((insn.bits & 0x801f) == 0x8002) + { + #include "insns/c_j.h" + break; + } + throw trap_illegal_instruction; + } + case 0x2: + { + if((insn.bits & 0x801f) == 0x2) + { + #include "insns/c_move.h" + break; + } + if((insn.bits & 0x801f) == 0x8002) + { + #include "insns/c_j.h" + break; + } + throw trap_illegal_instruction; + } + case 0x3: + { + if((insn.bits & 0x801f) == 0x2) + { + #include "insns/c_move.h" + break; + } + if((insn.bits & 0x801f) == 0x8002) + { + #include "insns/c_j.h" + break; + } + throw trap_illegal_instruction; + } + case 0x4: + { + if((insn.bits & 0x801f) == 0x2) + { + #include "insns/c_move.h" + break; + } + if((insn.bits & 0x801f) == 0x8002) + { + #include "insns/c_j.h" + break; + } + throw trap_illegal_instruction; + } + case 0x5: + { + if((insn.bits & 0x801f) == 0x2) + { + #include "insns/c_move.h" + break; + } + if((insn.bits & 0x801f) == 0x8002) + { + #include "insns/c_j.h" + break; + } + throw trap_illegal_instruction; + } + case 0x6: + { + if((insn.bits & 0x801f) == 0x2) + { + #include "insns/c_move.h" + break; + } + if((insn.bits & 0x801f) == 0x8002) + { + #include "insns/c_j.h" + break; + } + throw trap_illegal_instruction; + } + case 0x7: + { + if((insn.bits & 0x801f) == 0x2) + { + #include "insns/c_move.h" + break; } - if((insn.bits & 0x3fffff) == 0x1e053) + if((insn.bits & 0x801f) == 0x8002) { - #include "insns/mxtf_s.h" + #include "insns/c_j.h" break; } - if((insn.bits & 0x1f1ff) == 0x1053) + throw trap_illegal_instruction; + } + default: + { + throw trap_illegal_instruction; + } + } + break; + } + case 0x63: + { + switch((insn.bits >> 0x7) & 0x7) + { + case 0x0: + { + #include "insns/beq.h" + break; + } + case 0x1: + { + #include "insns/bne.h" + break; + } + case 0x4: + { + #include "insns/blt.h" + break; + } + case 0x5: + { + #include "insns/bge.h" + break; + } + case 0x6: + { + #include "insns/bltu.h" + break; + } + case 0x7: + { + #include "insns/bgeu.h" + break; + } + default: + { + throw trap_illegal_instruction; + } + } + break; + } + case 0x64: + { + #include "insns/c_ldsp.h" + break; + } + case 0x65: + { + #include "insns/c_lwsp.h" + break; + } + case 0x66: + { + #include "insns/c_sdsp.h" + break; + } + case 0x67: + { + #include "insns/j.h" + break; + } + case 0x68: + { + #include "insns/c_swsp.h" + break; + } + case 0x69: + { + #include "insns/c_ld.h" + break; + } + case 0x6a: + { + #include "insns/c_lw.h" + break; + } + case 0x6b: + { + switch((insn.bits >> 0x7) & 0x7) + { + case 0x0: + { + #include "insns/jalr_c.h" + break; + } + case 0x1: + { + #include "insns/jalr_r.h" + break; + } + case 0x2: + { + #include "insns/jalr_j.h" + break; + } + case 0x4: + { + if((insn.bits & 0x7ffffff) == 0x26b) { - #include "insns/fsub_s.h" + #include "insns/rdnpc.h" break; } - if((insn.bits & 0x1ffff) == 0x5053) + throw trap_illegal_instruction; + } + default: + { + throw trap_illegal_instruction; + } + } + break; + } + case 0x6c: + { + #include "insns/c_sd.h" + break; + } + case 0x6d: + { + #include "insns/c_sw.h" + break; + } + case 0x6f: + { + #include "insns/jal.h" + break; + } + case 0x70: + { + #include "insns/c_beq.h" + break; + } + case 0x71: + { + #include "insns/c_bne.h" + break; + } + case 0x72: + { + switch((insn.bits >> 0x7) & 0x7) + { + case 0x0: + { + if((insn.bits & 0x801f) == 0x12) { - #include "insns/fsgnj_s.h" + #include "insns/c_lw0.h" break; } - if((insn.bits & 0x3ff1ff) == 0xf053) + if((insn.bits & 0x801f) == 0x8012) { - #include "insns/fcvt_s_wu.h" + #include "insns/c_ld0.h" break; } - if((insn.bits & 0x3ff1ff) == 0xc053) + throw trap_illegal_instruction; + } + case 0x1: + { + if((insn.bits & 0x801f) == 0x12) { - #include "insns/fcvt_s_l.h" + #include "insns/c_lw0.h" break; } - if((insn.bits & 0x3ff1ff) == 0x4053) + if((insn.bits & 0x801f) == 0x8012) { - #include "insns/fsqrt_s.h" + #include "insns/c_ld0.h" break; } - if((insn.bits & 0x1ffff) == 0x6053) + throw trap_illegal_instruction; + } + case 0x2: + { + if((insn.bits & 0x801f) == 0x12) + { + #include "insns/c_lw0.h" + break; + } + if((insn.bits & 0x801f) == 0x8012) + { + #include "insns/c_ld0.h" + break; + } + throw trap_illegal_instruction; + } + case 0x3: + { + if((insn.bits & 0x801f) == 0x12) + { + #include "insns/c_lw0.h" + break; + } + if((insn.bits & 0x801f) == 0x8012) + { + #include "insns/c_ld0.h" + break; + } + throw trap_illegal_instruction; + } + case 0x4: + { + if((insn.bits & 0x801f) == 0x12) + { + #include "insns/c_lw0.h" + break; + } + if((insn.bits & 0x801f) == 0x8012) + { + #include "insns/c_ld0.h" + break; + } + throw trap_illegal_instruction; + } + case 0x5: + { + if((insn.bits & 0x801f) == 0x12) + { + #include "insns/c_lw0.h" + break; + } + if((insn.bits & 0x801f) == 0x8012) + { + #include "insns/c_ld0.h" + break; + } + throw trap_illegal_instruction; + } + case 0x6: + { + if((insn.bits & 0x801f) == 0x12) + { + #include "insns/c_lw0.h" + break; + } + if((insn.bits & 0x801f) == 0x8012) + { + #include "insns/c_ld0.h" + break; + } + throw trap_illegal_instruction; + } + case 0x7: + { + if((insn.bits & 0x801f) == 0x12) + { + #include "insns/c_lw0.h" + break; + } + if((insn.bits & 0x801f) == 0x8012) + { + #include "insns/c_ld0.h" + break; + } + throw trap_illegal_instruction; + } + default: + { + throw trap_illegal_instruction; + } + } + break; + } + case 0x73: + { + switch((insn.bits >> 0x7) & 0x7) + { + case 0x0: + { + #include "insns/vcfgivl.h" + break; + } + case 0x1: + { + if((insn.bits & 0x3fffff) == 0xf3) + { + #include "insns/setvl.h" + break; + } + throw trap_illegal_instruction; + } + case 0x2: + { + if((insn.bits & 0xf80003ff) == 0x173) { - #include "insns/fsgnjn_s.h" + #include "insns/vf.h" break; } - if((insn.bits & 0x1f1ff) == 0x53) + throw trap_illegal_instruction; + } + default: + { + throw trap_illegal_instruction; + } + } + break; + } + case 0x74: + { + #include "insns/c_flw.h" + break; + } + case 0x75: + { + #include "insns/c_fld.h" + break; + } + case 0x76: + { + #include "insns/c_fsw.h" + break; + } + case 0x77: + { + switch((insn.bits >> 0x7) & 0x7) + { + case 0x0: + { + if((insn.bits & 0xffffffff) == 0x77) { - #include "insns/fadd_s.h" + #include "insns/syscall.h" break; } throw trap_illegal_instruction; } case 0x1: { - if((insn.bits & 0x1ffff) == 0x180d3) + if((insn.bits & 0xffffffff) == 0xf7) { - #include "insns/fmin_d.h" + #include "insns/break.h" break; } - if((insn.bits & 0x3ff1ff) == 0xc0d3) + throw trap_illegal_instruction; + } + case 0x2: + { + if((insn.bits & 0xffffffff) == 0x177) { - #include "insns/fcvt_d_l.h" + #include "insns/stop.h" break; } - if((insn.bits & 0x3fffff) == 0xe0d3) + throw trap_illegal_instruction; + } + case 0x3: + { + if((insn.bits & 0x7ffffff) == 0x1f7) { - #include "insns/fcvt_d_w.h" + #include "insns/utidx.h" break; } - if((insn.bits & 0x3fffff) == 0x100d3) + throw trap_illegal_instruction; + } + default: + { + throw trap_illegal_instruction; + } + } + break; + } + case 0x78: + { + #include "insns/c_fsd.h" + break; + } + case 0x79: + { + switch((insn.bits >> 0x7) & 0x7) + { + case 0x0: + { + if((insn.bits & 0x1c1f) == 0x19) { - #include "insns/fcvt_d_s.h" + #include "insns/c_slli.h" break; } - if((insn.bits & 0x1ffff) == 0x190d3) + if((insn.bits & 0x1c1f) == 0x819) { - #include "insns/fmax_d.h" + #include "insns/c_srli.h" break; } - if((insn.bits & 0x7c1ffff) == 0x1c0d3) + if((insn.bits & 0x1c1f) == 0x1419) { - #include "insns/mftx_d.h" + #include "insns/c_srai32.h" break; } - if((insn.bits & 0x1ffff) == 0x170d3) + if((insn.bits & 0x1c1f) == 0xc19) { - #include "insns/fle_d.h" + #include "insns/c_srli32.h" break; } - if((insn.bits & 0x1ffff) == 0x160d3) + if((insn.bits & 0x1c1f) == 0x1819) { - #include "insns/flt_d.h" + #include "insns/c_slliw.h" break; } - if((insn.bits & 0x1f1ff) == 0x20d3) + if((insn.bits & 0x1c1f) == 0x1019) { - #include "insns/fmul_d.h" + #include "insns/c_srai.h" break; } - if((insn.bits & 0x1ffff) == 0x70d3) + if((insn.bits & 0x1c1f) == 0x419) { - #include "insns/fsgnjx_d.h" + #include "insns/c_slli32.h" break; } - if((insn.bits & 0x1ffff) == 0x150d3) + throw trap_illegal_instruction; + } + case 0x1: + { + if((insn.bits & 0x1c1f) == 0x19) { - #include "insns/feq_d.h" + #include "insns/c_slli.h" break; } - if((insn.bits & 0x3fffff) == 0xf0d3) + if((insn.bits & 0x1c1f) == 0x819) { - #include "insns/fcvt_d_wu.h" + #include "insns/c_srli.h" break; } - if((insn.bits & 0x3ff1ff) == 0xb0d3) + if((insn.bits & 0x1c1f) == 0x1419) { - #include "insns/fcvt_wu_d.h" + #include "insns/c_srai32.h" break; } - if((insn.bits & 0x1ffff) == 0x60d3) + if((insn.bits & 0x1c1f) == 0xc19) { - #include "insns/fsgnjn_d.h" + #include "insns/c_srli32.h" break; } - if((insn.bits & 0x3ff1ff) == 0xd0d3) + if((insn.bits & 0x1c1f) == 0x1819) { - #include "insns/fcvt_d_lu.h" + #include "insns/c_slliw.h" break; } - if((insn.bits & 0x3ff1ff) == 0xa0d3) + if((insn.bits & 0x1c1f) == 0x1019) { - #include "insns/fcvt_w_d.h" + #include "insns/c_srai.h" break; } - if((insn.bits & 0x3fffff) == 0x1e0d3) + if((insn.bits & 0x1c1f) == 0x419) { - #include "insns/mxtf_d.h" + #include "insns/c_slli32.h" break; } - if((insn.bits & 0x1ffff) == 0x50d3) + throw trap_illegal_instruction; + } + case 0x2: + { + if((insn.bits & 0x1c1f) == 0x19) { - #include "insns/fsgnj_d.h" + #include "insns/c_slli.h" break; } - if((insn.bits & 0x3ff1ff) == 0x80d3) + if((insn.bits & 0x1c1f) == 0x819) { - #include "insns/fcvt_l_d.h" + #include "insns/c_srli.h" break; } - if((insn.bits & 0x1f1ff) == 0xd3) + if((insn.bits & 0x1c1f) == 0x1419) { - #include "insns/fadd_d.h" + #include "insns/c_srai32.h" break; } - if((insn.bits & 0x3ff1ff) == 0x90d3) + if((insn.bits & 0x1c1f) == 0xc19) { - #include "insns/fcvt_lu_d.h" + #include "insns/c_srli32.h" break; } - if((insn.bits & 0x1f1ff) == 0x10d3) + if((insn.bits & 0x1c1f) == 0x1819) { - #include "insns/fsub_d.h" + #include "insns/c_slliw.h" break; } - if((insn.bits & 0x3ff1ff) == 0x40d3) + if((insn.bits & 0x1c1f) == 0x1019) { - #include "insns/fsqrt_d.h" + #include "insns/c_srai.h" break; } - if((insn.bits & 0x1f1ff) == 0x30d3) + if((insn.bits & 0x1c1f) == 0x419) { - #include "insns/fdiv_d.h" + #include "insns/c_slli32.h" break; } throw trap_illegal_instruction; } - case 0x4: + case 0x3: { - if((insn.bits & 0x3ff1ff) == 0x9053) + if((insn.bits & 0x1c1f) == 0x19) { - #include "insns/fcvt_lu_s.h" + #include "insns/c_slli.h" break; } - if((insn.bits & 0x3ff1ff) == 0x11053) + if((insn.bits & 0x1c1f) == 0x819) { - #include "insns/fcvt_s_d.h" + #include "insns/c_srli.h" break; } - if((insn.bits & 0x3ff1ff) == 0xe053) + if((insn.bits & 0x1c1f) == 0x1419) { - #include "insns/fcvt_s_w.h" + #include "insns/c_srai32.h" break; } - if((insn.bits & 0x3ff1ff) == 0x8053) + if((insn.bits & 0x1c1f) == 0xc19) { - #include "insns/fcvt_l_s.h" + #include "insns/c_srli32.h" break; } - if((insn.bits & 0x1f1ff) == 0x3053) + if((insn.bits & 0x1c1f) == 0x1819) { - #include "insns/fdiv_s.h" + #include "insns/c_slliw.h" break; } - if((insn.bits & 0x3ff1ff) == 0xd053) + if((insn.bits & 0x1c1f) == 0x1019) { - #include "insns/fcvt_s_lu.h" + #include "insns/c_srai.h" break; } - if((insn.bits & 0x1f1ff) == 0x2053) + if((insn.bits & 0x1c1f) == 0x419) { - #include "insns/fmul_s.h" + #include "insns/c_slli32.h" break; } - if((insn.bits & 0x3ff1ff) == 0xb053) + throw trap_illegal_instruction; + } + case 0x4: + { + if((insn.bits & 0x1c1f) == 0x19) { - #include "insns/fcvt_wu_s.h" + #include "insns/c_slli.h" break; } - if((insn.bits & 0x3ff1ff) == 0xa053) + if((insn.bits & 0x1c1f) == 0x819) { - #include "insns/fcvt_w_s.h" + #include "insns/c_srli.h" break; } - if((insn.bits & 0x1f1ff) == 0x1053) + if((insn.bits & 0x1c1f) == 0x1419) { - #include "insns/fsub_s.h" + #include "insns/c_srai32.h" break; } - if((insn.bits & 0x3ff1ff) == 0xf053) + if((insn.bits & 0x1c1f) == 0xc19) { - #include "insns/fcvt_s_wu.h" + #include "insns/c_srli32.h" break; } - if((insn.bits & 0x3ff1ff) == 0xc053) + if((insn.bits & 0x1c1f) == 0x1819) { - #include "insns/fcvt_s_l.h" + #include "insns/c_slliw.h" break; } - if((insn.bits & 0x3ff1ff) == 0x4053) + if((insn.bits & 0x1c1f) == 0x1019) { - #include "insns/fsqrt_s.h" + #include "insns/c_srai.h" break; } - if((insn.bits & 0x1f1ff) == 0x53) + if((insn.bits & 0x1c1f) == 0x419) { - #include "insns/fadd_s.h" + #include "insns/c_slli32.h" break; } throw trap_illegal_instruction; } case 0x5: { - if((insn.bits & 0x3ff1ff) == 0xc0d3) - { - #include "insns/fcvt_d_l.h" - break; - } - if((insn.bits & 0x1f1ff) == 0x20d3) - { - #include "insns/fmul_d.h" - break; - } - if((insn.bits & 0x3ff1ff) == 0xb0d3) - { - #include "insns/fcvt_wu_d.h" - break; - } - if((insn.bits & 0x3ff1ff) == 0xd0d3) - { - #include "insns/fcvt_d_lu.h" - break; - } - if((insn.bits & 0x3ff1ff) == 0xa0d3) - { - #include "insns/fcvt_w_d.h" - break; - } - if((insn.bits & 0x3ff1ff) == 0x80d3) - { - #include "insns/fcvt_l_d.h" - break; - } - if((insn.bits & 0x1f1ff) == 0xd3) + if((insn.bits & 0x1c1f) == 0x19) { - #include "insns/fadd_d.h" + #include "insns/c_slli.h" break; } - if((insn.bits & 0x3ff1ff) == 0x90d3) + if((insn.bits & 0x1c1f) == 0x819) { - #include "insns/fcvt_lu_d.h" + #include "insns/c_srli.h" break; } - if((insn.bits & 0x1f1ff) == 0x10d3) + if((insn.bits & 0x1c1f) == 0x1419) { - #include "insns/fsub_d.h" + #include "insns/c_srai32.h" break; } - if((insn.bits & 0x3ff1ff) == 0x40d3) + if((insn.bits & 0x1c1f) == 0xc19) { - #include "insns/fsqrt_d.h" + #include "insns/c_srli32.h" break; } - if((insn.bits & 0x1f1ff) == 0x30d3) + if((insn.bits & 0x1c1f) == 0x1819) { - #include "insns/fdiv_d.h" + #include "insns/c_slliw.h" break; } - throw trap_illegal_instruction; - } - default: - { - throw trap_illegal_instruction; - } - } - break; - } - case 0x60: - { - #include "insns/c_addi.h" - break; - } - case 0x61: - { - #include "insns/c_li.h" - break; - } - case 0x62: - { - switch((insn.bits >> 0x7) & 0x7) - { - case 0x0: - { - if((insn.bits & 0x801f) == 0x2) + if((insn.bits & 0x1c1f) == 0x1019) { - #include "insns/c_move.h" + #include "insns/c_srai.h" break; } - if((insn.bits & 0x801f) == 0x8002) + if((insn.bits & 0x1c1f) == 0x419) { - #include "insns/c_j.h" + #include "insns/c_slli32.h" break; } throw trap_illegal_instruction; } - case 0x1: + case 0x6: { - if((insn.bits & 0x801f) == 0x2) + if((insn.bits & 0x1c1f) == 0x19) { - #include "insns/c_move.h" - break; - } - if((insn.bits & 0x801f) == 0x8002) - { - #include "insns/c_j.h" + #include "insns/c_slli.h" break; } - throw trap_illegal_instruction; - } - case 0x2: - { - if((insn.bits & 0x801f) == 0x2) + if((insn.bits & 0x1c1f) == 0x819) { - #include "insns/c_move.h" + #include "insns/c_srli.h" break; } - if((insn.bits & 0x801f) == 0x8002) + if((insn.bits & 0x1c1f) == 0x1419) { - #include "insns/c_j.h" + #include "insns/c_srai32.h" break; } - throw trap_illegal_instruction; - } - case 0x3: - { - if((insn.bits & 0x801f) == 0x2) + if((insn.bits & 0x1c1f) == 0xc19) { - #include "insns/c_move.h" + #include "insns/c_srli32.h" break; } - if((insn.bits & 0x801f) == 0x8002) + if((insn.bits & 0x1c1f) == 0x1819) { - #include "insns/c_j.h" + #include "insns/c_slliw.h" break; } - throw trap_illegal_instruction; - } - case 0x4: - { - if((insn.bits & 0x801f) == 0x2) + if((insn.bits & 0x1c1f) == 0x1019) { - #include "insns/c_move.h" + #include "insns/c_srai.h" break; } - if((insn.bits & 0x801f) == 0x8002) + if((insn.bits & 0x1c1f) == 0x419) { - #include "insns/c_j.h" + #include "insns/c_slli32.h" break; } throw trap_illegal_instruction; } - case 0x5: + case 0x7: { - if((insn.bits & 0x801f) == 0x2) + if((insn.bits & 0x1c1f) == 0x19) { - #include "insns/c_move.h" + #include "insns/c_slli.h" break; } - if((insn.bits & 0x801f) == 0x8002) + if((insn.bits & 0x1c1f) == 0x819) { - #include "insns/c_j.h" + #include "insns/c_srli.h" break; } - throw trap_illegal_instruction; - } - case 0x6: - { - if((insn.bits & 0x801f) == 0x2) + if((insn.bits & 0x1c1f) == 0x1419) { - #include "insns/c_move.h" + #include "insns/c_srai32.h" break; } - if((insn.bits & 0x801f) == 0x8002) + if((insn.bits & 0x1c1f) == 0xc19) { - #include "insns/c_j.h" + #include "insns/c_srli32.h" break; } - throw trap_illegal_instruction; - } - case 0x7: - { - if((insn.bits & 0x801f) == 0x2) + if((insn.bits & 0x1c1f) == 0x1819) { - #include "insns/c_move.h" + #include "insns/c_slliw.h" break; } - if((insn.bits & 0x801f) == 0x8002) + if((insn.bits & 0x1c1f) == 0x1019) { - #include "insns/c_j.h" + #include "insns/c_srai.h" + break; + } + if((insn.bits & 0x1c1f) == 0x419) + { + #include "insns/c_slli32.h" break; } throw trap_illegal_instruction; @@ -2212,212 +4815,118 @@ switch((insn.bits >> 0x0) & 0x7f) } break; } - case 0x63: - { - switch((insn.bits >> 0x7) & 0x7) - { - case 0x0: - { - #include "insns/beq.h" - break; - } - case 0x1: - { - #include "insns/bne.h" - break; - } - case 0x4: - { - #include "insns/blt.h" - break; - } - case 0x5: - { - #include "insns/bge.h" - break; - } - case 0x6: - { - #include "insns/bltu.h" - break; - } - case 0x7: - { - #include "insns/bgeu.h" - break; - } - default: - { - throw trap_illegal_instruction; - } - } - break; - } - case 0x64: - { - #include "insns/c_ldsp.h" - break; - } - case 0x65: - { - #include "insns/c_lwsp.h" - break; - } - case 0x66: - { - #include "insns/c_sdsp.h" - break; - } - case 0x67: - { - #include "insns/j.h" - break; - } - case 0x68: - { - #include "insns/c_swsp.h" - break; - } - case 0x69: - { - #include "insns/c_ld.h" - break; - } - case 0x6a: - { - #include "insns/c_lw.h" - break; - } - case 0x6b: + case 0x7a: { switch((insn.bits >> 0x7) & 0x7) { case 0x0: { - #include "insns/jalr_c.h" - break; - } - case 0x1: - { - #include "insns/jalr_r.h" - break; - } - case 0x2: - { - #include "insns/jalr_j.h" - break; - } - case 0x4: - { - if((insn.bits & 0x7ffffff) == 0x26b) + if((insn.bits & 0x801f) == 0x1a) { - #include "insns/rdnpc.h" + #include "insns/c_add.h" + break; + } + if((insn.bits & 0x801f) == 0x801a) + { + #include "insns/c_sub.h" break; } throw trap_illegal_instruction; } - default: - { - throw trap_illegal_instruction; - } - } - break; - } - case 0x6c: - { - #include "insns/c_sd.h" - break; - } - case 0x6d: - { - #include "insns/c_sw.h" - break; - } - case 0x6f: - { - #include "insns/jal.h" - break; - } - case 0x70: - { - #include "insns/c_beq.h" - break; - } - case 0x71: - { - #include "insns/c_bne.h" - break; - } - case 0x73: - { - switch((insn.bits >> 0x7) & 0x7) - { - case 0x0: - { - #include "insns/vcfgivl.h" - break; - } case 0x1: { - if((insn.bits & 0x3fffff) == 0xf3) + if((insn.bits & 0x801f) == 0x1a) { - #include "insns/setvl.h" + #include "insns/c_add.h" + break; + } + if((insn.bits & 0x801f) == 0x801a) + { + #include "insns/c_sub.h" break; } throw trap_illegal_instruction; } case 0x2: { - if((insn.bits & 0xf80003ff) == 0x173) + if((insn.bits & 0x801f) == 0x1a) { - #include "insns/vf.h" + #include "insns/c_add.h" + break; + } + if((insn.bits & 0x801f) == 0x801a) + { + #include "insns/c_sub.h" break; } throw trap_illegal_instruction; } - default: + case 0x3: { + if((insn.bits & 0x801f) == 0x1a) + { + #include "insns/c_add.h" + break; + } + if((insn.bits & 0x801f) == 0x801a) + { + #include "insns/c_sub.h" + break; + } throw trap_illegal_instruction; } - } - break; - } - case 0x77: - { - switch((insn.bits >> 0x7) & 0x7) - { - case 0x0: + case 0x4: { - if((insn.bits & 0xffffffff) == 0x77) + if((insn.bits & 0x801f) == 0x1a) { - #include "insns/syscall.h" + #include "insns/c_add.h" + break; + } + if((insn.bits & 0x801f) == 0x801a) + { + #include "insns/c_sub.h" break; } throw trap_illegal_instruction; } - case 0x1: + case 0x5: { - if((insn.bits & 0xffffffff) == 0xf7) + if((insn.bits & 0x801f) == 0x1a) { - #include "insns/break.h" + #include "insns/c_add.h" + break; + } + if((insn.bits & 0x801f) == 0x801a) + { + #include "insns/c_sub.h" break; } throw trap_illegal_instruction; } - case 0x2: + case 0x6: { - if((insn.bits & 0xffffffff) == 0x177) + if((insn.bits & 0x801f) == 0x1a) { - #include "insns/stop.h" + #include "insns/c_add.h" + break; + } + if((insn.bits & 0x801f) == 0x801a) + { + #include "insns/c_sub.h" break; } throw trap_illegal_instruction; } - case 0x3: + case 0x7: { - if((insn.bits & 0x7ffffff) == 0x1f7) + if((insn.bits & 0x801f) == 0x1a) { - #include "insns/utidx.h" + #include "insns/c_add.h" + break; + } + if((insn.bits & 0x801f) == 0x801a) + { + #include "insns/c_sub.h" break; } throw trap_illegal_instruction; @@ -2494,6 +5003,57 @@ switch((insn.bits >> 0x0) & 0x7f) } break; } + case 0x7c: + { + switch((insn.bits >> 0x7) & 0x7) + { + case 0x0: + { + #include "insns/c_add3.h" + break; + } + case 0x1: + { + #include "insns/c_add3.h" + break; + } + case 0x2: + { + #include "insns/c_sub3.h" + break; + } + case 0x3: + { + #include "insns/c_sub3.h" + break; + } + case 0x4: + { + #include "insns/c_or3.h" + break; + } + case 0x5: + { + #include "insns/c_or3.h" + break; + } + case 0x6: + { + #include "insns/c_and3.h" + break; + } + case 0x7: + { + #include "insns/c_and3.h" + break; + } + default: + { + throw trap_illegal_instruction; + } + } + break; + } default: { throw trap_illegal_instruction; diff --git a/riscv/insns/c_add.h b/riscv/insns/c_add.h new file mode 100644 index 0000000..2170d69 --- /dev/null +++ b/riscv/insns/c_add.h @@ -0,0 +1,2 @@ +require_rvc; +CRD = CRS1 + CRS2; diff --git a/riscv/insns/c_add3.h b/riscv/insns/c_add3.h new file mode 100644 index 0000000..914c85d --- /dev/null +++ b/riscv/insns/c_add3.h @@ -0,0 +1,2 @@ +require_rvc; +CRDS = CRS1S + CRS2BS; diff --git a/riscv/insns/c_addi.h b/riscv/insns/c_addi.h index 4a5a0af..c716f69 100644 --- a/riscv/insns/c_addi.h +++ b/riscv/insns/c_addi.h @@ -1,2 +1,10 @@ require_rvc; -CRD = sext_xprlen(CRS2 + CIMM6); +if(CRD_REGNUM == 0) +{ + reg_t temp = npc; + npc = CRS1; + if(CIMM6 & 0x20) + RA = temp; +} +else + CRD = sext_xprlen(CRS2 + CIMM6); diff --git a/riscv/insns/c_and3.h b/riscv/insns/c_and3.h new file mode 100644 index 0000000..b506d6a --- /dev/null +++ b/riscv/insns/c_and3.h @@ -0,0 +1,2 @@ +require_rvc; +CRDS = CRS1S & CRS2BS; diff --git a/riscv/insns/c_fld.h b/riscv/insns/c_fld.h new file mode 100644 index 0000000..a726039 --- /dev/null +++ b/riscv/insns/c_fld.h @@ -0,0 +1,3 @@ +require_rvc; +require_fp; +FCRDS = mmu.load_int64(CRS1S+CIMM5*8); diff --git a/riscv/insns/c_flw.h b/riscv/insns/c_flw.h new file mode 100644 index 0000000..cdb7221 --- /dev/null +++ b/riscv/insns/c_flw.h @@ -0,0 +1,3 @@ +require_rvc; +require_fp; +FCRDS = mmu.load_int32(CRS1S+CIMM5*4); diff --git a/riscv/insns/c_fsd.h b/riscv/insns/c_fsd.h new file mode 100644 index 0000000..20814fd --- /dev/null +++ b/riscv/insns/c_fsd.h @@ -0,0 +1,3 @@ +require_rvc; +require_fp; +mmu.store_uint64(CRS1S+CIMM5*8, FCRS2S); diff --git a/riscv/insns/c_fsw.h b/riscv/insns/c_fsw.h new file mode 100644 index 0000000..1d21629 --- /dev/null +++ b/riscv/insns/c_fsw.h @@ -0,0 +1,3 @@ +require_rvc; +require_fp; +mmu.store_uint32(CRS1S+CIMM5*4, FCRS2S); diff --git a/riscv/insns/c_ld0.h b/riscv/insns/c_ld0.h new file mode 100644 index 0000000..f51a966 --- /dev/null +++ b/riscv/insns/c_ld0.h @@ -0,0 +1,3 @@ +require_rvc; +require_xpr64; +CRD = mmu.load_int64(CRS1); diff --git a/riscv/insns/c_lw0.h b/riscv/insns/c_lw0.h new file mode 100644 index 0000000..d263a80 --- /dev/null +++ b/riscv/insns/c_lw0.h @@ -0,0 +1,2 @@ +require_rvc; +CRD = mmu.load_int32(CRS1); diff --git a/riscv/insns/c_or3.h b/riscv/insns/c_or3.h new file mode 100644 index 0000000..143e2ae --- /dev/null +++ b/riscv/insns/c_or3.h @@ -0,0 +1,2 @@ +require_rvc; +CRDS = CRS1S | CRS2BS; diff --git a/riscv/insns/c_slli.h b/riscv/insns/c_slli.h new file mode 100644 index 0000000..5026767 --- /dev/null +++ b/riscv/insns/c_slli.h @@ -0,0 +1,5 @@ +require_rvc; +if(xpr64) + CRDS = CRDS << CIMM5U; +else + CRDS = sext32(CRDS << CIMM5U); diff --git a/riscv/insns/c_slli32.h b/riscv/insns/c_slli32.h new file mode 100644 index 0000000..1e3e958 --- /dev/null +++ b/riscv/insns/c_slli32.h @@ -0,0 +1,3 @@ +require_rvc; +require_xpr64; +CRDS = CRDS << (32+CIMM5U); diff --git a/riscv/insns/c_slliw.h b/riscv/insns/c_slliw.h new file mode 100644 index 0000000..9e428f5 --- /dev/null +++ b/riscv/insns/c_slliw.h @@ -0,0 +1,3 @@ +require_rvc; +require_xpr64; +CRDS = sext32(CRDS << CIMM5U); diff --git a/riscv/insns/c_srai.h b/riscv/insns/c_srai.h new file mode 100644 index 0000000..aa33424 --- /dev/null +++ b/riscv/insns/c_srai.h @@ -0,0 +1,5 @@ +require_rvc; +if(xpr64) + CRDS = sreg_t(CRDS) >> CIMM5U; +else + CRDS = sext32(int32_t(CRDS) >> CIMM5U); diff --git a/riscv/insns/c_srai32.h b/riscv/insns/c_srai32.h new file mode 100644 index 0000000..ca7b024 --- /dev/null +++ b/riscv/insns/c_srai32.h @@ -0,0 +1,3 @@ +require_rvc; +require_xpr64; +CRDS = sreg_t(CRDS) >> (32+CIMM5U); diff --git a/riscv/insns/c_srli.h b/riscv/insns/c_srli.h new file mode 100644 index 0000000..56e0681 --- /dev/null +++ b/riscv/insns/c_srli.h @@ -0,0 +1,5 @@ +require_rvc; +if(xpr64) + CRDS = CRDS >> CIMM5U; +else + CRDS = sext32(uint32_t(CRDS) >> CIMM5U); diff --git a/riscv/insns/c_srli32.h b/riscv/insns/c_srli32.h new file mode 100644 index 0000000..4f5b8ea --- /dev/null +++ b/riscv/insns/c_srli32.h @@ -0,0 +1,3 @@ +require_rvc; +require_xpr64; +CRDS = CRDS >> (32+CIMM5U); diff --git a/riscv/insns/c_sub.h b/riscv/insns/c_sub.h new file mode 100644 index 0000000..9fd8932 --- /dev/null +++ b/riscv/insns/c_sub.h @@ -0,0 +1,2 @@ +require_rvc; +CRD = CRS1 - CRS2; diff --git a/riscv/insns/c_sub3.h b/riscv/insns/c_sub3.h new file mode 100644 index 0000000..53afc84 --- /dev/null +++ b/riscv/insns/c_sub3.h @@ -0,0 +1,2 @@ +require_rvc; +CRDS = CRS1S - CRS2BS;