fix bug in CSR set SVVL: val has already been looked up
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sat, 29 Sep 2018 03:23:18 +0000 (04:23 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sat, 29 Sep 2018 03:23:18 +0000 (04:23 +0100)
csrrw.h has been modified to invert the order of set/get, so the
call to processor_t::set_csr(SVVL, val) will do the right thing
and the subsequent (delayed) call to get_csr will return the
state.vl value in the chosen RD

all good

riscv/processor.cc

index 71b030b20d8d127f4a0af8ea760917f1c6cd7eb7..0ad4e3e5ddf7d3737811e889c8f8d1235bb4cd76 100644 (file)
@@ -343,7 +343,7 @@ void processor_t::set_csr(int which, reg_t val)
       state.vl = std::min(val, state.mvl); // limited to MVL
       break;
     case CSR_SVVL:
-      state.vl = std::min(state.mvl, state.XPR[val]);
+      state.vl = std::min(state.mvl, val);
       state.XPR.write(val, state.vl);
       break;
     case CSR_SVREGCFG0: