Skip to content

hw: gate the iDMA tracer behind the DEBUG define - #329

Draft
DanielKellerM wants to merge 2 commits into
pulp-platform:developfrom
DanielKellerM:idma-trace-follow-debug
Draft

hw: gate the iDMA tracer behind the DEBUG define#329
DanielKellerM wants to merge 2 commits into
pulp-platform:developfrom
DanielKellerM:idma-trace-follow-debug

Conversation

@DanielKellerM

@DanielKellerM DanielKellerM commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Follows up on #328 and coordinates with @colluca's upcoming TRACE change.

idma_inst64_top was instantiated with a hardcoded .DMATracing (1), so the iDMA backend wrote dma_trace_*.log on every run. Rather than couple this to DEBUG (which also pulls in +acc and slows the sim), it now follows the same TRACE opt-out being introduced for the snitch_cc trace: traces on by default, TRACE=OFF disables them.

Two commits:

  • hw: gate the iDMA tracer with the TRACE_OFF opt-out - idma_inst64_top derives .DMATracing from a local DMATrace parameter gated by `ifndef TRACE_OFF, so the iDMA trace is silenced together with the snitch_cc trace under TRACE=OFF.
  • make: wire the TRACE_OFF opt-out into the Verilator flow - the trace define reaches only the vsim bender flags; Verilator builds from the base flags. This adds the TRACE=OFF -> -DTRACE_OFF guard to SN_VLT_BENDER_FLAGS so the opt-out works under Verilator too.

Coordination with the TRACE change

DMATracing is an elaboration-time parameter, so TRACE_OFF has to be a compile define (bender -DTRACE_OFF / --vlog-arg), not just a +define on the vsim run command. SN_VSIM_FLAGS feeds the vsim simulate step (vsim.mk:103/110), while SN_VLOG_FLAGS/bender feed the compile step (vsim.mk:90), so a +define+TRACE_OFF on SN_VSIM_FLAGS alone would not reach either the snitch_cc `ifndef or this parameter. This PR handles the Verilator wiring; the vsim compile-side wiring belongs with the TRACE change.

Verified (iDMA side, self-contained on Verilator)

dma_1d on Verilator: default build -> iDMA dma_trace_*.log present; TRACE=OFF build -> absent. (The snitch_cc .dasm trace stays on the old DEBUG gate until the TRACE change lands, so it reads 0 in both cases here; it will follow TRACE_OFF once that lands.)

Draft until the TRACE change lands; will rebase and re-run the full on/off smoke-check on both flows then.

@DanielKellerM
DanielKellerM marked this pull request as ready for review August 1, 2026 06:58
Copilot AI review requested due to automatic review settings August 1, 2026 06:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR ensures iDMA and Snitch instruction tracing are consistently controlled by a single DEBUG knob across both vsim and Verilator simulation flows, preventing unwanted log generation when DEBUG is off.

Changes:

  • Gate iDMA tracing (DMATracing) behind `ifdef DEBUG by deriving it from a local DMATrace parameter.
  • Wire -DDEBUG into the Verilator Bender flags when DEBUG=ON, aligning behavior with the vsim flow.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
make/verilator.mk Adds conditional -DDEBUG to Verilator’s Bender flags when DEBUG=ON.
hw/snitch_cluster/src/snitch_cc.sv Drives idma_inst64_top.DMATracing from a DEBUG-gated localparam instead of a hardcoded enable.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Follow the snitch TRACE flag (traces on by default, TRACE=OFF disables
via +define+TRACE_OFF) instead of DEBUG, which coupled tracing to the +acc
waveform slowdown. idma_inst64_top derives DMATracing from `ifndef TRACE_OFF,
so the iDMA backend traces by default and is silenced together with the
snitch_cc trace under TRACE=OFF.
The trace define reaches only the vsim bender flags; the Verilator flow
builds from the base flags. Add the TRACE=OFF -> -DTRACE_OFF guard to
SN_VLT_BENDER_FLAGS so the opt-out silences traces under Verilator too.
@DanielKellerM
DanielKellerM force-pushed the idma-trace-follow-debug branch from 8435b4f to 342bbe3 Compare August 3, 2026 12:14
@DanielKellerM
DanielKellerM marked this pull request as draft August 3, 2026 12:15
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