From: Andrew Waterman Date: Wed, 2 Feb 2011 02:57:37 +0000 (-0800) Subject: [sim] added nearest/ties to max magnitude rounding mode X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ada2fe414b30e7a4a568401663cd070cf7b60076;p=riscv-isa-sim.git [sim] added nearest/ties to max magnitude rounding mode --- diff --git a/riscv/decode.h b/riscv/decode.h index c462dcb..6360ab8 100644 --- a/riscv/decode.h +++ b/riscv/decode.h @@ -27,7 +27,8 @@ const int IMMLO_BITS = 7; const int TARGET_BITS = 25; const int FUNCT_BITS = 3; const int FUNCTR_BITS = 7; -const int FFUNCT_BITS = 5; +const int FFUNCT_BITS = 2; +const int RM_BITS = 3; const int BIGIMM_BITS = 20; const int BRANCH_ALIGN_BITS = 1; const int JUMP_ALIGN_BITS = 1; @@ -47,8 +48,10 @@ const int JUMP_ALIGN_BITS = 1; #define FP_RD_0 1 #define FP_RD_DN 2 #define FP_RD_UP 3 +#define FP_RD_NMM 4 + #define FSR_RD_SHIFT 5 -#define FSR_RD (0x3 << FSR_RD_SHIFT) +#define FSR_RD (0x7 << FSR_RD_SHIFT) #define FPEXC_NX 0x01 #define FPEXC_UF 0x02 @@ -113,6 +116,7 @@ struct ftype_t { unsigned opcode : OPCODE_BITS; unsigned ffunct : FFUNCT_BITS; + unsigned rm : RM_BITS; unsigned rs3 : FPRID_BITS; unsigned rs2 : FPRID_BITS; unsigned rs1 : FPRID_BITS; @@ -171,7 +175,7 @@ private: #define TARGET insn.jtype.target #define BRANCH_TARGET (npc + (BIMM << BRANCH_ALIGN_BITS)) #define JUMP_TARGET (npc + (TARGET << JUMP_ALIGN_BITS)) -#define RM ((insn.ftype.ffunct & 4) ? (insn.ftype.ffunct & 3) : \ +#define RM ((insn.ftype.rm != 7) ? insn.ftype.rm : \ ((fsr & FSR_RD) >> FSR_RD_SHIFT)) #define require_supervisor if(!(sr & SR_S)) throw trap_privileged_instruction