Initial values of dtmcs.dmistat and dmi.op

39 views
Skip to first unread message

Peter Ashenden

unread,
Sep 25, 2018, 8:17:38 PM9/25/18
to de...@groups.riscv.org

Folks,

We've just been bringing up a new debug module and debug JTAG transport design with OpenOCD and encountered an issue with initialization. We're implementing debug spec Version 0.13-DRAFT and using the OpenOCD driver for V0.13.

In the debug spec, dtmcs.dmistat is specified as having a reset value of 0, and dmi.op as having a reset value of 2 (error). We found that OpenOCD does a DMI read during its init, but sees the op=2 value in the first dmi capture and thinks this is a failure. When we worked around this by doing a dmireset before the first DMI access, it all went ok.

So questions arising:

  • Why is OpenOCD surprised to see op=2 initially, when that's what the spec says it should be?
  • Why are dmi.op and dtmcs.dmistat reset to different values? If they were the same, dtmcs.dmistat could just be a mirror of dmi.op capture value.

Cheers,

PA

-- 
Peter Ashenden, CTO IC Design, ASTC

Tim Newsome

unread,
Sep 25, 2018, 8:24:36 PM9/25/18
to Peter Ashenden, RISC-V Debug Group
On Tue, Sep 25, 2018 at 5:17 PM Peter Ashenden <peter.a...@astc-design.com> wrote:

We've just been bringing up a new debug module and debug JTAG transport design with OpenOCD and encountered an issue with initialization. We're implementing debug spec Version 0.13-DRAFT and using the OpenOCD driver for V0.13.

In the debug spec, dtmcs.dmistat is specified as having a reset value of 0, and dmi.op as having a reset value of 2 (error). We found that OpenOCD does a DMI read during its init, but sees the op=2 value in the first dmi capture and thinks this is a failure. When we worked around this by doing a dmireset before the first DMI access, it all went ok.

So questions arising:

  • Why is OpenOCD surprised to see op=2 initially, when that's what the spec says it should be?
Sounds like a bug in OpenOCD. 
  • Why are dmi.op and dtmcs.dmistat reset to different values? If they were the same, dtmcs.dmistat could just be a mirror of dmi.op capture value.
I don't even know why dtmcs.dmistat exists. Probably left over from an older interface.
I agree that they should be the same value. Do you prefer to reset to 0, or to 2? Probably existing implementations use 0, because OpenOCD works with that.

Tim 

Cheers,

PA

-- 
Peter Ashenden, CTO IC Design, ASTC

--
You received this message because you are subscribed to the Google Groups "RISC-V Debug Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to debug+un...@groups.riscv.org.
To post to this group, send email to de...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/debug/.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/debug/ebf893a4-6b52-f9a1-941b-b77069299652%40astc-design.com.

Peter Ashenden

unread,
Sep 25, 2018, 8:30:13 PM9/25/18
to de...@groups.riscv.org
Hi Tim,

I would prefer 0. The spec is that 2 indicates a previous operation
failed. If there was no previous operation, there was no previous
failure. Thanks.

PA


On 26/09/2018 09:54, Tim Newsome wrote:
> I don't even know why dtmcs.dmistat exists. Probably left over from an
> older interface.
> I agree that they should be the same value. Do you prefer to reset to
> 0, or to 2? Probably existing implementations use 0, because OpenOCD
> works with that.

Tim Newsome

unread,
Sep 26, 2018, 2:45:33 PM9/26/18
to Peter Ashenden, RISC-V Debug Group
I've created https://github.com/riscv/riscv-debug-spec/pull/369 to make this change.

Tim

--
You received this message because you are subscribed to the Google Groups "RISC-V Debug Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to debug+un...@groups.riscv.org.
To post to this group, send email to de...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/debug/.
Reply all
Reply to author
Forward
0 new messages