From: Luke Kenneth Casson Leighton Date: Thu, 27 Jun 2019 10:58:04 +0000 (+0100) Subject: start using subvl to calculate offset. predication and stack pointer needed X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c5c2484d5e4135b68ea4fa08aedd165d34c4d1ca;p=riscv-isa-sim.git start using subvl to calculate offset. predication and stack pointer needed sub-offsets, one fake (predication does not use subvl), one real --- diff --git a/riscv/sv_decode.h b/riscv/sv_decode.h index 956653d..060aa3a 100644 --- a/riscv/sv_decode.h +++ b/riscv/sv_decode.h @@ -139,6 +139,7 @@ public: uint64_t get_if_one_reg_vectorised() { return at_least_one_reg_vectorised; } int *get_sp_offs() { return offs_sp; } + int *get_sp_subo() { return subo_sp; } private: bool vloop_continue; diff --git a/riscv/sv_insn_redirect.cc b/riscv/sv_insn_redirect.cc index ce48de7..988cfca 100644 --- a/riscv/sv_insn_redirect.cc +++ b/riscv/sv_insn_redirect.cc @@ -123,13 +123,20 @@ union freg_shift { unsigned int sv_proc_t::pred_remap(reg_t reg, int bit) { - reg_spec_t rs = {reg, &bit}; + int ignore_subvl = 0; // predication does not use subvl + reg_spec_t rs = {reg, &bit, &ignore_subvl}; return remap(rs, true); } unsigned int sv_proc_t::remap(reg_spec_t const& spec, bool pred) { unsigned int offs = *spec.offset; + unsigned int subo = *spec.suboff; + // this is where (after all the fuss, passing info around) the actual + // register offset is computed. if subvl is active, it's a multiplier + //fprintf(stderr, "remap %ld subvl %ld offs %ld subo %ld\n", + // spec.reg, p->get_state()->sv().subvl, offs, subo); + offs = offs * p->get_state()->sv().subvl + subo; sv_shape_t *shape = p->get_state()->get_shape(spec.reg, pred); if (shape == NULL) { return offs; @@ -399,7 +406,7 @@ GET_REG(rvc_rs2) sv_reg_t sv_proc_t::get_rvc_sp() { - return get_intreg({X_SP, _insn->get_sp_offs()}); + return get_intreg({X_SP, _insn->get_sp_offs(), _insn->get_sp_subo()}); } #define GET_FPREG(name, getter) \