ebreak now generates BREAKPOINT

master
vhaudiquet 11 months ago
parent b3f915dcb5
commit 608dbba6a0
  1. 7
      src/cpu/rv32cpu.c

@ -5,6 +5,7 @@
#include "memory/memory.h" #include "memory/memory.h"
#include "vriscv.h" #include "vriscv.h"
#include "exception.h"
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
@ -515,10 +516,8 @@ static void cpu_execute(rv32_cpu_t* cpu, instruction_t* instruction)
sbi_call(cpu, cpu->regs.a7, cpu->regs.a6); sbi_call(cpu, cpu->regs.a7, cpu->regs.a6);
break; break;
case IMM_EBREAK: case IMM_EBREAK:
// EBREAK : on debug, give back hand to debugger ; without debug, end simulation // EBREAK : generate a breakpoint exception
// In any way, we set back simulation ticks to 0 exception_trigger(cpu, SCAUSE_BREAKPOINT);
cpu->sim_ticks_left = 1;
cpu->pc -= 4;
break; break;
case IMM_SRET: case IMM_SRET:
fprintf(stderr, "SRET: We don't support that.\n"); fprintf(stderr, "SRET: We don't support that.\n");

Loading…
Cancel
Save