}
if (xlen != bitwidth)
{
+ char *report = "";
uint64_t data = _insn->p->get_state()->XPR[reg];
uint64_t mask = ((1UL<<bitwidth)-1UL) << (shift*bitwidth);
wval = (uint64_t)(wval << (shift*bitwidth)); // element within reg-block
wval &= mask;
- uint64_t ndata = data & (uint64_t)(~mask); // masks off the right bits
- wval |= ndata;
- fprintf(stderr, "writereg %ld bitwidth %d offs %d shift %d %lx " \
+ uint64_t ndata = data;
+ if (spec.isvec) {
+ ndata = data & (uint64_t)(~mask); // masks off right bits
+ wval |= ndata;
+ } else {
+ if (_insn->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);