reg_t old = p->get_csr(csr);
p->set_csr(csr, insn.rs1());
#endif
-WRITE_RD(sext_xlen(old));
+WRITE_RD(sext_xlen(sv_reg_t(old)));
serialize();
require_extension('M');
-sreg_t lhs = sext_xlen(RS1);
-sreg_t rhs = sext_xlen(RS2);
-if(rhs == 0)
+sv_sreg_t lhs = sext_xlen(RS1);
+sv_sreg_t rhs = sext_xlen(RS2);
+if(rv_eq(rhs, sv_reg_t(0)))
WRITE_RD(UINT64_MAX);
-else if(lhs == INT64_MIN && rhs == -1)
+else if(lhs == INT64_MIN && rv_eq(rhs, sv_reg_t(-1UL)))
WRITE_RD(lhs);
else
WRITE_RD(sext_xlen(rv_div(lhs, rhs)));