reg_t imm_sign() { return int64_t(int32_t(b) >> 31); }
};
-template <class T>
-class write_port_t
-{
-public:
- write_port_t(T& _t) : t(_t) {}
- T& operator = (const T& rhs)
- {
- return t = rhs;
- }
- operator T()
- {
- return t;
- }
-private:
- T& t;
-};
template <class T, size_t N, bool zero_reg>
class regfile_t
{
{
memset(data, 0, sizeof(data));
}
- write_port_t<T> write_port(size_t i)
+ void write(size_t i, T value)
{
- if (zero_reg)
- const_cast<T&>(data[0]) = 0;
- return write_port_t<T>(data[i]);
+ data[i] = value;
}
const T& operator [] (size_t i) const
{
#define MMU (*p->get_mmu())
#define RS1 p->get_state()->XPR[insn.rs1()]
#define RS2 p->get_state()->XPR[insn.rs2()]
-#define RD p->get_state()->XPR.write_port(insn.rd())
+#define WRITE_RD(value) p->get_state()->XPR.write(insn.rd(), value)
#define FRS1 p->get_state()->FPR[insn.rs1()]
#define FRS2 p->get_state()->FPR[insn.rs2()]
#define FRS3 p->get_state()->FPR[insn.rs3()]
-#define FRD p->get_state()->FPR.write_port(insn.rd())
+#define WRITE_FRD(value) p->get_state()->FPR.write(insn.rd(), value)
#define SHAMT (insn.i_imm() & 0x3F)
#define BRANCH_TARGET (pc + insn.sb_imm())
#define JUMP_TARGET (pc + insn.uj_imm())
-RD = sext_xprlen(RS1 + RS2);
+WRITE_RD(sext_xprlen(RS1 + RS2));
-RD = sext_xprlen(RS1 + insn.i_imm());
+WRITE_RD(sext_xprlen(RS1 + insn.i_imm()));
require_xpr64;
-RD = sext32(insn.i_imm() + RS1);
+WRITE_RD(sext32(insn.i_imm() + RS1));
require_xpr64;
-RD = sext32(RS1 + RS2);
+WRITE_RD(sext32(RS1 + RS2));
require_xpr64;
reg_t v = MMU.load_uint64(RS1);
MMU.store_uint64(RS1, RS2 + v);
-RD = v;
+WRITE_RD(v);
reg_t v = MMU.load_int32(RS1);
MMU.store_uint32(RS1, RS2 + v);
-RD = v;
+WRITE_RD(v);
require_xpr64;
reg_t v = MMU.load_uint64(RS1);
MMU.store_uint64(RS1, RS2 & v);
-RD = v;
+WRITE_RD(v);
reg_t v = MMU.load_int32(RS1);
MMU.store_uint32(RS1, RS2 & v);
-RD = v;
+WRITE_RD(v);
require_xpr64;
sreg_t v = MMU.load_int64(RS1);
MMU.store_uint64(RS1, std::max(sreg_t(RS2),v));
-RD = v;
+WRITE_RD(v);
int32_t v = MMU.load_int32(RS1);
MMU.store_uint32(RS1, std::max(int32_t(RS2),v));
-RD = v;
+WRITE_RD(v);
require_xpr64;
reg_t v = MMU.load_uint64(RS1);
MMU.store_uint64(RS1, std::max(RS2,v));
-RD = v;
+WRITE_RD(v);
uint32_t v = MMU.load_int32(RS1);
MMU.store_uint32(RS1, std::max(uint32_t(RS2),v));
-RD = (int32_t)v;
+WRITE_RD((int32_t)v);
require_xpr64;
sreg_t v = MMU.load_int64(RS1);
MMU.store_uint64(RS1, std::min(sreg_t(RS2),v));
-RD = v;
+WRITE_RD(v);
int32_t v = MMU.load_int32(RS1);
MMU.store_uint32(RS1, std::min(int32_t(RS2),v));
-RD = v;
+WRITE_RD(v);
require_xpr64;
reg_t v = MMU.load_uint64(RS1);
MMU.store_uint64(RS1, std::min(RS2,v));
-RD = v;
+WRITE_RD(v);
uint32_t v = MMU.load_int32(RS1);
MMU.store_uint32(RS1, std::min(uint32_t(RS2),v));
-RD = (int32_t)v;
+WRITE_RD((int32_t)v);
require_xpr64;
reg_t v = MMU.load_uint64(RS1);
MMU.store_uint64(RS1, RS2 | v);
-RD = v;
+WRITE_RD(v);
reg_t v = MMU.load_int32(RS1);
MMU.store_uint32(RS1, RS2 | v);
-RD = v;
+WRITE_RD(v);
require_xpr64;
reg_t v = MMU.load_uint64(RS1);
MMU.store_uint64(RS1, RS2);
-RD = v;
+WRITE_RD(v);
reg_t v = MMU.load_int32(RS1);
MMU.store_uint32(RS1, RS2);
-RD = v;
+WRITE_RD(v);
require_xpr64;
reg_t v = MMU.load_uint64(RS1);
MMU.store_uint64(RS1, RS2 ^ v);
-RD = v;
+WRITE_RD(v);
reg_t v = MMU.load_int32(RS1);
MMU.store_uint32(RS1, RS2 ^ v);
-RD = v;
+WRITE_RD(v);
-RD = RS1 & RS2;
+WRITE_RD(RS1 & RS2);
-RD = insn.i_imm() & RS1;
+WRITE_RD(insn.i_imm() & RS1);
-RD = sext_xprlen(insn.u_imm() + (pc >> 12 << 12));
+WRITE_RD(sext_xprlen(insn.u_imm() + (pc >> 12 << 12)));
require_supervisor;
-RD = p->set_pcr(insn.rs1(), p->get_pcr(insn.rs1()) & ~insn.i_imm());
+WRITE_RD(p->set_pcr(insn.rs1(), p->get_pcr(insn.rs1()) & ~insn.i_imm()));
sreg_t lhs = sext_xprlen(RS1);
sreg_t rhs = sext_xprlen(RS2);
if(rhs == 0)
- RD = UINT64_MAX;
+ WRITE_RD(UINT64_MAX);
else if(lhs == INT64_MIN && rhs == -1)
- RD = lhs;
+ WRITE_RD(lhs);
else
- RD = sext_xprlen(lhs / rhs);
+ WRITE_RD(sext_xprlen(lhs / rhs));
reg_t lhs = zext_xprlen(RS1);
reg_t rhs = zext_xprlen(RS2);
if(rhs == 0)
- RD = UINT64_MAX;
+ WRITE_RD(UINT64_MAX);
else
- RD = sext_xprlen(lhs / rhs);
+ WRITE_RD(sext_xprlen(lhs / rhs));
reg_t lhs = zext32(RS1);
reg_t rhs = zext32(RS2);
if(rhs == 0)
- RD = UINT64_MAX;
+ WRITE_RD(UINT64_MAX);
else
- RD = sext32(lhs / rhs);
+ WRITE_RD(sext32(lhs / rhs));
sreg_t lhs = sext32(RS1);
sreg_t rhs = sext32(RS2);
if(rhs == 0)
- RD = UINT64_MAX;
+ WRITE_RD(UINT64_MAX);
else
- RD = sext32(lhs / rhs);
+ WRITE_RD(sext32(lhs / rhs));
require_fp;
softfloat_roundingMode = RM;
-FRD = f64_mulAdd(FRS1, 0x3ff0000000000000ULL, FRS2);
+WRITE_FRD(f64_mulAdd(FRS1, 0x3ff0000000000000ULL, FRS2));
set_fp_exceptions;
require_fp;
softfloat_roundingMode = RM;
-FRD = f32_mulAdd(FRS1, 0x3f800000, FRS2);
+WRITE_FRD(f32_mulAdd(FRS1, 0x3f800000, FRS2));
set_fp_exceptions;
require_xpr64;
require_fp;
softfloat_roundingMode = RM;
-FRD = i64_to_f64(RS1);
+WRITE_FRD(i64_to_f64(RS1));
set_fp_exceptions;
require_xpr64;
require_fp;
softfloat_roundingMode = RM;
-FRD = ui64_to_f64(RS1);
+WRITE_FRD(ui64_to_f64(RS1));
set_fp_exceptions;
require_fp;
softfloat_roundingMode = RM;
-FRD = f32_to_f64(FRS1);
+WRITE_FRD(f32_to_f64(FRS1));
set_fp_exceptions;
require_fp;
softfloat_roundingMode = RM;
-FRD = i32_to_f64((int32_t)RS1);
+WRITE_FRD(i32_to_f64((int32_t)RS1));
set_fp_exceptions;
require_fp;
softfloat_roundingMode = RM;
-FRD = ui32_to_f64((uint32_t)RS1);
+WRITE_FRD(ui32_to_f64((uint32_t)RS1));
set_fp_exceptions;
require_xpr64;
require_fp;
softfloat_roundingMode = RM;
-RD = f64_to_i64(FRS1, RM, true);
+WRITE_RD(f64_to_i64(FRS1, RM, true));
set_fp_exceptions;
require_xpr64;
require_fp;
softfloat_roundingMode = RM;
-RD = f32_to_i64(FRS1, RM, true);
+WRITE_RD(f32_to_i64(FRS1, RM, true));
set_fp_exceptions;
require_xpr64;
require_fp;
softfloat_roundingMode = RM;
-RD = f64_to_ui64(FRS1, RM, true);
+WRITE_RD(f64_to_ui64(FRS1, RM, true));
set_fp_exceptions;
require_xpr64;
require_fp;
softfloat_roundingMode = RM;
-RD = f32_to_ui64(FRS1, RM, true);
+WRITE_RD(f32_to_ui64(FRS1, RM, true));
set_fp_exceptions;
require_fp;
softfloat_roundingMode = RM;
-FRD = f64_to_f32(FRS1);
+WRITE_FRD(f64_to_f32(FRS1));
set_fp_exceptions;
require_xpr64;
require_fp;
softfloat_roundingMode = RM;
-FRD = i64_to_f32(RS1);
+WRITE_FRD(i64_to_f32(RS1));
set_fp_exceptions;
require_xpr64;
require_fp;
softfloat_roundingMode = RM;
-FRD = ui64_to_f32(RS1);
+WRITE_FRD(ui64_to_f32(RS1));
set_fp_exceptions;
require_fp;
softfloat_roundingMode = RM;
-FRD = i32_to_f32((int32_t)RS1);
+WRITE_FRD(i32_to_f32((int32_t)RS1));
set_fp_exceptions;
require_fp;
softfloat_roundingMode = RM;
-FRD = ui32_to_f32((uint32_t)RS1);
+WRITE_FRD(ui32_to_f32((uint32_t)RS1));
set_fp_exceptions;
require_fp;
softfloat_roundingMode = RM;
-RD = sext32(f64_to_i32(FRS1, RM, true));
+WRITE_RD(sext32(f64_to_i32(FRS1, RM, true)));
set_fp_exceptions;
require_fp;
softfloat_roundingMode = RM;
-RD = sext32(f32_to_i32(FRS1, RM, true));
+WRITE_RD(sext32(f32_to_i32(FRS1, RM, true)));
set_fp_exceptions;
require_fp;
softfloat_roundingMode = RM;
-RD = sext32(f64_to_ui32(FRS1, RM, true));
+WRITE_RD(sext32(f64_to_ui32(FRS1, RM, true)));
set_fp_exceptions;
require_fp;
softfloat_roundingMode = RM;
-RD = sext32(f32_to_ui32(FRS1, RM, true));
+WRITE_RD(sext32(f32_to_ui32(FRS1, RM, true)));
set_fp_exceptions;
require_fp;
softfloat_roundingMode = RM;
-FRD = f64_div(FRS1, FRS2);
+WRITE_FRD(f64_div(FRS1, FRS2));
set_fp_exceptions;
require_fp;
softfloat_roundingMode = RM;
-FRD = f32_div(FRS1, FRS2);
+WRITE_FRD(f32_div(FRS1, FRS2));
set_fp_exceptions;
require_fp;
-RD = f64_eq(FRS1, FRS2);
+WRITE_RD(f64_eq(FRS1, FRS2));
set_fp_exceptions;
require_fp;
-RD = f32_eq(FRS1, FRS2);
+WRITE_RD(f32_eq(FRS1, FRS2));
set_fp_exceptions;
require_fp;
-FRD = MMU.load_int64(RS1 + insn.i_imm());
+WRITE_FRD(MMU.load_int64(RS1 + insn.i_imm()));
require_fp;
-RD = f64_le(FRS1, FRS2);
+WRITE_RD(f64_le(FRS1, FRS2));
set_fp_exceptions;
require_fp;
-RD = f32_le(FRS1, FRS2);
+WRITE_RD(f32_le(FRS1, FRS2));
set_fp_exceptions;
require_fp;
-RD = f64_lt(FRS1, FRS2);
+WRITE_RD(f64_lt(FRS1, FRS2));
set_fp_exceptions;
require_fp;
-RD = f32_lt(FRS1, FRS2);
+WRITE_RD(f32_lt(FRS1, FRS2));
set_fp_exceptions;
require_fp;
-FRD = MMU.load_int32(RS1 + insn.i_imm());
+WRITE_FRD(MMU.load_int32(RS1 + insn.i_imm()));
require_fp;
softfloat_roundingMode = RM;
-FRD = f64_mulAdd(FRS1, FRS2, FRS3);
+WRITE_FRD(f64_mulAdd(FRS1, FRS2, FRS3));
set_fp_exceptions;
require_fp;
softfloat_roundingMode = RM;
-FRD = f32_mulAdd(FRS1, FRS2, FRS3);
+WRITE_FRD(f32_mulAdd(FRS1, FRS2, FRS3));
set_fp_exceptions;
require_fp;
-FRD = isNaNF64UI(FRS2) || f64_le_quiet(FRS2,FRS1) /* && FRS1 not NaN */
- ? FRS1 : FRS2;
+WRITE_FRD(isNaNF64UI(FRS2) || f64_le_quiet(FRS2,FRS1) /* && FRS1 not NaN */
+ ? FRS1 : FRS2);
set_fp_exceptions;
require_fp;
-FRD = isNaNF32UI(FRS2) || f32_le_quiet(FRS2,FRS1) /* && FRS1 not NaN */
- ? FRS1 : FRS2;
+WRITE_FRD(isNaNF32UI(FRS2) || f32_le_quiet(FRS2,FRS1) /* && FRS1 not NaN */
+ ? FRS1 : FRS2);
set_fp_exceptions;
require_fp;
-FRD = isNaNF64UI(FRS2) || f64_lt_quiet(FRS1,FRS2) /* && FRS1 not NaN */
- ? FRS1 : FRS2;
+WRITE_FRD(isNaNF64UI(FRS2) || f64_lt_quiet(FRS1,FRS2) /* && FRS1 not NaN */
+ ? FRS1 : FRS2);
set_fp_exceptions;
require_fp;
-FRD = isNaNF32UI(FRS2) || f32_lt_quiet(FRS1,FRS2) /* && FRS1 not NaN */
- ? FRS1 : FRS2;
+WRITE_FRD(isNaNF32UI(FRS2) || f32_lt_quiet(FRS1,FRS2) /* && FRS1 not NaN */
+ ? FRS1 : FRS2);
set_fp_exceptions;
require_fp;
softfloat_roundingMode = RM;
-FRD = f64_mulAdd(FRS1, FRS2, FRS3 ^ (uint64_t)INT64_MIN);
+WRITE_FRD(f64_mulAdd(FRS1, FRS2, FRS3 ^ (uint64_t)INT64_MIN));
set_fp_exceptions;
require_fp;
softfloat_roundingMode = RM;
-FRD = f32_mulAdd(FRS1, FRS2, FRS3 ^ (uint32_t)INT32_MIN);
+WRITE_FRD(f32_mulAdd(FRS1, FRS2, FRS3 ^ (uint32_t)INT32_MIN));
set_fp_exceptions;
require_fp;
softfloat_roundingMode = RM;
-FRD = f64_mulAdd(FRS1, FRS2, (FRS1 ^ FRS2) & (uint64_t)INT64_MIN);
+WRITE_FRD(f64_mulAdd(FRS1, FRS2, (FRS1 ^ FRS2) & (uint64_t)INT64_MIN));
set_fp_exceptions;
require_fp;
softfloat_roundingMode = RM;
-FRD = f32_mulAdd(FRS1, FRS2, (FRS1 ^ FRS2) & (uint32_t)INT32_MIN);
+WRITE_FRD(f32_mulAdd(FRS1, FRS2, (FRS1 ^ FRS2) & (uint32_t)INT32_MIN));
set_fp_exceptions;
require_xpr64;
require_fp;
-FRD = RS1;
+WRITE_FRD(RS1);
require_fp;
-FRD = RS1;
+WRITE_FRD(RS1);
require_xpr64;
require_fp;
-RD = FRS1;
+WRITE_RD(FRS1);
require_fp;
-RD = sext32(FRS1);
+WRITE_RD(sext32(FRS1));
require_fp;
softfloat_roundingMode = RM;
-FRD = f64_mulAdd(FRS1 ^ (uint64_t)INT64_MIN, FRS2, FRS3 ^ (uint64_t)INT64_MIN);
+WRITE_FRD(f64_mulAdd(FRS1 ^ (uint64_t)INT64_MIN, FRS2, FRS3 ^ (uint64_t)INT64_MIN));
set_fp_exceptions;
require_fp;
softfloat_roundingMode = RM;
-FRD = f32_mulAdd(FRS1 ^ (uint32_t)INT32_MIN, FRS2, FRS3 ^ (uint32_t)INT32_MIN);
+WRITE_FRD(f32_mulAdd(FRS1 ^ (uint32_t)INT32_MIN, FRS2, FRS3 ^ (uint32_t)INT32_MIN));
set_fp_exceptions;
require_fp;
softfloat_roundingMode = RM;
-FRD = f64_mulAdd(FRS1 ^ (uint64_t)INT64_MIN, FRS2, FRS3);
+WRITE_FRD(f64_mulAdd(FRS1 ^ (uint64_t)INT64_MIN, FRS2, FRS3));
set_fp_exceptions;
require_fp;
softfloat_roundingMode = RM;
-FRD = f32_mulAdd(FRS1 ^ (uint32_t)INT32_MIN, FRS2, FRS3);
+WRITE_FRD(f32_mulAdd(FRS1 ^ (uint32_t)INT32_MIN, FRS2, FRS3));
set_fp_exceptions;
require_fp;
-RD = p->get_fsr();
+WRITE_RD(p->get_fsr());
require_fp;
-FRD = (FRS1 &~ INT64_MIN) | (FRS2 & INT64_MIN);
+WRITE_FRD((FRS1 &~ INT64_MIN) | (FRS2 & INT64_MIN));
require_fp;
-FRD = (FRS1 &~ (uint32_t)INT32_MIN) | (FRS2 & (uint32_t)INT32_MIN);
+WRITE_FRD((FRS1 &~ (uint32_t)INT32_MIN) | (FRS2 & (uint32_t)INT32_MIN));
require_fp;
-FRD = (FRS1 &~ INT64_MIN) | ((~FRS2) & INT64_MIN);
+WRITE_FRD((FRS1 &~ INT64_MIN) | ((~FRS2) & INT64_MIN));
require_fp;
-FRD = (FRS1 &~ (uint32_t)INT32_MIN) | ((~FRS2) & (uint32_t)INT32_MIN);
+WRITE_FRD((FRS1 &~ (uint32_t)INT32_MIN) | ((~FRS2) & (uint32_t)INT32_MIN));
require_fp;
-FRD = FRS1 ^ (FRS2 & INT64_MIN);
+WRITE_FRD(FRS1 ^ (FRS2 & INT64_MIN));
require_fp;
-FRD = FRS1 ^ (FRS2 & (uint32_t)INT32_MIN);
+WRITE_FRD(FRS1 ^ (FRS2 & (uint32_t)INT32_MIN));
require_fp;
softfloat_roundingMode = RM;
-FRD = f64_sqrt(FRS1);
+WRITE_FRD(f64_sqrt(FRS1));
set_fp_exceptions;
require_fp;
softfloat_roundingMode = RM;
-FRD = f32_sqrt(FRS1);
+WRITE_FRD(f32_sqrt(FRS1));
set_fp_exceptions;
require_fp;
-RD = p->set_fsr(RS1);
+WRITE_RD(p->set_fsr(RS1));
require_fp;
softfloat_roundingMode = RM;
-FRD = f64_mulAdd(FRS1, 0x3ff0000000000000ULL, FRS2 ^ (uint64_t)INT64_MIN);
+WRITE_FRD(f64_mulAdd(FRS1, 0x3ff0000000000000ULL, FRS2 ^ (uint64_t)INT64_MIN));
set_fp_exceptions;
require_fp;
softfloat_roundingMode = RM;
-FRD = f32_mulAdd(FRS1, 0x3f800000, FRS2 ^ (uint32_t)INT32_MIN);
+WRITE_FRD(f32_mulAdd(FRS1, 0x3f800000, FRS2 ^ (uint32_t)INT32_MIN));
set_fp_exceptions;
-RD = npc;
+WRITE_RD(npc);
set_pc(JUMP_TARGET);
reg_t temp = RS1;
-RD = npc;
+WRITE_RD(npc);
set_pc((temp + insn.i_imm()) & ~1);
-RD = MMU.load_int8(RS1 + insn.i_imm());
+WRITE_RD(MMU.load_int8(RS1 + insn.i_imm()));
-RD = MMU.load_uint8(RS1 + insn.i_imm());
+WRITE_RD(MMU.load_uint8(RS1 + insn.i_imm()));
require_xpr64;
-RD = MMU.load_int64(RS1 + insn.i_imm());
+WRITE_RD(MMU.load_int64(RS1 + insn.i_imm()));
-RD = MMU.load_int16(RS1 + insn.i_imm());
+WRITE_RD(MMU.load_int16(RS1 + insn.i_imm()));
-RD = MMU.load_uint16(RS1 + insn.i_imm());
+WRITE_RD(MMU.load_uint16(RS1 + insn.i_imm()));
require_xpr64;
p->get_state()->load_reservation = RS1;
-RD = MMU.load_int64(RS1);
+WRITE_RD(MMU.load_int64(RS1));
p->get_state()->load_reservation = RS1;
-RD = MMU.load_int32(RS1);
+WRITE_RD(MMU.load_int32(RS1));
-RD = insn.u_imm();
+WRITE_RD(insn.u_imm());
-RD = MMU.load_int32(RS1 + insn.i_imm());
+WRITE_RD(MMU.load_int32(RS1 + insn.i_imm()));
require_xpr64;
-RD = MMU.load_uint32(RS1 + insn.i_imm());
+WRITE_RD(MMU.load_uint32(RS1 + insn.i_imm()));
require_supervisor;
-RD = p->get_pcr(insn.rs1());
+WRITE_RD(p->get_pcr(insn.rs1()));
require_supervisor;
-RD = p->set_pcr(insn.rs1(), RS2);
+WRITE_RD(p->set_pcr(insn.rs1(), RS2));
-RD = sext_xprlen(RS1 * RS2);
+WRITE_RD(sext_xprlen(RS1 * RS2));
{
int64_t a = RS1;
int64_t b = RS2;
- RD = (int128_t(a) * int128_t(b)) >> 64;
+ WRITE_RD((int128_t(a) * int128_t(b)) >> 64);
}
else
- RD = sext32((sext32(RS1) * sext32(RS2)) >> 32);
+ WRITE_RD(sext32((sext32(RS1) * sext32(RS2)) >> 32));
{
int64_t a = RS1;
uint64_t b = RS2;
- RD = (int128_t(a) * uint128_t(b)) >> 64;
+ WRITE_RD((int128_t(a) * uint128_t(b)) >> 64);
}
else
- RD = sext32((sext32(RS1) * reg_t((uint32_t)RS2)) >> 32);
+ WRITE_RD(sext32((sext32(RS1) * reg_t((uint32_t)RS2)) >> 32));
if(xpr64)
- RD = (uint128_t(RS1) * uint128_t(RS2)) >> 64;
+ WRITE_RD((uint128_t(RS1) * uint128_t(RS2)) >> 64);
else
- RD = sext32(((uint64_t)(uint32_t)RS1 * (uint64_t)(uint32_t)RS2) >> 32);
+ WRITE_RD(sext32(((uint64_t)(uint32_t)RS1 * (uint64_t)(uint32_t)RS2) >> 32));
require_xpr64;
-RD = sext32(RS1 * RS2);
+WRITE_RD(sext32(RS1 * RS2));
-RD = RS1 | RS2;
+WRITE_RD(RS1 | RS2);
-RD = insn.i_imm() | RS1;
+WRITE_RD(insn.i_imm() | RS1);
-RD = sext_xprlen(p->get_state()->cycle);
+WRITE_RD(sext_xprlen(p->get_state()->cycle));
sreg_t lhs = sext_xprlen(RS1);
sreg_t rhs = sext_xprlen(RS2);
if(rhs == 0)
- RD = lhs;
+ WRITE_RD(lhs);
else if(lhs == INT64_MIN && rhs == -1)
- RD = 0;
+ WRITE_RD(0);
else
- RD = sext_xprlen(lhs % rhs);
+ WRITE_RD(sext_xprlen(lhs % rhs));
reg_t lhs = zext_xprlen(RS1);
reg_t rhs = zext_xprlen(RS2);
if(rhs == 0)
- RD = sext_xprlen(RS1);
+ WRITE_RD(sext_xprlen(RS1));
else
- RD = sext_xprlen(lhs % rhs);
+ WRITE_RD(sext_xprlen(lhs % rhs));
reg_t lhs = zext32(RS1);
reg_t rhs = zext32(RS2);
if(rhs == 0)
- RD = sext32(lhs);
+ WRITE_RD(sext32(lhs));
else
- RD = sext32(lhs % rhs);
+ WRITE_RD(sext32(lhs % rhs));
sreg_t lhs = sext32(RS1);
sreg_t rhs = sext32(RS2);
if(rhs == 0)
- RD = lhs;
+ WRITE_RD(lhs);
else
- RD = sext32(lhs % rhs);
+ WRITE_RD(sext32(lhs % rhs));
if (RS1 == p->get_state()->load_reservation)
{
MMU.store_uint64(RS1, RS2);
- RD = 0;
+ WRITE_RD(0);
}
else
- RD = 1;
+ WRITE_RD(1);
if (RS1 == p->get_state()->load_reservation)
{
MMU.store_uint32(RS1, RS2);
- RD = 0;
+ WRITE_RD(0);
}
else
- RD = 1;
+ WRITE_RD(1);
require_supervisor;
-RD = p->set_pcr(insn.rs1(), p->get_pcr(insn.rs1()) | insn.i_imm());
+WRITE_RD(p->set_pcr(insn.rs1(), p->get_pcr(insn.rs1()) | insn.i_imm()));
-RD = sext_xprlen(RS1 << (RS2 & (xprlen-1)));
+WRITE_RD(sext_xprlen(RS1 << (RS2 & (xprlen-1))));
if(xpr64)
- RD = RS1 << SHAMT;
+ WRITE_RD(RS1 << SHAMT);
else
{
if(SHAMT & 0x20)
throw trap_illegal_instruction();
- RD = sext32(RS1 << SHAMT);
+ WRITE_RD(sext32(RS1 << SHAMT));
}
require_xpr64;
-RD = sext32(RS1 << SHAMT);
+WRITE_RD(sext32(RS1 << SHAMT));
require_xpr64;
-RD = sext32(RS1 << (RS2 & 0x1F));
+WRITE_RD(sext32(RS1 << (RS2 & 0x1F)));
-RD = sreg_t(cmp_trunc(RS1)) < sreg_t(cmp_trunc(RS2));
+WRITE_RD(sreg_t(cmp_trunc(RS1)) < sreg_t(cmp_trunc(RS2)));
-RD = sreg_t(cmp_trunc(RS1)) < sreg_t(cmp_trunc(insn.i_imm()));
+WRITE_RD(sreg_t(cmp_trunc(RS1)) < sreg_t(cmp_trunc(insn.i_imm())));
-RD = cmp_trunc(RS1) < cmp_trunc(insn.i_imm());
+WRITE_RD(cmp_trunc(RS1) < cmp_trunc(insn.i_imm()));
-RD = cmp_trunc(RS1) < cmp_trunc(RS2);
+WRITE_RD(cmp_trunc(RS1) < cmp_trunc(RS2));
-RD = sext_xprlen(sext_xprlen(RS1) >> (RS2 & (xprlen-1)));
+WRITE_RD(sext_xprlen(sext_xprlen(RS1) >> (RS2 & (xprlen-1))));
if(xpr64)
- RD = sreg_t(RS1) >> SHAMT;
+ WRITE_RD(sreg_t(RS1) >> SHAMT);
else
{
if(SHAMT & 0x20)
throw trap_illegal_instruction();
- RD = sext32(int32_t(RS1) >> SHAMT);
+ WRITE_RD(sext32(int32_t(RS1) >> SHAMT));
}
require_xpr64;
-RD = sext32(int32_t(RS1) >> SHAMT);
+WRITE_RD(sext32(int32_t(RS1) >> SHAMT));
require_xpr64;
-RD = sext32(int32_t(RS1) >> (RS2 & 0x1F));
+WRITE_RD(sext32(int32_t(RS1) >> (RS2 & 0x1F)));
if(xpr64)
- RD = RS1 >> (RS2 & 0x3F);
+ WRITE_RD(RS1 >> (RS2 & 0x3F));
else
- RD = sext32((uint32_t)RS1 >> (RS2 & 0x1F));
+ WRITE_RD(sext32((uint32_t)RS1 >> (RS2 & 0x1F)));
if(xpr64)
- RD = RS1 >> SHAMT;
+ WRITE_RD(RS1 >> SHAMT);
else
{
if(SHAMT & 0x20)
throw trap_illegal_instruction();
- RD = sext32((uint32_t)RS1 >> SHAMT);
+ WRITE_RD(sext32((uint32_t)RS1 >> SHAMT));
}
require_xpr64;
-RD = sext32((uint32_t)RS1 >> SHAMT);
+WRITE_RD(sext32((uint32_t)RS1 >> SHAMT));
require_xpr64;
-RD = sext32((uint32_t)RS1 >> (RS2 & 0x1F));
+WRITE_RD(sext32((uint32_t)RS1 >> (RS2 & 0x1F)));
-RD = sext_xprlen(RS1 - RS2);
+WRITE_RD(sext_xprlen(RS1 - RS2));
require_xpr64;
-RD = sext32(RS1 - RS2);
+WRITE_RD(sext32(RS1 - RS2));
-RD = RS1 ^ RS2;
+WRITE_RD(RS1 ^ RS2);
-RD = insn.i_imm() ^ RS1;
+WRITE_RD(insn.i_imm() ^ RS1);
reg_t xs2 = u.r.xs1 ? RS2 : -1; \
reg_t xd = rocc->custom##n(u.r, xs1, xs2); \
if (u.r.xd) \
- RD = xd; \
+ WRITE_RD(xd); \
return pc+4; \
} \
\