From: Luke Kenneth Casson Leighton Date: Sat, 3 Nov 2018 10:57:49 +0000 (+0000) Subject: add stub "remap" of register offsets X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3e9bf3119ad8a9353fd12c1db1d8f4bc02867d7d;p=riscv-isa-sim.git add stub "remap" of register offsets --- diff --git a/riscv/sv_insn_redirect.cc b/riscv/sv_insn_redirect.cc index c4d5b9e..a4ca88a 100644 --- a/riscv/sv_insn_redirect.cc +++ b/riscv/sv_insn_redirect.cc @@ -118,6 +118,16 @@ union freg_shift { uint8_t b[sizeof(freg_t)*8]; }; +unsigned int sv_proc_t::remap(reg_spec_t const& spec) +{ + unsigned int offs = *spec.offset; + sv_shape_t *shape = p->get_state()->get_shape(spec.reg); + if (shape == NULL) { + return offs; + } + return offs; // XXX TODO +} + void (sv_proc_t::DO_WRITE_FREG)(reg_spec_t const& spec, sv_freg_t const& value) { int regflen = sizeof(freg_t) * 8; // FLEN (not specified in spike) @@ -137,7 +147,7 @@ void (sv_proc_t::DO_WRITE_FREG)(reg_spec_t const& spec, sv_freg_t const& value) unsigned int offs = 0; if (spec.offset != NULL) { unsigned int nbytes = flen / bitwidth; - offs = *spec.offset; + offs = remap(spec); shift = offs % nbytes; offs /= nbytes; reg += offs; @@ -189,7 +199,7 @@ void (sv_proc_t::WRITE_REG)(reg_spec_t const& spec, sv_reg_t const& value) unsigned int offs = 0; if (spec.offset != NULL) { unsigned int nbytes = xlen / bitwidth; - offs = *spec.offset; + offs = remap(spec); shift = offs % nbytes; offs /= nbytes; reg += offs; @@ -241,7 +251,7 @@ freg_t (sv_proc_t::READ_FREG)(reg_spec_t const& spec) if (nbytes == 0) { nbytes = 1; } - offs = *spec.offset; + offs = remap(spec); shift = offs % nbytes; offs /= nbytes; reg += offs; @@ -285,7 +295,7 @@ reg_t sv_proc_t::READ_REG(reg_spec_t const& spec, if (nbytes == 0) { nbytes = 1; } - offs = *spec.offset; + offs = remap(spec); shift = offs % nbytes; offs /= nbytes; reg += offs; diff --git a/riscv/sv_insn_redirect.h b/riscv/sv_insn_redirect.h index b08840d..9f77b17 100644 --- a/riscv/sv_insn_redirect.h +++ b/riscv/sv_insn_redirect.h @@ -260,6 +260,8 @@ public: sv_reg_t to_uint32(sv_freg_t const& reg); sv_reg_t to_uint32(sv_float32_t const& reg); + unsigned int remap(reg_spec_t const& regspec); + #include "sv_insn_decl.h" };