Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add RISC-V debug module to FPGA example #1218

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

majbthrd
Copy link

I thought the FPGA Ibex offering might be enhanced by including a ready-to-use (but with the flexibility to opt-out, if desired, at synthesis time) example RISC-V debug implementation.

My goal was as much design re-use as possible. SiFive already has a defacto standard for JTAG pinouts on the Arty boards, so I followed that. The RISC-V debug module is a direct copy of the OpenTitan variant of the pulp-platform/riscv-dbg module.

The top level of the debug was customized to suit the FPGA example (the OpenTitan variant has a nicer integration of JTAG signals and IDCODE implementation, but no TileLink bus is used on the Ibex project), and top_artya7.sv was overhauled to instantiate the top-level debug module and provide bus arbitration between all three bus hosts.

Import a copy of ./hw/vendor/pulp_riscv_dbg from opentitan project,
and place it in ./vendor/.
Overhaul top_artya7.sv to both instantiate a debug module and
provide bus arbitration between all three bus hosts (Ibex instr,
Ibex data, and the debug module).

A defacto standard from SiFive on JTAG pinouts exists for Arty
boards; adapt the existing pin constraints to use this standard.
Set the ibex_core parameters 'DbgTriggerEn' and 'DbgHwBreakNum' for
two hardware breakpoints when DBG is enabled.

Enabling this in the Ibex core is strongly desirable to present a good
debug experience.  Moreover, some RISC-V debug tools assume that
breakpoints exist on the target, so failure to have this in the example
only causes a frustrated user.
@GregAC
Copy link
Collaborator

GregAC commented Feb 25, 2021

Hi @majbthrd thank you for this contribution. Sorry for taking our time in responding. We are interested in having a good debug module example in a basic Ibex system. We're just having some internal discussion as to where it should live. We'd like the Ibex repository to remain focused on Ibex itself so as examples and systems get more complex we'll want a different place for them to be.

What you've done looks like a great starting point for our more complete example system. It will take us a while longer to work out what we're doing here but rest assured this has not been discarded or forgotten.

@majbthrd
Copy link
Author

Thanks for the message. I agree that makes sense to decouple the core Ibex RTL from other code.

FYI: previously, the SEGGER J-Link debug pod was not compatible with the pulp-platform/riscv-dbg module. It would be unrealistic to expect that SEGGER should devise their own Ibex implementation from scratch for testing, but by providing them with pre-compiled bitstreams for the Arty FPGA board (using this PR), they were able to test it locally, the problem was identified, and V6.94c+ (05 Feb 2021) does now work with the target (Ibex + riscv-dbg).

- [J-Link EDU Mini V1]: RISC-V: IBEX core: Reading / writing memory did not work properly because J-Link did not handle 32-bit only system bus implementation properly. Fixed.
- [J-Link EDU/BASE/PLUS V10]: RISC-V: IBEX core: Reading / writing memory did not work properly because J-Link did not handle 32-bit only system bus implementation properly. Fixed.
- [J-Link EDU/BASE/PLUS V11]: RISC-V: IBEX core: Reading / writing memory did not work properly because J-Link did not handle 32-bit only system bus implementation properly. Fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants