V7.3.2 The Copy That Never Finished

HardDebug25 minap_soc v1.5 · recorded bus-manager run on a bring-up buildReview the topic

A bring-up table starts a DMA copy inside SRAM and reads SRAM beside it with the seat. The copy never finishes. Find the first transfer whose value was already wrong, and say why the chip gave it.

This chip is a build under bring-up, not the chip of the other problems. The table below ran on the bus-manager seat. It writes two source words and starts a DMA copy of 8 bytes inside SRAM. Then it reads a word beside them six times back to back. Then it waits 200 cycles, far longer than the copy takes on a good chip, and checks.

WhoOperationAddressDataMaskExpectDelayRepeat
corew8000300011223344ffffffff0000000001
corew8000300455667788ffffffff0000000001
corew1000600080003000ffffffff0000000001
corew1000600480003100ffffffff0000000001
corew1000600800000008ffffffff0000000001
corew1000600c00000001ffffffff0000000001
corerq8000304000000000000000000000000006
coreidle0000000000000000ffffffff0000000001
tbwait000000000000000000000000000000002001
corer1000601400000000000000000000000001
corer1000600800000000000000000000000001
corer8000300000000000ffffffff1122334401
corer8000300400000000ffffffff5566778801
corer8000310000000000ffffffff1122334401
corer8000310400000000ffffffff5566778801

Two reads only log their value: their mask is 0. The bench counts rows from 0. Here is how the run ended, from the result block:

verdict fail, reason checker, TB_STATUS 0xbad00002, 252 cycles, bench errors 2, table_hang 0, DMA bytes 0

The bench's lines
BENCH 244: seat: read 80003100 = 00000000, expected 11223344 (mask ffffffff)
BENCH 246: seat: read 80003104 = 00000000, expected 55667788 (mask ffffffff)

With the seat nothing retires, so there is no retire trace. The table Seat Transfers holds the seat's transfers instead, from the bench's sample window of its data port. Each row has the cycle of its address phase and the data of its data phase. The DMA's own transfers are not in it: you see the DMA only through its registers and the words it wrote.

Name the first transfer whose value is not what a good chip gives. Give its cycle, what was wrong with it, its address and its name in the register list. Then choose the cause.

Full specification

DMA registers (base 0x1000_6000): SRC 0x00, DST 0x04, LEN 0x08 (bytes), START 0x0C (write 1), STATUS 0x14. STATUS bit 0 is BUSY, bit 1 DONE, bit 2 FAULT. The DMA moves one byte at a time: a read, then a write.

TB_STATUS at 0x1000_4020 is the bench's own word: 2 when the table starts, then pass or fail. SRAM_SOURCE, SRAM_BESIDE and SRAM_DESTINATION name the SRAM words this table uses.

Diagnose the Failing Run

Recorded Console and Result

BENCH 244: seat: read 80003100 = 00000000, expected 11223344 (mask ffffffff)
BENCH 246: seat: read 80003104 = 00000000, expected 55667788 (mask ffffffff)
verdict=fail
reason=checker
status=bad00002
cycles=252
bench_errors=2
table_hang=0
dma_bytes=0

Seat Transfers

CycleOperationAddress (hex)Data (hex)
7store1000402000000002
10store8000300011223344
12store8000300455667788
14store1000600080003000
17store1000600480003100
20store1000600800000008
23store1000600c00000001
26load8000304000000000
27load8000304000000000
29load8000304000000000
30load8000304000000000
31load8000304000000000
32load8000304000000000
233load1000601400000001
236load1000600800000008
239load8000300011223344
241load8000300455667788
243load8000310000000000
245load8000310400000000
247store10004020bad00002
Step 1 · The first bad cycle and signal
Step 2 · The cause

Given Files

Use the register map to identify the transfer in the recording.

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.

DMA · register manual
OffsetRegisterBitsFieldAccessResetHeld byMeaning
0x000SRC31:0addressrw0x00000000regsThe address of the first byte to read. Byte address.
0x004DST31:0addressrw0x00000000regsThe address of the first byte to write. Byte address.
0x008LEN31:0bytesrw0x00000000regsThe number of bytes. Byte count.
0x00CSTART0startwonot storedBit 0 = 1 starts the job. Software writes it last. 1 starts the job.
0x014STATUS0busyroblockJob state (new in v1.5). A job is running.
0x014STATUS1donew1cblockThe last write of a job has finished.
0x014STATUS2faultw1cblockA bus error stopped the job.
0x018IRQ_ENABLE0donerw0x0regsWhich status bits raise interrupt source 5 (new in v1.5). DONE raises the request.
0x018IRQ_ENABLE1faultrw0x0regsFAULT raises the request.