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));
+ int xlen = 64;
+ reg_t npc = sext_xlen(pc + insn_length(OPCODE));
hwacha_t* h = static_cast<hwacha_t*>(p->get_extension());
rocc_insn_union_t u;
u.i = insn;
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));
+ int xlen = 64;
+ reg_t npc = sext_xlen(pc + insn_length(OPCODE));
hwacha_t* h = static_cast<hwacha_t*>(p->get_extension());
do {
#include "insns_ut/NAME.h"
if(rm > 4) throw trap_illegal_instruction(); \
rm; })
-#define xpr64 (xprlen == 64)
+#define xpr64 (xlen == 64)
#define require_supervisor if(unlikely(!(STATE.sr & SR_S))) throw trap_privileged_instruction()
#define require_xpr64 if(unlikely(!xpr64)) throw trap_illegal_instruction()
#endif
#define require_accelerator if(unlikely(!(STATE.sr & SR_EA))) throw trap_accelerator_disabled()
-#define cmp_trunc(reg) (reg_t(reg) << (64-xprlen))
+#define cmp_trunc(reg) (reg_t(reg) << (64-xlen))
#define set_fp_exceptions ({ STATE.fflags |= softfloat_exceptionFlags; \
softfloat_exceptionFlags = 0; })
#define sext32(x) ((sreg_t)(int32_t)(x))
#define zext32(x) ((reg_t)(uint32_t)(x))
-#define sext_xprlen(x) (((sreg_t)(x) << (64-xprlen)) >> (64-xprlen))
-#define zext_xprlen(x) (((reg_t)(x) << (64-xprlen)) >> (64-xprlen))
+#define sext_xlen(x) (((sreg_t)(x) << (64-xlen)) >> (64-xlen))
+#define zext_xlen(x) (((reg_t)(x) << (64-xlen)) >> (64-xlen))
-#define set_pc(x) (npc = sext_xprlen(x))
+#define set_pc(x) (npc = sext_xlen(x))
#define validate_csr(which, write) ({ \
unsigned my_priv = (STATE.sr & SR_S) ? 1 : 0; \
reg_t rv32_NAME(processor_t* p, insn_t insn, reg_t pc)
{
- int xprlen = 32;
- reg_t npc = sext_xprlen(pc + insn_length(OPCODE));
+ int xlen = 32;
+ reg_t npc = sext_xlen(pc + insn_length(OPCODE));
#include "insns/NAME.h"
return npc;
}
reg_t rv64_NAME(processor_t* p, insn_t insn, reg_t pc)
{
- int xprlen = 64;
- reg_t npc = sext_xprlen(pc + insn_length(OPCODE));
+ int xlen = 64;
+ reg_t npc = sext_xlen(pc + insn_length(OPCODE));
#include "insns/NAME.h"
return npc;
}
-WRITE_RD(sext_xprlen(RS1 + RS2));
+WRITE_RD(sext_xlen(RS1 + RS2));
-WRITE_RD(sext_xprlen(RS1 + insn.i_imm()));
+WRITE_RD(sext_xlen(RS1 + insn.i_imm()));
-WRITE_RD(sext_xprlen(insn.u_imm() + pc));
+WRITE_RD(sext_xlen(insn.u_imm() + pc));
int csr = validate_csr(insn.csr(), true);
reg_t old = p->get_pcr(csr);
p->set_pcr(csr, old & ~RS1);
-WRITE_RD(sext_xprlen(old));
+WRITE_RD(sext_xlen(old));
int csr = validate_csr(insn.csr(), true);
reg_t old = p->get_pcr(csr);
p->set_pcr(csr, old & ~(reg_t)insn.rs1());
-WRITE_RD(sext_xprlen(old));
+WRITE_RD(sext_xlen(old));
int csr = validate_csr(insn.csr(), insn.rs1() != 0);
reg_t old = p->get_pcr(csr);
p->set_pcr(csr, old | RS1);
-WRITE_RD(sext_xprlen(old));
+WRITE_RD(sext_xlen(old));
int csr = validate_csr(insn.csr(), true);
reg_t old = p->get_pcr(csr);
p->set_pcr(csr, old | insn.rs1());
-WRITE_RD(sext_xprlen(old));
+WRITE_RD(sext_xlen(old));
int csr = validate_csr(insn.csr(), true);
reg_t old = p->get_pcr(csr);
p->set_pcr(csr, RS1);
-WRITE_RD(sext_xprlen(old));
+WRITE_RD(sext_xlen(old));
int csr = validate_csr(insn.csr(), true);
reg_t old = p->get_pcr(csr);
p->set_pcr(csr, insn.rs1());
-WRITE_RD(sext_xprlen(old));
+WRITE_RD(sext_xlen(old));
-sreg_t lhs = sext_xprlen(RS1);
-sreg_t rhs = sext_xprlen(RS2);
+sreg_t lhs = sext_xlen(RS1);
+sreg_t rhs = sext_xlen(RS2);
if(rhs == 0)
WRITE_RD(UINT64_MAX);
else if(lhs == INT64_MIN && rhs == -1)
WRITE_RD(lhs);
else
- WRITE_RD(sext_xprlen(lhs / rhs));
+ WRITE_RD(sext_xlen(lhs / rhs));
-reg_t lhs = zext_xprlen(RS1);
-reg_t rhs = zext_xprlen(RS2);
+reg_t lhs = zext_xlen(RS1);
+reg_t rhs = zext_xlen(RS2);
if(rhs == 0)
WRITE_RD(UINT64_MAX);
else
- WRITE_RD(sext_xprlen(lhs / rhs));
+ WRITE_RD(sext_xlen(lhs / rhs));
-WRITE_RD(sext_xprlen(RS1 * RS2));
+WRITE_RD(sext_xlen(RS1 * RS2));
-sreg_t lhs = sext_xprlen(RS1);
-sreg_t rhs = sext_xprlen(RS2);
+sreg_t lhs = sext_xlen(RS1);
+sreg_t rhs = sext_xlen(RS2);
if(rhs == 0)
WRITE_RD(lhs);
else if(lhs == INT64_MIN && rhs == -1)
WRITE_RD(0);
else
- WRITE_RD(sext_xprlen(lhs % rhs));
+ WRITE_RD(sext_xlen(lhs % rhs));
-reg_t lhs = zext_xprlen(RS1);
-reg_t rhs = zext_xprlen(RS2);
+reg_t lhs = zext_xlen(RS1);
+reg_t rhs = zext_xlen(RS2);
if(rhs == 0)
- WRITE_RD(sext_xprlen(RS1));
+ WRITE_RD(sext_xlen(RS1));
else
- WRITE_RD(sext_xprlen(lhs % rhs));
+ WRITE_RD(sext_xlen(lhs % rhs));
-WRITE_RD(sext_xprlen(RS1 << (RS2 & (xprlen-1))));
+WRITE_RD(sext_xlen(RS1 << (RS2 & (xlen-1))));
-WRITE_RD(sext_xprlen(sext_xprlen(RS1) >> (RS2 & (xprlen-1))));
+WRITE_RD(sext_xlen(sext_xlen(RS1) >> (RS2 & (xlen-1))));
-WRITE_RD(sext_xprlen(RS1 - RS2));
+WRITE_RD(sext_xlen(RS1 - RS2));