#define CSR_SVPREDCFG5 0x4cd
#define CSR_SVPREDCFG6 0x4ce
#define CSR_SVPREDCFG7 0x4cf
-#define CSR_SVVL 0x4f0
-#define CSR_SVSTATE 0x4f1
-#define CSR_SVMVL 0x4f2
+#define CSR_MSVVL 0x4d0
+#define CSR_MSVMVL 0x4d1
+#define CSR_MSVSTATE 0x4d2
+#define CSR_SSVVL 0x4e0
+#define CSR_SSVMVL 0x4e1
+#define CSR_SSVSTATE 0x4e2
+#define CSR_USVVL 0x4f0
+#define CSR_USVMVL 0x4f1
+#define CSR_USVSTATE 0x4f2
+#define CSR_USVCFG 0x4f3
#define CSR_MVENDORID 0xf11
#define CSR_MARCHID 0xf12
#define CSR_MIMPID 0xf13
DECLARE_INSN(custom3_rd_rs1_rs2, MATCH_CUSTOM3_RD_RS1_RS2, MASK_CUSTOM3_RD_RS1_RS2)
#endif
#ifdef DECLARE_CSR
-DECLARE_CSR(svvl, CSR_SVVL)
-DECLARE_CSR(svstate, CSR_SVSTATE)
-DECLARE_CSR(svmvl, CSR_SVMVL)
+DECLARE_CSR(msvvl, CSR_MSVVL)
+DECLARE_CSR(msvmvl, CSR_MSVMVL)
+DECLARE_CSR(msvstate, CSR_MSVSTATE)
+DECLARE_CSR(ssvvl, CSR_SSVVL)
+DECLARE_CSR(ssvmvl, CSR_SSVMVL)
+DECLARE_CSR(ssvstate, CSR_SSVSTATE)
+DECLARE_CSR(usvcfg, CSR_USVCFG)
+DECLARE_CSR(usvstate, CSR_USVSTATE)
+DECLARE_CSR(usvvl, CSR_USVVL)
+DECLARE_CSR(usvmvl, CSR_USVMVL)
DECLARE_CSR(svregcfg0, CSR_SVREGCFG0)
DECLARE_CSR(svregcfg1, CSR_SVREGCFG1)
DECLARE_CSR(svregcfg2, CSR_SVREGCFG2)
int csr = validate_csr(insn.csr(), true);
#ifdef SPIKE_SIMPLEV
reg_t old = 0; // stop compiler bitchin
-if (csr != CSR_SVVL)
+if (csr != CSR_USVVL && csr != CSR_USVMVL)
{
old = p->get_csr(csr);
}
p->set_csr(csr, RS1);
-if (csr == CSR_SVVL)
+if (csr == CSR_USVVL || csr == CSR_USVMVL)
{
old = p->get_csr(csr);
}
fprintf(stderr, "validated %x\n", csr);
#ifdef SPIKE_SIMPLEV
reg_t old = 0; // stop compiler bitchin
-if (csr != CSR_SVVL)
+if (csr != CSR_USVVL && csr != CSR_USVMVL)
{
old = p->get_csr(csr);
}
p->set_csr(csr, insn.rs1());
-if (csr == CSR_SVVL)
+if (csr == CSR_USVVL || csr == CSR_USVMVL)
{
old = p->get_csr(csr);
}
switch (which)
{
#ifdef SPIKE_SIMPLEV
- case CSR_SVMVL:
- state.mvl = std::min(val, (uint64_t)63); // limited to XLEN width
+ case CSR_USVMVL:
+ state.mvl = std::min(val+1, (uint64_t)64); // limited to XLEN width
fprintf(stderr, "set MVL %lx\n", state.mvl);
break;
- case CSR_SVSTATE:
+ case CSR_USVSTATE:
// bits 0-5: mvl - 6-11: vl - 12-17: srcoffs - 18-23: destoffs
- set_csr(CSR_SVMVL, get_field(val, 0x1f));
- set_csr(CSR_SVVL , get_field(val, 0x1f<<6));
- state.srcoffs = std::min(get_field(val, 0x1f<<12), state.vl);
- state.destoffs = std::min(get_field(val, 0x1f<<18), state.vl);
+ set_csr(CSR_USVMVL, get_field(val, 0x1f));
+ set_csr(CSR_USVVL , get_field(val, 0x1f<<6));
+ state.srcoffs = std::min(get_field(val, 0x1f<<12), state.vl-1);
+ state.destoffs = std::min(get_field(val, 0x1f<<18), state.vl-1);
break;
- case CSR_SVVL:
- state.vl = std::min(state.mvl, val);
+ case CSR_USVVL:
+ state.vl = std::min(state.mvl, val+1);
fprintf(stderr, "set VL %lx\n", state.vl);
break;
case CSR_SVREGCFG0:
switch (which)
{
#ifdef SPIKE_SIMPLEV
- case CSR_SVVL:
+ case CSR_USVVL:
return state.vl;
- case CSR_SVSTATE:
- return state.vl | (state.mvl<<6) |
- (state.srcoffs<<12) | (state.destoffs<<18) ;
- case CSR_SVMVL:
+ case CSR_USVSTATE:
+ return (state.vl-1) | ((state.mvl-1)<<6) |
+ (state.srcoffs<<12) | (state.destoffs<<18) ;
+ case CSR_USVMVL:
return state.mvl;
case CSR_SVREGCFG0:
case CSR_SVREGCFG1: