Browse Source

Update state.pc on every instruction

This isn't a bug fix for Spike proper, but it makes it possible for
RoCC instructions to access the control thread's PC.
pull/18/head
Andrew Waterman 11 years ago
parent
commit
e5675bfcb3
  1. 7
      riscv/processor.cc

7
riscv/processor.cc

@ -193,7 +193,7 @@ void processor_t::step(size_t n)
{ {
insn_fetch_t fetch = mmu->load_insn(pc); insn_fetch_t fetch = mmu->load_insn(pc);
disasm(fetch.insn); disasm(fetch.insn);
pc = execute_insn(this, pc, fetch); state.pc = pc = execute_insn(this, pc, fetch);
} }
} }
else while (instret < n) else while (instret < n)
@ -204,7 +204,7 @@ void processor_t::step(size_t n)
#define ICACHE_ACCESS(idx) { \ #define ICACHE_ACCESS(idx) { \
insn_fetch_t fetch = ic_entry->data; \ insn_fetch_t fetch = ic_entry->data; \
ic_entry++; \ ic_entry++; \
pc = execute_insn(this, pc, fetch); \ state.pc = pc = execute_insn(this, pc, fetch); \
instret++; \ instret++; \
if (idx == mmu_t::ICACHE_ENTRIES-1) break; \ if (idx == mmu_t::ICACHE_ENTRIES-1) break; \
if (unlikely(ic_entry->tag != pc)) break; \ if (unlikely(ic_entry->tag != pc)) break; \
@ -217,11 +217,10 @@ void processor_t::step(size_t n)
} }
catch(trap_t& t) catch(trap_t& t)
{ {
pc = take_trap(t, pc); state.pc = take_trap(t, pc);
} }
catch(serialize_t& s) {} catch(serialize_t& s) {}
state.pc = pc;
update_timer(&state, instret); update_timer(&state, instret);
} }

Loading…
Cancel
Save