* automatically generated. */
/* TODO */
#include "/media/sf_tnewsome/Synced/SiFive/debug-spec/core_registers.tex.h"
+#define DCSR_CAUSE_NONE 0
#define DCSR_CAUSE_SWBP 1
+#define DCSR_CAUSE_HWBP 2
+#define DCSR_CAUSE_DEBUGINT 3
+#define DCSR_CAUSE_STEPPED 4
#define DCSR_CAUSE_HALT 5
-#define DEBUG_ROM_ENTRY 0x800
+#define DEBUG_RAM 0xfffffc00 // TODO: 0x400
+#define DEBUG_ROM_ENTRY 0xfffff800 // TODO: 0x800
#endif
// fetch/decode/execute loop
void processor_t::step(size_t n)
{
+ if (state.dcsr.debugint && state.dcsr.cause == DCSR_CAUSE_NONE) {
+ enter_debug_mode(DCSR_CAUSE_DEBUGINT);
+ }
+
while (n > 0) {
size_t instret = 0;
reg_t pc = state.pc;
// gdb wants the core to be halted when it attaches.
processor_t *p = sim->get_core(0);
- // TODO p->set_halted(true, HR_ATTACHED);
+ p->set_debug_int();
}
}
load_reservation = -1;
}
+void processor_t::set_debug_int()
+{
+ state.dcsr.debugint = true;
+}
+
void processor_t::set_debug(bool value)
{
debug = value;
#endif
};
-typedef enum {
- HR_NONE,
- HR_STEPPED, // A single step was completed
- HR_SWBP, // sbreak was executed
- HR_INTERRUPT, // Execution interrupted by debugger
- HR_CMDLINE, // Command line requested that the processor start halted
- HR_ATTACHED // Halted because a debugger attached
-} halt_reason_t;
-
// this class represents one processor in a RISC-V machine.
class processor_t : public abstract_device_t
{
processor_t(const char* isa, sim_t* sim, uint32_t id);
~processor_t();
+ void set_debug_int();
void set_debug(bool value);
void set_histogram(bool value);
void reset(bool value);