aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Waterman <waterman@cs.berkeley.edu>2016-08-25 20:24:14 -0700
committerAndrew Waterman <waterman@cs.berkeley.edu>2016-08-25 20:24:14 -0700
commitc8149cb261631aadfe6d984cb9b40b88bfb31408 (patch)
tree4a4bce6b25374a007f49708c85fbe94d796a2f08
parentb3e6c1d9292b437c0d1b79799ac594df6a4a3ef0 (diff)
downloadspike-c8149cb261631aadfe6d984cb9b40b88bfb31408.zip
spike-c8149cb261631aadfe6d984cb9b40b88bfb31408.tar.gz
spike-c8149cb261631aadfe6d984cb9b40b88bfb31408.tar.bz2
Fix spike interactive (-d) mode
-rw-r--r--riscv/execute.cc8
-rw-r--r--riscv/insns/dret.h2
-rw-r--r--riscv/processor.cc2
-rw-r--r--riscv/processor.h5
4 files changed, 5 insertions, 12 deletions
diff --git a/riscv/execute.cc b/riscv/execute.cc
index 3d5625f..0cb70e5 100644
--- a/riscv/execute.cc
+++ b/riscv/execute.cc
@@ -51,11 +51,9 @@ static reg_t execute_insn(processor_t* p, reg_t pc, insn_fetch_t fetch)
return npc;
}
-void processor_t::update_slow_path()
+bool processor_t::slow_path()
{
- slow_path = debug || state.single_step != state.STEP_NONE || state.dcsr.cause;
- if (slow_path)
- return;
+ return debug || state.single_step != state.STEP_NONE || state.dcsr.cause;
}
// fetch/decode/execute loop
@@ -97,7 +95,7 @@ void processor_t::step(size_t n)
{
take_interrupt();
- if (unlikely(slow_path))
+ if (unlikely(slow_path()))
{
while (instret < n)
{
diff --git a/riscv/insns/dret.h b/riscv/insns/dret.h
index 51eaa17..35c19cb 100644
--- a/riscv/insns/dret.h
+++ b/riscv/insns/dret.h
@@ -7,5 +7,3 @@ STATE.dcsr.cause = 0;
if (STATE.dcsr.step)
STATE.single_step = STATE.STEP_STEPPING;
-
-p->update_slow_path();
diff --git a/riscv/processor.cc b/riscv/processor.cc
index 51f4061..7d8c5df 100644
--- a/riscv/processor.cc
+++ b/riscv/processor.cc
@@ -202,8 +202,6 @@ void processor_t::enter_debug_mode(uint8_t cause)
set_privilege(PRV_M);
state.dpc = state.pc;
state.pc = DEBUG_ROM_START;
- //debug = true; // TODO
- update_slow_path();
}
void processor_t::take_trap(trap_t& t, reg_t epc)
diff --git a/riscv/processor.h b/riscv/processor.h
index ab3af22..3f8c4de 100644
--- a/riscv/processor.h
+++ b/riscv/processor.h
@@ -189,7 +189,8 @@ public:
// When true, display disassembly of each instruction that's executed.
bool debug;
- void update_slow_path();
+ // When true, take the slow simulation path.
+ bool slow_path();
// Return the index of a trigger that matched, or -1.
inline int trigger_match(trigger_operation_t operation, reg_t address, reg_t data)
@@ -294,8 +295,6 @@ private:
std::string isa_string;
bool histogram_enabled;
bool halt_on_reset;
- // When true, take the slow simulation path.
- bool slow_path;
std::vector<insn_desc_t> instructions;
std::map<reg_t,uint64_t> pc_histogram;