// lower 16 bits go into even, upper into odd...
state.sv_csrs[tbidx].u = get_field(val, 0xffff);
state.sv_csrs[tbidx+1].u = get_field(val, 0xffff<<16);
- int clroffset = 0;
+ int clroffset = 2;
if (xlen == 64)
{
state.sv_csrs[tbidx+2].u = get_field(val, 0xffff<<32);
state.sv_csrs[tbidx+3].u = get_field(val, 0xffff<<48);
+ clroffset = 4;
}
// clear out all CSRs above the one(s) being set: this ensures that
// when it comes to context-switching, it's clear what needs to be saved
int tbidx = (which - CSR_SVPREDCFG0) * 2;
state.sv_pred_csrs[tbidx].u = get_field(val, 0xffff);
state.sv_pred_csrs[tbidx+1].u = get_field(val, 0xffff0000);
- int clroffset = 0;
+ int clroffset = 2;
if (xlen == 64)
{
state.sv_pred_csrs[tbidx+2].u = get_field(val, 0xffff<<32);
state.sv_pred_csrs[tbidx+3].u = get_field(val, 0xffff<<48);
+ clroffset = 4;
}
for (int i = tbidx+clroffset; i < 16; i++)
{