-WRITE_RD(sext_xlen(rv_sl(RS1, rv_and(RS2, sv_reg_t(xlen-1)))));
+WRITE_RD(sext_xlen(rv_sl(RS1, RS2, xlen)));
}
sv_reg_t sv_proc_t::rv_sl(sv_reg_t const & lhs, sv_reg_t const & rhs)
+{
+ return rv_sl(lhs, rhs, xlen);
+}
+
+sv_reg_t sv_proc_t::rv_sl(sv_reg_t const & lhs, sv_reg_t const & rhs,
+ unsigned int dflt_bitwidth)
{
uint8_t bitwidth = _insn->src_bitwidth;
uint64_t vlhs = 0;
uint64_t vrhs = 0;
if (rv_int_op_prepare(lhs, rhs, vlhs, vrhs, bitwidth)) {
- return lhs << rhs;
+ return lhs << rv_and(rhs, sv_reg_t(dflt_bitwidth-1U));
}
- uint64_t result = vlhs << vrhs;
+ uint64_t result = vlhs << (vrhs & (bitwidth-1));
return rv_int_op_finish(lhs, rhs, result, bitwidth);
}
sv_reg_t rv_or(sv_reg_t const & lhs, sv_reg_t const & rhs);
sv_reg_t rv_xor(sv_reg_t const & lhs, sv_reg_t const & rhs);
sv_reg_t rv_sl(sv_reg_t const & lhs, sv_reg_t const & rhs);
+ sv_reg_t rv_sl(sv_reg_t const & lhs, sv_reg_t const & rhs,
+ unsigned int dflt_bitwidth);
sv_reg_t rv_sr(sv_reg_t const & lhs, sv_reg_t const & rhs);
sv_reg_t rv_sr(sv_reg_t const & lhs, sv_reg_t const & rhs,
unsigned int dflt_bitwidth);