aboutsummaryrefslogtreecommitdiff
path: root/riscv/processor.cc
diff options
context:
space:
mode:
authorRupert Swarbrick <rswarbrick@lowrisc.org>2022-04-11 23:18:27 +0100
committerGitHub <noreply@github.com>2022-04-11 15:18:27 -0700
commitae7d2c3062c1a911d97444e5c6df5089a7bb52f6 (patch)
tree7a9bb189b01d119cecdbebe823f8f16a302790ad /riscv/processor.cc
parent168b4ea6a568741e88156ed8f96b5df2765d9df7 (diff)
downloadspike-ae7d2c3062c1a911d97444e5c6df5089a7bb52f6.zip
spike-ae7d2c3062c1a911d97444e5c6df5089a7bb52f6.tar.gz
spike-ae7d2c3062c1a911d97444e5c6df5089a7bb52f6.tar.bz2
Change processor_t to hold a pointer to an isa_parser_t (#973)
Before, it had another copy, which is a little unnecessary.
Diffstat (limited to 'riscv/processor.cc')
-rw-r--r--riscv/processor.cc22
1 files changed, 11 insertions, 11 deletions
diff --git a/riscv/processor.cc b/riscv/processor.cc
index 8ebc902..cf3084b 100644
--- a/riscv/processor.cc
+++ b/riscv/processor.cc
@@ -23,7 +23,7 @@
#undef STATE
#define STATE state
-processor_t::processor_t(isa_parser_t isa, const char* varch,
+processor_t::processor_t(const isa_parser_t *isa, const char* varch,
simif_t* sim, uint32_t id, bool halt_on_reset,
FILE* log_file, std::ostream& sout_)
: debug(false), halt_request(HR_NONE), isa(isa), sim(sim), id(id), xlen(0),
@@ -46,16 +46,16 @@ processor_t::processor_t(isa_parser_t isa, const char* varch,
register_base_instructions();
mmu = new mmu_t(sim, 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(e.second);
set_pmp_granularity(1 << PMP_SHIFT);
set_pmp_num(state.max_pmp);
- 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_SV48);
set_impl(IMPL_MMU_ASID, true);
@@ -486,8 +486,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;
VU.reset();
@@ -624,7 +624,7 @@ void processor_t::take_interrupt(reg_t pending_interrupts)
else
abort();
- 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));
}
}
@@ -688,7 +688,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
@@ -813,7 +813,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)
@@ -832,7 +832,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;
}