From 88a882c1e325d1a824dacabac536ead772d52b55 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Sat, 29 Sep 2018 04:23:18 +0100 Subject: [PATCH] fix bug in CSR set SVVL: val has already been looked up 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/riscv/processor.cc b/riscv/processor.cc index 71b030b..0ad4e3e 100644 --- a/riscv/processor.cc +++ b/riscv/processor.cc @@ -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: -- 2.30.2