V12.4.2 One Failure from the Nightly Run

MediumDebug20 minap_soc v1.5 · recorded bus-manager run of the regression, seed 3, on a candidate buildReview the topic

The nightly regression ran the interrupt-priority table on a new candidate build, and it failed. Triage picked one failing run. Find the first transfer that went wrong, and choose the cause.

This chip is a candidate build under test, not the chip of the other problems. The regression ran the table below on the bus-manager seat. A first row of random gaps went in front, with nine seeds. The table failed on 9 of the 9 seeds with the same first message. Triage picked the run of seed 3.

The table as the bench reads it: one row a line.
# who op         address  data     mask     expect   delay repeat
tb    gaps       00000000 00000006 ffffffff 00000000     0      1
core  w          0c000008 00000002 ffffffff 00000000     0      1
core  w          0c00000c 00000005 ffffffff 00000000     0      1
core  w          0c002000 0000000c ffffffff 00000000     0      1
core  w          0c200000 00000005 ffffffff 00000000     0      1
core  w          10001018 00000800 ffffffff 00000000     0      1
tb    gpio_pulse 0000000b 00000004 ffffffff 00000000     0      1
core  w          1000200c 00000003 ffffffff 00000000     0      1
core  w          10002010 00000001 ffffffff 00000000     0      1
core  w          10002018 00000001 ffffffff 00000000     0      1
core  w          10002000 00000001 ffffffff 00000000     0      1
core  poll       0c001000 00000000 0000000c 0000000c     0      1
core  r          0c200004 00000000 ffffffff 00000003     0      1
core  r          0c001000 00000000 0000000c 00000004     0      1
core  r          0c200004 00000000 ffffffff 00000002     0      1

The table raises two requests: a pulse on pad IO11 (GPIO, PLIC source 2) and a timer match (source 3). It sets source 2 to priority 2 and source 3 to priority 5, enables both and writes the threshold. Then it waits until both are pending, claims once, and reads PENDING and the claim again.

With the seat nothing retires, so there is no retire trace. The table Seat Transfers holds the seat's transfers, read from the bench's sample window of its data port. Name the first transfer whose value is not what a correct chip would give. Give its cycle, whether its address or its data was wrong, its address and its register. Then choose the cause.

Full specification
ap_plic registerAddressUse
PRIORITY(n)0x0C00_0000 + 4nPriority of source n
PENDING0x0C00_1000Bit n: source n waits
ENABLE0x0C00_2000Bit n: source n may interrupt
THRESHOLD0x0C20_0000The core is told only of a winner above it
CLAIM0x0C20_0004Read: claim; write: complete

A claim read returns the highest-priority pending, enabled source, and clears the pending bit of that source only. On this chip a claim returns the winner whatever the threshold; the threshold only decides whether the core is notified (rtl/ap_plic_core.sv). A write of the ID to CLAIM completes it. A read of CLAIM with nothing to claim returns 0.

A row's mask says which bits it checks: mask 0000000c checks bits 3 and 2.

Diagnose the Failing Run

Recorded Console and Result

BENCH 75: seat: read 0c001000 = 00000000, expected 00000004 (mask 0000000c)
BENCH 80: seat: read 0c200004 = 00000000, expected 00000002 (mask ffffffff)
verdict=fail
reason=checker
status=00000002
mismatches=0
cycles=83

Seat Transfers

CycleOperationAddress (hex)Data (hex)
7store1000402000000002
10store0c00000800000002
15store0c00000c00000005
21store0c0020000000000c
24store0c20000000000005
29store1000101800000800
47store1000200c00000003
50store1000201000000001
53store1000201800000001
56store1000200000000001
62load0c00100000000004
64load0c0010000000000c
69load0c20000400000003
74load0c00100000000000
79load0c20000400000000
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.

ap_plic · register manual
OffsetRegisterBitsFieldAccessResetHeld byMeaning
0x004 + 4 × (n − 1), n = 1 to 16PRIORITY2:0levelrw0x0blockPriority of source n, 0 to 7. 0 never competes. Priority.
0x001000PENDING16:1sourcesroblockPending bits; bit number = source ID. One bit for each source.
0x002000ENABLE16:1sourcesrw0x0000blockEnable bits; bit number = source ID. One bit for each source.
0x200000THRESHOLD2:0levelrw0x0blockThe core sees a request only above this priority. Threshold.
0x200004CLAIM4:0idrw0x00blockRead: claim, returns the winner's ID and clears its pending bit. Write: complete, names the ID that is done. Source ID.
GPIO · register manual
OffsetRegisterBitsFieldAccessResetHeld byMeaning
0x000DIR15:0valuerw0x0000regs1 turns the output driver of that pin on. One bit for each pin.
0x004IN15:0valueroblockThe pin levels, after two sampling flip-flops. One bit for each pin.
0x008OUT15:0valuerw0x0000regsThe saved output value. One bit for each pin.
0x00CSET15:0valuew1sacts on OUT.valueA 1 sets that bit of OUT. One bit for each pin.
0x010CLR15:0valuew1cacts on OUT.valueA 1 clears that bit of OUT. One bit for each pin.
0x014TGL15:0valuew1tacts on OUT.valueA 1 inverts that bit of OUT. One bit for each pin.
0x018IRQ_ENABLE15:0valuerw0x0000regsA 1 lets that pin's status bit raise interrupt source 2. One bit for each pin.
0x01CLEVEL_MODE15:0valuerw0x0000regs1: the pin is a level cause. 0: an edge cause. One bit for each pin.
0x020ACTIVE_HIGH15:0valuerw0xFFFFregs1: a high level, or a rising edge, is the event. One bit for each pin.
0x024STATUS15:0valuew1cblockRaw status. A written 1 clears the saved edge flag of that pin. One bit for each pin.
0x028MASKED_STATUS15:0valueroblockSTATUS AND IRQ_ENABLE. One bit for each pin.
Timer and PWM · register manual
OffsetRegisterBitsFieldAccessResetHeld byMeaning
0x000RUN0runrw0x0regsStarts and stops the counter. 1: the counter runs.
0x004DUTY2:0slotsrw0x0regsHow many of the four slots drive the PWM pin high. 0 to 4.
0x008CAPTURED1:0slotroblockThe slot number saved when the capture input fired. Slot number.
0x00CDIV_TOP7:0toprw0x00regsPrescaler: the last count before the slot number steps. A write restarts the prescaler. Last prescaler count.
0x010COMPARE1:0slotrw0x0regsThe slot number that raises match. Slot number.
0x014IRQ_CLEAR0matchwonot storedWriting 1 to bit 0 clears the stored match flag. 1 clears the flag.
0x018IRQ_ENABLE0matchrw0x0regsLets the stored match flag raise interrupt source 3. 1 enables the request.
0x020EVENT0enablerw0x0regsSix teaching fields (S6.8). Plain read and write.
0x020EVENT1onlineroblockA level from the hardware.
0x020EVENT2kickwonot storedA written 1 makes one pulse.
0x020EVENT3pendingw1cblockSet by an event; a written 1 clears it.
0x020EVENT4seenrcblockSet by an event; a read clears it.
0x020EVENT5routerw0x0blockTakes the first write only.
0x024EVENT_COUNT_LOW31:0valueroblockLow 32 bits of the 64-bit event counter. Count, low word.
0x028EVENT_COUNT_HIGH31:0valueroblockHigh 32 bits of the event counter. Count, high word.