Skip to content

[rtl] Debug module integration#614

Open
marnovandermaas wants to merge 11 commits into
mainfrom
dbg-module
Open

[rtl] Debug module integration#614
marnovandermaas wants to merge 11 commits into
mainfrom
dbg-module

Conversation

@marnovandermaas

Copy link
Copy Markdown
Collaborator

This integrates the debug module into Mocha. It is testable out of the box with Verilator and the JTAG DPI, but on FPGA you must generate a new bitstream. For convenience I have attached a bitstream for those that want to test on FPGA.
mocha_debug_module_spi_disabled.zip

Closes: #303

@marnovandermaas

This comment was marked as outdated.

@marnovandermaas marnovandermaas force-pushed the dbg-module branch 2 times, most recently from d7001d4 to f1b1013 Compare June 18, 2026 09:32
elliotb-lowrisc and others added 3 commits June 18, 2026 10:54
This includes vendoring the debug module in and including it in the chip
top.

The CVA6 halt and exception addresses are fed in through the top and the
debug module address is fed into the debug module.

It also marks the license as Solderpad license for the Pulp debug
module.

Co-authored-by: Alexandre Joannou <alexandre@capabilitieslimited.co.uk>
Co-authored-by: Jonathan Woodruff <jonathan.woodruff@capabilitieslimited.co.uk>
Co-authored-by: Ray Lau <ray.lau@lowrisc.org>
Co-authored-by: Marno van der Maas <mvdmaas+git@lowrisc.org>
The Verilator config allows program buffer access as fallback

Disable GDB hardware breakpoints since these are not supported by the
current CVA6 configuration and the trigger_module.sv doesn't work out of
the box when enabled. This issue is tracked here:
Capabilities-Limited/cheri-cva6#80

Co-authored-by: Marno van der Maas <mvdmaas+git@lowrisc.org>
@marnovandermaas marnovandermaas marked this pull request as draft June 18, 2026 10:04
@marnovandermaas

This comment was marked as outdated.

raylau1 and others added 8 commits June 18, 2026 11:16
With 2 hosts on the primary AXI crossbar, the device-side ID needs
to be 1 bit ($clog2(AxiXbarHosts)) wider than the host-side ID.

This commit adds device-side AXI types and improves comments about
AXI ID widths in top_pkg.sv.
The debug module top now track pending resets and only acknowledges the
reset when the core is ready to fetch again.
This is so the debug module knows when the CVA6 is ready to start
fetching again.
This only works when SPI device is disconnected.
Before this you could not pass an SramInitFile into the core file.
This adds a shell script that launches Verilator, OpenOCD and GDB.

GDB is run through an expect script.
@marnovandermaas marnovandermaas marked this pull request as ready for review June 18, 2026 11:15
@marnovandermaas

Copy link
Copy Markdown
Collaborator Author

Marked this pull request as ready for review again because both the FPGA tests are passing and the expect GDB script seems to pass as well.

@raylau1 raylau1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some formatting nits which I'll fix. Debugging on verilator and FPGA with gdb seems to be working on my side.

Comment on lines +172 to +187
// Virtual jtag
jtagdpi #(
.Name("jtag0"),
.ListenPort(44853)
) u_jtagdpi (
.clk_i,
.rst_ni,
.active(1'b1),
.jtag_tck(jtag_tck),
.jtag_tms(jtag_tms),
.jtag_tdi(jtag_tdi),
.jtag_tdo(jtag_tdo),
.jtag_trst_n(jtag_trst_n),
.jtag_srst_n( )
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: port formatting

Comment on lines 30 to +32

lint_off -rule BLKSEQ -file "*/lowrisc_dv_dpi_sv_jtagdpi*/jtagdpi.sv" -match "*ctx = jtagdpi_create(Name, port, assert_srst)*"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to add a comment here:

// Mute RTL style warning from lowRISC JTAG DPI

Comment thread hw/top_chip/rtl/top_chip_system.sv Outdated
Comment on lines +405 to +423
dmi_jtag i_dmi_jtag (
.clk_i ( clkmgr_clocks.clk_main_infra ),
.rst_ni ( rstmgr_resets.rst_debug_n[rstmgr_pkg::DomainMainSel] ),
.testmode_i ( 1'b0 ),
.test_rst_ni ( 1'b1 ),
.dmi_rst_no ( ), // keep open
.dmi_req_valid_o ( debug_req_valid ),
.dmi_req_ready_i ( debug_req_ready ),
.dmi_req_o ( debug_req ),
.dmi_resp_valid_i( debug_resp_valid),
.dmi_resp_ready_o( debug_resp_ready),
.dmi_resp_i ( debug_resp ),
.tck_i ( dm_jtag_tck ),
.tms_i ( dm_jtag_tms ),
.trst_ni ( dm_jtag_trst_n ),
.td_i ( dm_jtag_tdi ),
.td_o ( dm_jtag_tdo ),
.tdo_oe_o ( )
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: port formatting, instance name should be u_dmi_jtag.

Comment thread hw/top_chip/rtl/top_chip_system.sv Outdated
Comment on lines +405 to +407
dmi_jtag i_dmi_jtag (
dmi_jtag #(
.IdcodeValue(jtag_id_pkg::RV_DM_JTAG_IDCODE)
) i_dmi_jtag (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: indenting

Comment on lines +8 to +9
localparam logic [10:0] JEDEC_MANUFACTURER_ID = {4'd12, 7'b110_1111};
localparam logic [3:0] JTAG_VERSION = 4'h1;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: alignment can be better

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.

[design] Integrate debug module into Mocha top

3 participants