pulp-platform / riscv-dbg

RISC-V Debug Support for our PULP RISC-V Cores
Other
225 stars 75 forks source link

Behaviour when JTAG clock is much faster than the system clock #163

Open rswarbrick opened 5 months ago

rswarbrick commented 5 months ago

I'm trying to debug a failure that's showing up in "rv_dm", a small wrapper around the riscv-dbg module in OpenTitan. The issue comes up when the JTAG clock is being driven at a higher frequency than the system clock.

The JTAG-based DMI agent sends a request (DTM_WRITE). A short time later, it sends another JTAG message with request DTM_NOP. The response in that second JTAG transaction is DTM_SUCCESS, which the agent interprets as meaning that the write operation has completed. When we send another JTAG message, we get a response of DTM_BUSY and everything is very confused: what were we busy with?!

Here is a screenshot of the waves that we see: image

The timing comes out as:

I'm a bit surprised that there isn't a "busy" status that we put into dr_d when the DTM is still in the WaitWriteValid FSM state. But maybe I'm missing some other method of synchronisation that the agent could be using.

What's wrong here? :-)

bluewww commented 5 months ago

Thanks yes I think we only designed it to work for JTAG clock frequency < System Clock frequency. Not intentionally, but rather by coincidence: because we never saw JTAG being driven faster except in synthetic testbench setups.

rswarbrick commented 5 months ago

Cool, that makes sense. To avoid the next confused user (after me!), would it make sense to add a note to the README.md file?

bluewww commented 5 months ago

Definitely

bluewww commented 3 months ago

Updated the README.md but I'll leave this issue open for further discussion