add reference to vector length in sv
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Tue, 25 Sep 2018 05:28:04 +0000 (06:28 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Tue, 25 Sep 2018 05:28:04 +0000 (06:28 +0100)
riscv/insn_template.cc
riscv/sv_decode.h

index 354c0d90bb6e0440863e6d66c62463936442b15d..8856aabd40b35b399565c523118767935c2edce0 100644 (file)
@@ -12,7 +12,8 @@ reg_t rv32_NAME(processor_t* p, insn_t s_insn, reg_t pc)
   reg_t npc = sext_xlen(pc + insn_length(OPCODE));
   insn_bits_t bits = s_insn.bits();
 #ifdef SPIKE_SIMPLEV
-  sv_insn_t insn(bits);
+  int vlen = 1;
+  sv_insn_t insn(bits, vlen);
   #include "insns/NAME.h"
   trace_opcode(p, OPCODE, s_insn);
 #else
@@ -29,7 +30,8 @@ reg_t rv64_NAME(processor_t* p, insn_t s_insn, reg_t pc)
   reg_t npc = sext_xlen(pc + insn_length(OPCODE));
   insn_bits_t bits = s_insn.bits();
 #ifdef SPIKE_SIMPLEV
-  sv_insn_t insn(bits);
+  int vlen = 1;
+  sv_insn_t insn(bits, vlen);
   #include "insns/NAME.h"
   trace_opcode(p, OPCODE, s_insn);
 #else
index e8eee2674d5391fb7f6299710dce9f13ac87ba3e..73a2941b7e2f7cc8c7677fe1bc8257012152f7d0 100644 (file)
@@ -9,12 +9,13 @@
 class sv_insn_t: public insn_t
 {
 public:
-  sv_insn_t(insn_bits_t bits) : insn_t(bits) {}
+  sv_insn_t(insn_bits_t bits, int& v) : insn_t(bits), vlen(v) {}
   uint64_t rd () { return remap(insn_t::rd()); }
   uint64_t rs1() { return remap(insn_t::rs1()); }
   uint64_t rs2() { return remap(insn_t::rs2()); }
   uint64_t rs3() { return remap(insn_t::rs3()); }
 private:
+  int &vlen;
   // remaps the register through the lookup table.
   // will need to take the current loop index/offset somehow
   uint64_t remap(uint64_t reg) { return reg; } // TODO