From 2290b373d832c220d3381ff9ec1a0048513df160 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Tue, 30 Oct 2018 06:09:20 +0000 Subject: [PATCH] on scalar operation, sign-extend / zero-extend to full reg width --- riscv/sv_insn_redirect.cc | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/riscv/sv_insn_redirect.cc b/riscv/sv_insn_redirect.cc index d80fb08..684952f 100644 --- a/riscv/sv_insn_redirect.cc +++ b/riscv/sv_insn_redirect.cc @@ -84,15 +84,27 @@ void (sv_proc_t::WRITE_REG)(reg_spec_t const& spec, sv_reg_t const& value) } if (xlen != bitwidth) { + char *report = ""; uint64_t data = _insn->p->get_state()->XPR[reg]; uint64_t mask = ((1UL<signextended) { + wval = sext_bwid(wval, bitwidth); + report = "s"; + } else { + wval = zext_bwid(wval, bitwidth); + report = "z"; + } + } + fprintf(stderr, "writereg %s %ld bitwidth %d offs %d shift %d %lx " \ " %lx %lx %lx\n", - spec.reg, bitwidth, offs, shift, data, + report, spec.reg, bitwidth, offs, shift, data, ndata, mask, wval); } STATE.XPR.write(reg, wval); -- 2.30.2