|
|
|
@ -30,49 +30,50 @@ |
|
|
|
#undef STATE |
|
|
|
#define STATE state |
|
|
|
|
|
|
|
processor_t::processor_t(const isa_parser_t *isa, const cfg_t *cfg, |
|
|
|
processor_t::processor_t(const char* isa_str, const char* priv_str, |
|
|
|
const cfg_t *cfg, |
|
|
|
simif_t* sim, uint32_t id, bool halt_on_reset, |
|
|
|
FILE* log_file, std::ostream& sout_) |
|
|
|
: debug(false), halt_request(HR_NONE), isa(isa), cfg(cfg), sim(sim), id(id), xlen(0), |
|
|
|
: debug(false), halt_request(HR_NONE), isa(isa_str, priv_str), cfg(cfg), sim(sim), id(id), xlen(0), |
|
|
|
histogram_enabled(false), log_commits_enabled(false), |
|
|
|
log_file(log_file), sout_(sout_.rdbuf()), halt_on_reset(halt_on_reset), |
|
|
|
in_wfi(false), check_triggers_icount(false), |
|
|
|
impl_table(256, false), extension_enable_table(isa->get_extension_table()), |
|
|
|
impl_table(256, false), extension_enable_table(isa.get_extension_table()), |
|
|
|
last_pc(1), executions(1), TM(cfg->trigger_count) |
|
|
|
{ |
|
|
|
VU.p = this; |
|
|
|
TM.proc = this; |
|
|
|
|
|
|
|
#ifndef HAVE_INT128 |
|
|
|
if (isa->has_any_vector()) { |
|
|
|
if (isa.has_any_vector()) { |
|
|
|
fprintf(stderr, "V extension is not supported on platforms without __int128 type\n"); |
|
|
|
abort(); |
|
|
|
} |
|
|
|
|
|
|
|
if (isa->extension_enabled(EXT_ZACAS) && isa->get_max_xlen() == 64) { |
|
|
|
if (isa.extension_enabled(EXT_ZACAS) && isa.get_max_xlen() == 64) { |
|
|
|
fprintf(stderr, "Zacas extension is not supported on 64-bit platforms without __int128 type\n"); |
|
|
|
abort(); |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
VU.VLEN = isa->get_vlen(); |
|
|
|
VU.ELEN = isa->get_elen(); |
|
|
|
VU.vlenb = isa->get_vlen() / 8; |
|
|
|
VU.VLEN = isa.get_vlen(); |
|
|
|
VU.ELEN = isa.get_elen(); |
|
|
|
VU.vlenb = isa.get_vlen() / 8; |
|
|
|
VU.vstart_alu = 0; |
|
|
|
|
|
|
|
register_base_instructions(); |
|
|
|
mmu = new mmu_t(sim, cfg->endianness, this); |
|
|
|
|
|
|
|
disassembler = new disassembler_t(isa); |
|
|
|
for (auto e : isa->get_extensions()) |
|
|
|
disassembler = new disassembler_t(&isa); |
|
|
|
for (auto e : isa.get_extensions()) |
|
|
|
register_extension(find_extension(e.c_str())()); |
|
|
|
|
|
|
|
set_pmp_granularity(cfg->pmpgranularity); |
|
|
|
set_pmp_num(cfg->pmpregions); |
|
|
|
|
|
|
|
if (isa->get_max_xlen() == 32) |
|
|
|
if (isa.get_max_xlen() == 32) |
|
|
|
set_mmu_capability(IMPL_MMU_SV32); |
|
|
|
else if (isa->get_max_xlen() == 64) |
|
|
|
else if (isa.get_max_xlen() == 64) |
|
|
|
set_mmu_capability(IMPL_MMU_SV57); |
|
|
|
|
|
|
|
set_impl(IMPL_MMU_ASID, true); |
|
|
|
@ -575,8 +576,8 @@ void processor_t::enable_log_commits() |
|
|
|
|
|
|
|
void processor_t::reset() |
|
|
|
{ |
|
|
|
xlen = isa->get_max_xlen(); |
|
|
|
state.reset(this, isa->get_max_isa()); |
|
|
|
xlen = isa.get_max_xlen(); |
|
|
|
state.reset(this, isa.get_max_isa()); |
|
|
|
state.dcsr->halt = halt_on_reset; |
|
|
|
halt_on_reset = false; |
|
|
|
if (any_vector_extensions()) |
|
|
|
@ -724,7 +725,7 @@ void processor_t::take_interrupt(reg_t pending_interrupts) |
|
|
|
abort(); |
|
|
|
|
|
|
|
if (check_triggers_icount) TM.detect_icount_match(); |
|
|
|
throw trap_t(((reg_t)1 << (isa->get_max_xlen() - 1)) | ctz(enabled_interrupts)); |
|
|
|
throw trap_t(((reg_t)1 << (isa.get_max_xlen() - 1)) | ctz(enabled_interrupts)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -796,7 +797,7 @@ void processor_t::debug_output_log(std::stringstream *s) |
|
|
|
|
|
|
|
void processor_t::take_trap(trap_t& t, reg_t epc) |
|
|
|
{ |
|
|
|
unsigned max_xlen = isa->get_max_xlen(); |
|
|
|
unsigned max_xlen = isa.get_max_xlen(); |
|
|
|
|
|
|
|
if (debug) { |
|
|
|
std::stringstream s; // first put everything in a string, later send it to output
|
|
|
|
@ -974,7 +975,7 @@ void processor_t::disasm(insn_t insn) |
|
|
|
<< ": Executed " << executions << " times" << std::endl; |
|
|
|
} |
|
|
|
|
|
|
|
unsigned max_xlen = isa->get_max_xlen(); |
|
|
|
unsigned max_xlen = isa.get_max_xlen(); |
|
|
|
|
|
|
|
s << "core " << std::dec << std::setfill(' ') << std::setw(3) << id |
|
|
|
<< std::hex << ": 0x" << std::setfill('0') << std::setw(max_xlen / 4) |
|
|
|
@ -993,7 +994,7 @@ void processor_t::disasm(insn_t insn) |
|
|
|
|
|
|
|
int processor_t::paddr_bits() |
|
|
|
{ |
|
|
|
unsigned max_xlen = isa->get_max_xlen(); |
|
|
|
unsigned max_xlen = isa.get_max_xlen(); |
|
|
|
assert(xlen == max_xlen); |
|
|
|
return max_xlen == 64 ? 50 : 34; |
|
|
|
} |
|
|
|
@ -1120,7 +1121,7 @@ void processor_t::register_base_instructions() |
|
|
|
// add overlapping instructions first, in order
|
|
|
|
#define DECLARE_OVERLAP_INSN(name, ext) \ |
|
|
|
name##_overlapping = true; \ |
|
|
|
if (isa->extension_enabled(ext)) \ |
|
|
|
if (isa.extension_enabled(ext)) \ |
|
|
|
register_base_insn((insn_desc_t) { \ |
|
|
|
name##_match, \ |
|
|
|
name##_mask, \ |
|
|
|
|