V6.7.2 The Debug Path in a Budget

HardOptimize35 minap_soc v1.5 · bus seat · serverReview the topic

Test the debug path from the JTAG pads to the debug module's bus manager, and catch every fault of a hidden set. The catch: the table must finish within a cycle budget.

Hardware context: The E9 fault table of ap_soc v1.5: 85 seeded faults and the kinds of test that caught each. The debug path tested within a cycle budget.

The debug path runs from the four JTAG pads through the TAP and the debug module to that module's own bus manager. The bench's JTAG host drives the pads; jtag rows of a table use it. Write a table for the bus-manager seat that tests the path and fails on each chip of a hidden set. Which faults the set holds, the page does not say.

The given table catches them all, but it takes 5,686 cycles. Yours must end within 2,300 cycles on the good chip. Choose your rows by what each one proves and what it costs.

How tight is the budget? A table that does the job in the fewest rows takes about 2,038 cycles, 262 under it. One extra write through the debug module costs about 943, so it does not fit.

Full specification
RowCost on the good chip (cycles of clk_sys)What it does
jtag idcodeabout 190TAP reset, read IDCODE, compare
jtag mw a dabout 943A word written by the debug module's bus manager
jtag mr a 0 m eabout 943A word read by the debug module's bus manager
core r, core wabout 3A transfer of the seat

IDCODE is 0x2A53_10C5. SRAM is at 0x8000_0000. The budget is a ceiling on the cycles of the whole run, from reset to the pass word.

Rows: who op address data mask expect delay repeat (two words, four hex numbers, two decimal numbers). A core r row checks (value & mask) == (expect & mask). Rows core re and core we must answer ERROR. A core poll row reads until the masked value matches, at most data reads. The bench manual lists every row.

Given Files

Read-only files supplied by the bench.

The sequence table · bench manual

One row a line: who op address data mask expect delay repeat. Two words, four hex numbers, two decimal numbers. delay: cycles to wait before the row. repeat: how often the row runs. A line that starts with # is a comment. With +core=bfm the table is the test: the bench writes TB_STATUS = 2 before the first row and the pass or fail word after the last. With +core=cpu a table holds the bench's side of a firmware test.

whoopMeaning
corew wh wbWrite a word, a half, a byte of data at address; the answer must be OKAY
corer rh rbRead; (value & mask) must equal (expect & mask)
corewe reWrite or read that must answer ERROR
corewq rqAs w and r, with the next row's address phase on this row's data phase (back to back)
corepollRead until the masked value is the expected one; data = the most reads (0: 1,000)
coreirqThe interrupt pins now (bit 0 software, 1 timer, 2 external) against mask and expect
corewait_irqWait until a pin of mask is high; data = the most cycles
coreidleEnd a back-to-back run
dmacopyOne job from address to data of mask bytes; STATUS must be expect (2 DONE, 4 FAULT)
jtagidcodeTAP reset, read IDCODE, compare
jtaghalt resume stepDebug control (a halt waits for the core)
jtagrr rwRead or write the register numbered address (0x1000 + n, a CSR, 0x7b0, 0x7b1)
jtagstreamStart background word reads at address A, count D, maximum random gap M, expected word E
tbwait_releaseWait for the system bus and core resets to release. Seat tables also hold each row at dispatch during reset.
tbwatchdogSet the seat stall limit to data system clocks (zero disables it). A stalled request reports its row, address and direction.
tbgapsMaximum random gap D before each seat row, in system cycles (0 disables gaps)
jtagmr mwRead or write a word of memory through the debug manager
jtagarm status"Halt at reset" = data; {halted, error, busy} against mask and expect
jtagcmdCommand number address (0 to 7, facts 27.10) with the word data; its reply against mask and expect
tbuart_sendSend the byte data to the chip
tbuart_expectThe next byte from the chip must be expect; address = the most bit times to wait
tbgpio_set gpio_pulsePad address to level data; a pulse of data cycles of CLK
tbgpio_expectThe sixteen pads against mask and expect
tbreset supplyThe reset pin, or the supply, for data cycles of CLK
tbwait_eventWait until the test writes address to TB_EVENT
tbargDeposit data in TB_ARG
tbwait_statusWait until (TB_STATUS & mask) equals (expect & mask)
tbpoke peekBack-door write of mask bytes (0: 4) of data; back-door read against mask, expect
tbwaitOnly the delay
syma symbol nameBack-door write of data to that C variable, with the symbol's size

