From c8149cb261631aadfe6d984cb9b40b88bfb31408 Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Thu, 25 Aug 2016 20:24:14 -0700 Subject: [PATCH] Fix spike interactive (-d) mode --- riscv/execute.cc | 8 +++----- riscv/insns/dret.h | 2 -- riscv/processor.cc | 2 -- riscv/processor.h | 5 ++--- 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 instructions; std::map pc_histogram; -- 2.30.2