}
// okaaay and now "unpack" the CAM to make it easier to use. this
// approach is not designed to be efficient right now. optimise later
+ // first clear the old tables
+ memset(state.sv_int_tb, 0, sizeof(state.sv_int_tb));
+ memset(state.sv_fp_tb, 0, sizeof(state.sv_fp_tb));
+ // now walk the CAM and unpack it
for (int i = 0; i < SV_CSR_SZ; i++)
{
- // TODO
+ union sv_reg_csr_entry *c = &state.sv_csrs[i];
+ uint64_t idx = c->b.regidx;
+ sv_reg_entry *r;
+ // XXX damn. this basically duplicates sv_insn_t::get_regentry.
+ if (c->b.type == 1)
+ {
+ r = &state.sv_int_tb[idx];
+ }
+ else
+ {
+ r = &state.sv_int_tb[idx];
+ }
+ r->elwidth = c->b.elwidth;
+ r->regidx = c->b.regidx;
+ r->isvec = c->b.isvec;
+ r->packed = c->b.packed;
+ r->active = true;
}
break;
}