core and dma rows need +core=bfm. soc-rows.mjs turns a list of core and tb rows into both forms: a table for the seat, or a table in SRAM for an interpreter in ROM, with a hand-shake wherever the list goes from one side to the other.

ap_sysctl · register manual
OffsetRegisterBitsFieldAccessResetHeld byMeaning
0x000CHIP_ID31:0valuero0x2A5310C5constThe chip's identity: the IDCODE of the TAP. Fixed number.
0x004RESET_CAUSE0power_onroblockSticky record of reset sources since power-on. Power-on reset.
0x004RESET_CAUSE1pinroblockReset pin.
0x004RESET_CAUSE2watchdogroblockWatchdog.
0x004RESET_CAUSE3softwareroblockSoftware request.
0x004RESET_CAUSE4debugroblockDebug request.
0x008SOFT_RESET0timerwonot storedReset requests from software. 1 arms one restart of the timer.
0x008SOFT_RESET1chipwonot stored1 requests the software reset (new in v1.5).
0x00CSTRAPS0bootroblockStraps as sampled at power-up (new in v1.5). 0: start in the boot ROM. 1: start in SRAM.
0x010PINMUX31:0selectrw0x00000000regsTwo bits for each of sixteen pads: 0 released, 1 GPIO, 2 serial, 3 auxiliary. Pad n uses bits 2n+1 and 2n.
0x014CLK_GATE0uart0rw0x1regs1 lets that block's clock run (new in v1.5). UART0.
0x014CLK_GATE1gpiorw0x1regsGPIO.
0x014CLK_GATE2timerrw0x1regsTimer and PWM.
0x014CLK_GATE3spirw0x1regsSPI.
0x014CLK_GATE4dmarw0x1regsDMA.
0x018LOCK0pinmuxw1s0x0regsWrite-once locks. Only a reset clears one (new in v1.5). 1: PINMUX ignores writes.
0x018LOCK1clk_gatew1s0x0regs1: CLK_GATE ignores writes.
0x018LOCK2debugw1s0x0regs1: the debug lock is closed.
0x020TB_STATUS31:0valuerw0x00000000regs (power-on reset only)Scratch word 0. The firmware kit reports progress, pass and fail here. Plain storage.
0x024TB_PUTC31:0valuerw0x00000000regs (power-on reset only)Scratch word 1. The firmware kit writes one character here. Plain storage.
0x028TB_EVENT31:0valuerw0x00000000regs (power-on reset only)Scratch word 2. The firmware kit writes an event number here. Plain storage.
0x02CTB_ARG31:0valuerw0x00000000regs (power-on reset only)Scratch word 3. A bench leaves a word for the firmware here. Plain storage.

Examples

Example 1

The Good Chip
Input
your table
Output
pass, at most 2,300 cycles

Every part of the path is shown to work, and the run fits the budget.

Example 2

The Given Table
Input
the starter
Output
pass, about 5,686 cycles: over budget

It reads IDCODE before every operation and reads back through JTAG what the seat could read for free.

Example 3

Too Few Rows
Input
no read through the debug module
Output
refused

A fault in the manager's read path is invisible without one.

Constraints and Contract

  • At most 32 rows.
  • The good chip must pass within 2,300 cycles. Each hidden faulty chip must fail one of your rows.

Hints

Hint 1

Which faults can only a read through the debug module show, and which only a write?

Hint 2

A seat row costs a few cycles; a jtag row costs hundreds. Let the seat do the checking.

Hint 3

Which parts of the path does IDCODE use that nothing else does?

What the grader checks: Your table runs on the pre-built ap_soc v1.5 bench with +core=bfm, on the good chip and on several hidden faulty chips. The good chip must pass within 2,300 cycles; the budget is a ceiling. The timing of the seat and of the JTAG host does not depend on a compiler. The costs on the page are the costs your table will see. The grader cannot see which rows caught a faulty chip.

1 checks on ap_soc v1.5 · bus seat · server. Run the examples first, then check the full regression. Full checks use the server judge. Downloads contain your text only; the chip, the bench and the hidden checks stay on the server. A passing result establishes the tested cases, not a proof for all possible inputs.

See all 2 problems on this path

Report a problem with this page

Your code Sequence tableSaved locally
Ln 1, Col 1Tab indents · Ctrl/⌘ + Enter runs samples
Not run yet

The Good Chip

Input
your table
Expected output
pass, at most 2,300 cycles

Every part of the path is shown to work, and the run fits the budget.

Run samples executes all 1 public checks. Check all tests runs 1 checks on the server.

ap_soc v1.5 · bus seat · server