Open GregAC opened 2 years ago
Indeed the debug module assumes ndmreset_o
to take effect immediately, which doesn't work for systems taking a while to reset.
Introducing ndmreset_ack_i
and thereby making the reset a ready/valid
handshake seems good to me.
Currently the debug module seems to assume any assertion of
ndmreset_o
will instantly cause a reset. Thedmstatus.allhavereset
/dmstatus.anyhavereset
bits are set purely onndmreset_o
being asserted rather than any acknowledgement a reset has occurred.There's also an issue with trigger a non-debug reset (by writing to
dmcontrol
via the DMI interface) when a hart is in halted state (sodmstatus.anyhalted
/dmstatus.allhalted
is asserted). When the hart resets the debug module still considers the hart to be halted when it is not.The issue is the handling of
halted_q
indm_mem
which produces thehalted_o
output that feeds intodmstatus
. Currently this is solely under the control of the debug ROM (which continuously sets it in a loop until it is requested to do something else). When the hart is reset whilst in the middle of the debug ROM it never gets unset so after resetdmstatus.anyhalted
/dmstatus.allhalted
remains asserted. So if you run areset run
command in OpenOCD it times out stating the hart remains halted.I think the
ndmreset
needs to be factored into the logic settinghalted_q
and potentiallyresuming_q
withindm_mem
(maybe other state there too, I'm not familiar enough with it to be sure). Directly feeding thendmreset
signal into it and clearinghalted_q
when it is asserted can work but if you have a system where it takes a while for thendmreset
signal to be acted on perhaps the ROM will successfully sethalted_q
again before the hart reset takes effect.Perhaps a top-level
ndmreset_ack_i
should be introduced which can feed intodmstatus.anyhalted
/dmstatus.allhalted
as well as reset the relevent state indm_mem
?