mirror of
https://github.com/stnolting/neorv32.git
synced 2025-04-23 21:57:33 -04:00
[park loop] minor edits
This commit is contained in:
parent
aeacd06f44
commit
2c80402358
1 changed files with 10 additions and 10 deletions
|
@ -38,7 +38,7 @@
|
|||
.equ DM_DATA_BASE, 0xffffff80 // base address of debug_module's abstract data buffer (DATA)
|
||||
.equ DM_SREG_BASE, 0xffffffC0 // base address of debug_module's status register
|
||||
|
||||
// status register (SREG) byte(!!!) offsets
|
||||
// status register (SREG) byte(!) offsets
|
||||
.equ SREG_HLT_ACK, ( 0 / 8) // -/w: CPU has halted in debug mode and is waiting in park loop
|
||||
.equ SREG_RES_REQ, ( 8 / 8) // r/-: DM requests to resume
|
||||
.equ SREG_RES_ACK, ( 8 / 8) // -/w: CPU starts to resume
|
||||
|
@ -68,24 +68,24 @@ entry_normal:
|
|||
// polling loop - waiting for requests
|
||||
park_loop:
|
||||
sb zero, (DM_SREG_BASE+SREG_HLT_ACK)(zero) // ACK that CPU is halted
|
||||
lbu x8, (DM_SREG_BASE+SREG_EXE_REQ)(zero) // request to execute program buffer?
|
||||
bnez x8, execute
|
||||
lbu x8, (DM_SREG_BASE+SREG_RES_REQ)(zero) // request to resume?
|
||||
beqz x8, park_loop
|
||||
lbu x8, (DM_SREG_BASE+SREG_EXE_REQ)(zero) // request to execute program buffer?
|
||||
bnez x8, execute
|
||||
lbu x8, (DM_SREG_BASE+SREG_RES_REQ)(zero) // request to resume?
|
||||
beqz x8, park_loop
|
||||
|
||||
// resume normal operation
|
||||
resume:
|
||||
sb x8, (DM_SREG_BASE+SREG_RES_ACK)(zero) // ACK that CPU is about to resume
|
||||
csrr x8, dscratch0 // restore x8 from dscratch0
|
||||
sb zero, (DM_SREG_BASE+SREG_RES_ACK)(zero) // ACK that CPU is about to resume
|
||||
csrr x8, dscratch0 // restore x8 from dscratch0
|
||||
dret // exit debug mode
|
||||
|
||||
// execute program buffer
|
||||
execute:
|
||||
sb zero, (DM_SREG_BASE+SREG_EXE_ACK)(zero) // ACK that execution is about to start
|
||||
csrr x8, dscratch0 // restore x8 from dscratch0
|
||||
fence.i // synchronize ifetch / i-cache & prefetch with memory (PBUF)
|
||||
csrr x8, dscratch0 // restore x8 from dscratch0
|
||||
fence.i // synchronize i-cache and prefetch with memory (PBUF)
|
||||
jalr zero, zero, %lo(DM_PBUF_BASE) // jump to beginning of program buffer (PBUF)
|
||||
|
||||
// fill remaining ROM space with instructions that cause a debug-mode-internal exception
|
||||
unused:
|
||||
ecall
|
||||
ecall // should never be reached
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue