aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--riscv/processor.cc22
-rw-r--r--riscv/processor.h10
-rw-r--r--riscv/sim.cc2
-rw-r--r--spike_main/spike-log-parser.cc2
4 files changed, 18 insertions, 18 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;
}
diff --git a/riscv/processor.h b/riscv/processor.h
index 54cc5b9..98ff399 100644
--- a/riscv/processor.h
+++ b/riscv/processor.h
@@ -224,12 +224,12 @@ static int cto(reg_t val)
class processor_t : public abstract_device_t
{
public:
- processor_t(isa_parser_t isa, const char* varch,
+ 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_); // because of command line option --log and -s we need both
~processor_t();
- const isa_parser_t &get_isa() { return isa; }
+ const isa_parser_t &get_isa() { return *isa; }
void set_debug(bool value);
void set_histogram(bool value);
@@ -266,7 +266,7 @@ public:
if (ext >= 'A' && ext <= 'Z')
return state.misa->extension_enabled(ext);
else
- return isa.extension_enabled(ext);
+ return isa->extension_enabled(ext);
}
// Is this extension enabled? and abort if this extension can
// possibly be disabled dynamically. Useful for documenting
@@ -275,7 +275,7 @@ public:
if (ext >= 'A' && ext <= 'Z')
return state.misa->extension_enabled_const(ext);
else
- return isa.extension_enabled(ext); // assume this can't change
+ return isa->extension_enabled(ext); // assume this can't change
}
void set_impl(uint8_t impl, bool val) { impl_table[impl] = val; }
bool supports_impl(uint8_t impl) const {
@@ -323,7 +323,7 @@ public:
const char* get_symbol(uint64_t addr);
private:
- isa_parser_t isa;
+ const isa_parser_t * const isa;
simif_t* sim;
mmu_t* mmu; // main memory is always accessed via the mmu
diff --git a/riscv/sim.cc b/riscv/sim.cc
index 0831582..be60864 100644
--- a/riscv/sim.cc
+++ b/riscv/sim.cc
@@ -88,7 +88,7 @@ sim_t::sim_t(const cfg_t *cfg, const char* varch, bool halted, bool real_time_cl
for (size_t i = 0; i < nprocs(); i++) {
int hart_id = hartids.empty() ? i : hartids[i];
- procs[i] = new processor_t(isa, varch, this, hart_id, halted,
+ procs[i] = new processor_t(&isa, varch, this, hart_id, halted,
log_file.get(), sout_);
}
diff --git a/spike_main/spike-log-parser.cc b/spike_main/spike-log-parser.cc
index 0a4442f..fab00f0 100644
--- a/spike_main/spike-log-parser.cc
+++ b/spike_main/spike-log-parser.cc
@@ -28,7 +28,7 @@ int main(int argc, char** argv)
parser.parse(argv);
isa_parser_t isa(isa_string, DEFAULT_PRIV);
- processor_t p(isa, DEFAULT_VARCH, 0, 0, false, nullptr, cerr);
+ processor_t p(&isa, DEFAULT_VARCH, 0, 0, false, nullptr, cerr);
if (extension) {
p.register_extension(extension());
}