fprintf(stderr, "set MVL %lx\n", state.sv().mvl);
break;
case CSR_USVSTATE:
+ {
// bits 0-5: mvl - 6-11: vl - 12-17: srcoffs - 18-23: destoffs
- set_csr(CSR_USVMVL, get_field(val, 0x1f )+1);
- set_csr(CSR_USVVL , get_field(val, 0x1f<<6)+1);
- state.sv().srcoffs = std::min(get_field(val, 0x1f<<12), state.sv().vl-1);
- state.sv().destoffs = std::min(get_field(val, 0x1f<<18), state.sv().vl-1);
+ set_csr(CSR_USVMVL, get_field(val, SV_STATE_VL )+1);
+ set_csr(CSR_USVVL , get_field(val, SV_STATE_MVL)+1);
+ reg_t srcoffs = get_field(val, SV_STATE_SRCOFFS);
+ reg_t destoffs = get_field(val, SV_STATE_DESTOFFS);
+ state.sv().srcoffs = std::min(srcoffs , state.sv().vl-1);
+ state.sv().destoffs = std::min(destoffs, state.sv().vl-1);
+ state.sv().state_bank = get_field(val, SV_STATE_BANK);
+ state.sv().state_size = get_field(val, SV_STATE_SIZE);
break;
+ }
case CSR_USVVL:
state.sv().vl = std::min(state.sv().mvl, val);
// TODO XXX throw exception if val == 0
return state.sv().vl;
case CSR_USVSTATE:
return (state.sv().vl-1) | ((state.sv().mvl-1)<<6) |
- (state.sv().srcoffs<<12) | (state.sv().destoffs<<18) ;
+ (state.sv().srcoffs<<12) | (state.sv().destoffs<<18) |
+ (state.sv().state_bank<<24) | (state.sv().state_size<<26);
case CSR_USVMVL:
return state.sv().mvl;
case CSR_SVREGCFG0:
uint64_t mvl;
int destoffs; // destination loop element offset
int srcoffs; // source loop element offset (used in twin-predication)
+ int state_size;
+ int state_bank;
sv_reg_csr_entry sv_csrs[SV_UCSR_SZ];
sv_reg_entry sv_int_tb[NXPR];
sv_reg_entry sv_fp_tb[NFPR];
#define SV_SHAPE_PERM_ZXY 4
#define SV_SHAPE_PERM_ZYX 5
+#define SV_STATE_VL (0x1f)
+#define SV_STATE_MVL (0x1f<<6)
+#define SV_STATE_SRCOFFS (0x1f<<12)
+#define SV_STATE_DESTOFFS (0x1f<<18)
+#define SV_STATE_BANK (0x1f<<24)
+#define SV_STATE_SIZE (0x1f<<26)
+
#endif