From: Luke Kenneth Casson Leighton Date: Fri, 5 Oct 2018 14:26:20 +0000 (+0100) Subject: reorganise src and dest vector-element offsets X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c2ad2c176eab9bbeb6e384fa34d2b98618b95f83;p=riscv-isa-sim.git reorganise src and dest vector-element offsets pass in pointer to offsets from processor_t->state.srcoffs and destoffs into sv_insn_t so that the element state information about how many parallel elements have been executed is recorded. in this way it will be possible to restart a loop at the right place if there is an exception (such as a memory cache miss on a LOAD/STORE) --- diff --git a/riscv/insn_template_sv.cc b/riscv/insn_template_sv.cc index cab74d7..83b04d8 100644 --- a/riscv/insn_template_sv.cc +++ b/riscv/insn_template_sv.cc @@ -19,11 +19,11 @@ reg_t FN(processor_t* p, insn_t s_insn, reg_t pc) // REGS_PATTERN is generated by id_regs.py (per opcode) unsigned int floatintmap = REGS_PATTERN; reg_t dest_pred = ~0x0; - int dest_offs = 0; + int *dest_offs = &(p->get_state()->destoffs); bool zeroing = false; #ifdef INSN_CATEGORY_TWINPREDICATION reg_t src_pred = ~0x0; - int src_offs = 0; + int *src_offs = &(p->get_state()->srcoffs); bool zeroingsrc = false; #endif sv_insn_t insn(p, bits, floatintmap, PRED_ARGS, OFFS_ARGS); @@ -59,47 +59,47 @@ reg_t FN(processor_t* p, insn_t s_insn, reg_t pc) { insn.reset_vloop_check(); #ifdef INSN_CATEGORY_TWINPREDICATION - if (src_offs >= vlen) { + if (*src_offs >= vlen) { break; } - if (dest_offs >= vlen) { + if (*dest_offs >= vlen) { break; } #ifdef INSN_C_MV fprintf(stderr, "pre twin reg %s src %d dest %d pred %lx %lx\n", - xstr(INSN), src_offs, dest_offs, src_pred, dest_pred); + xstr(INSN), *src_offs, *dest_offs, src_pred, dest_pred); #endif if (!zeroingsrc) { - while ((src_pred & (1<= vlen) { + while ((src_pred & (1<<*src_offs)) == 0) { + *src_offs += 1; + if (*src_offs >= vlen) { break; } } } if (!zeroing) { - while ((dest_pred & (1<= vlen) { + while ((dest_pred & (1<<*dest_offs)) == 0) { + *dest_offs += 1; + if (*dest_offs >= vlen) { break; } } } - if (src_offs >= vlen || dest_offs >= vlen) { + if (*src_offs >= vlen || *dest_offs >= vlen) { break; // end vector loop if either src or dest pred reaches end } if (vlen > 1) { fprintf(stderr, "twin reg %s src %d dest %d pred %lx %lx\n", - xstr(INSN), src_offs, dest_offs, src_pred, dest_pred); + xstr(INSN), *src_offs, *dest_offs, src_pred, dest_pred); } #endif #ifdef INSN_C_MV fprintf(stderr, "pre loop reg %s %x vloop %d %d %d" \ "vlen %d stop %d pred %lx rdv %lx rd %d rvc2 %d\n", - xstr(INSN), INSNCODE, voffs, src_offs, dest_offs, + xstr(INSN), INSNCODE, voffs, *src_offs, *dest_offs, vlen, insn.stop_vloop(), dest_pred & (1<