const char* all_subsets = "imafdqc";
max_xlen = 64;
- isa = reg_t(2) << 62;
+ state.misa = reg_t(2) << 62;
if (strncmp(p, "rv32", 4) == 0)
- max_xlen = 32, isa = reg_t(1) << 30, p += 4;
+ max_xlen = 32, state.misa = reg_t(1) << 30, p += 4;
else if (strncmp(p, "rv64", 4) == 0)
p += 4;
else if (strncmp(p, "rv", 2) == 0)
}
isa_string = "rv" + std::to_string(max_xlen) + p;
- isa |= 1L << ('s' - 'a'); // advertise support for supervisor mode
- isa |= 1L << ('u' - 'a'); // advertise support for user mode
+ state.misa |= 1L << ('s' - 'a'); // advertise support for supervisor mode
+ state.misa |= 1L << ('u' - 'a'); // advertise support for user mode
while (*p) {
- isa |= 1L << (*p - 'a');
+ state.misa |= 1L << (*p - 'a');
if (auto next = strchr(all_subsets, *p)) {
all_subsets = next + 1;
if (supports_extension('Q') && max_xlen < 64)
bad_isa_string(str);
- max_isa = isa;
+ max_isa = state.misa;
}
void state_t::reset()
mask |= 1L << ('C' - 'A');
mask &= max_isa;
- isa = (val & mask) | (isa & ~mask);
+ state.misa = (val & mask) | (state.misa & ~mask);
break;
}
case CSR_TSELECT:
case CSR_MSCRATCH: return state.mscratch;
case CSR_MCAUSE: return state.mcause;
case CSR_MTVAL: return state.mtval;
- case CSR_MISA: return isa;
+ case CSR_MISA: return state.misa;
case CSR_MARCHID: return 0;
case CSR_MIMPID: return 0;
case CSR_MVENDORID: return 0;
// control and status registers
reg_t prv; // TODO: Can this be an enum instead?
+ reg_t misa;
reg_t mstatus;
reg_t mepc;
reg_t mtval;
extension_t* get_extension() { return ext; }
bool supports_extension(unsigned char ext) {
if (ext >= 'a' && ext <= 'z') ext += 'A' - 'a';
- return ext >= 'A' && ext <= 'Z' && ((isa >> (ext - 'A')) & 1);
+ return ext >= 'A' && ext <= 'Z' && ((state.misa >> (ext - 'A')) & 1);
}
void check_pc_alignment(reg_t pc) {
if (unlikely(pc & 2) && !supports_extension('C'))
uint32_t id;
unsigned max_xlen;
unsigned xlen;
- reg_t isa;
reg_t max_isa;
std::string isa_string;
bool histogram_enabled;