Remove RV32 breakpoints and interrupts, to save a tiny bit of code size.
Some checks are pending
CI / test (ubuntu-latest) (push) Waiting to run

This commit is contained in:
Toby Jaffey 2025-12-14 15:05:35 +00:00
parent 065d2c64aa
commit 5fb03b7d66
4 changed files with 14 additions and 3 deletions

Binary file not shown.

View file

@ -103,7 +103,11 @@ struct MiniRV32IMAState
};
#ifndef MINIRV32_STEPPROTO
MINIRV32_DECORATE int32_t MiniRV32IMAStep(void *userdata, struct MiniRV32IMAState * state, uint8_t * image, uint32_t vProcAddress, uint32_t elapsedUs, int count );
MINIRV32_DECORATE int32_t MiniRV32IMAStep(void *userdata, struct MiniRV32IMAState * state, uint8_t * image, uint32_t vProcAddress,
#ifndef MINIRV32_NO_TIMERS_NO_CYCLES
uint32_t elapsedUs,
#endif
int count );
#endif
#ifdef MINIRV32_IMPLEMENTATION
@ -116,7 +120,11 @@ MINIRV32_DECORATE int32_t MiniRV32IMAStep(void *userdata, struct MiniRV32IMAStat
#endif
#ifndef MINIRV32_STEPPROTO
MINIRV32_DECORATE int32_t MiniRV32IMAStep(void *userdata, struct MiniRV32IMAState * state, uint8_t * image, uint32_t vProcAddress, uint32_t elapsedUs, int count )
MINIRV32_DECORATE int32_t MiniRV32IMAStep(void *userdata, struct MiniRV32IMAState * state, uint8_t * image, uint32_t vProcAddress,
#ifndef MINIRV32_NO_TIMERS_NO_CYCLES
uint32_t elapsedUs,
#endif
int count )
#else
MINIRV32_STEPPROTO
#endif
@ -436,6 +444,7 @@ MINIRV32_STEPPROTO
case 0:
trap = ( CSR( extraflags ) & 3) ? (11+1) : (8+1); // ECALL; 8 = "Environment call from U-mode"; 11 = "Environment call from M-mode"
break;
#ifndef MINIRV32_NO_BREAKPOINT_NO_INTERRUPTS
case 1:
trap = (3+1); break; // EBREAK 3 = "Breakpoint"
case 0x105: //WFI (Wait for interrupts)
@ -443,6 +452,7 @@ MINIRV32_STEPPROTO
CSR( extraflags ) |= 4; //Infor environment we want to go to sleep.
SETCSR( pc, pc + 4 );
return 1;
#endif
default:
trap = (2+1); break; // Illegal opcode.
}

View file

@ -254,7 +254,7 @@ uint32_t uvm32_run(uvm32_state_t *vmst, uvm32_evt_t *evt, uint32_t instr_meter)
while(vmst->_status == UVM32_STATUS_RUNNING && instr_meter > 0) {
uint64_t elapsedUs = 1;
uint32_t ret;
ret = MiniRV32IMAStep(vmst, &vmst->_core, vmst->_memory, 0, elapsedUs, 1);
ret = MiniRV32IMAStep(vmst, &vmst->_core, vmst->_memory, elapsedUs, 1);
instr_meter--;
switch(ret) {

View file

@ -44,6 +44,7 @@ SOFTWARE.
#define MINIRV32_NO_TIMERS_NO_CYCLES
#define MINIRV32_NO_ZICSR
#define MINIRV32_NO_ATOMICS
#define MINIRV32_NO_BREAKPOINT_NO_INTERRUPTS
#define MINI_RV32_RAM_SIZE UVM32_MEMORY_SIZE
#define MINIRV32_POSTEXEC(pc, ir, retval) {if (retval > 0) return retval;}
uint32_t _uvm32_extramLoad(void *userdata, uint32_t addr, uint32_t accessTyp);