Open stefano-codasip opened 1 month ago
fyi @rtwfroody @pdonahue-ventana
- Which behavior is the correct one?
AFAIU, this does not matter since [3.14.6. Abstract Control and Status (abstractcs
, at 0x16), cmderr
field description] states:
This field only contains a valid value if busy is 0.
As for your second point, my understanding is cmderr
should be set to busy
, as per:
any error generated by the currently executing command is lost.
If I'm correct, maybe rewriting the rule as:
If the debugger starts a new command while busy is set, the currently executing command still gets to run to completion, cmderr becomes 1 (busy) and any error generated by the currently executing command is lost.
Will make it a bit clearer.
en-sc: this does not matter since (...) cmderr field description states:
This field only contains a valid value if busy is 0.
@en-sc Thank you for pointing this out, I missed this part of the spec initially. So cmderr
may be arbitrary while busy=1
(and should not be interpreted by the external debugger).
We discussed this with @stefano-codasip internally and prepared a proposal to clarify the wording in the spec: https://github.com/riscv/riscv-debug-spec/pull/1076
Please, let us know if the proposed change looks OK to you. Thanks.
Thanks @en-sc - I also totally missed
This field only contains a valid value if busy is 0.
As @JanMatCodasip pointed out, we discussed this internally, and both agree on the changes proposed in his pull request.
For
abstractcs
,abstractauto
andcommand
, the RISC-V Debug spec reads:For
dataX
andprogbufX
the RISC-V Debug spec reads:The former indicates that the Debug Module should wait for
abstractcs.busy
to become zero before settingabstractcs.cmderr
to one. The latter seem to indicate an immediate setting ofabstractcs.cmderr
without waiting for the command to complete.abstractcs
,abstractauto
andcommand
registers, then I believe there is a further inconsistency / issue with following sentence of the spec:If we wait for the command to complete before setting
cmderr
to one, and we get an exception (cmderr
value 3), what shouldcmderr
be set to in that case? Because the busy error occurs before the exception, butcmderr
would still be zero when the exception comes in.