V3.7.2 The Test That Ended at Its First Fail Word

MediumDebug20 minap_soc v1.5 · recorded bootReview the topic

A test checks two reset values and sets UART0 up. The bench ends it with fail code 2 before it can print "done". Find the transfer that went wrong and say why the test failed.

The test checks the reset values of two registers, CHIP_ID and UART0 DIV. It also sets UART0 up for a later transfer. A wrong reset value writes a fail word: code 1 for CHIP_ID, code 2 for DIV. If both checks pass, it prints "done" and writes the pass word. Its assembly is in the full specification.

The recorded run: its console lines and its last status word.
console: set up uart
console: check resets
TB_STATUS = 0xbad00002
RegisterAddressReset value
CHIP_ID0x1000_40000x2A53_10C5
UART0 DIV0x1000_00100x10 (16)
TB_STATUS0x1000_4020the first pass or fail word ends the test

Find the first transfer whose value is not what the test needed, and choose the cause.

Full specification
The program, in SRAM.
li   s0, SYSCTL
    li   s1, UART
    la   a1, t_setup
    call puts
    li   t1, 8                     # set_up_uart: 8 cycles a bit
    sw   t1, 0x10(s1)
    la   a1, t_resets
    call puts
    lw   t1, 0(s0)                 # check_resets: CHIP_ID
    li   t2, 0x2A5310C5
    beq  t1, t2, 1f
    li   t3, 0xBAD00001
    sw   t3, TB_STATUS(s0)
1:  lw   t1, 0x10(s1)              # UART0 DIV resets to 16
    li   t2, 16
    beq  t1, t2, 2f
    li   t3, 0xBAD00002
    sw   t3, TB_STATUS(s0)
2:  la   a1, t_done
    call puts
    li   t3, 0x900D
    sw   t3, TB_STATUS(s0)
9:  j    9b

Diagnose the Failing Run

Recorded Console and Result

CONSOLE 135: set up uart
CONSOLE 283: check resets
verdict=fail
reason=status_fail
status=bad00002
mismatches=0
cycles=320

Retired Memory Transfers

CyclePC (hex)OperationAddress (hex)Data (hex)
1280000008store1000402000000002
2680000098store1000402400000073
3680000098store1000402400000065
4680000098store1000402400000074
5680000098store1000402400000020
6680000098store1000402400000075
7680000098store1000402400000070
8680000098store1000402400000020
9680000098store1000402400000075
10680000098store1000402400000061
11680000098store1000402400000072
12680000098store1000402400000074
13680000098store100040240000000a
15280000028store1000001000000008
16480000098store1000402400000063
17480000098store1000402400000068
18480000098store1000402400000065
19480000098store1000402400000063
20480000098store100040240000006b
21480000098store1000402400000020
22480000098store1000402400000072
23480000098store1000402400000065
24480000098store1000402400000073
25480000098store1000402400000065
26480000098store1000402400000074
27480000098store1000402400000073
28480000098store100040240000000a
2998000003cload100040002a5310c5
30680000058load1000001000000008
3128000006cstore10004020bad00002
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.

defs.S
# defs.S: addresses and helpers of the smoke programs of ap_soc v1.5 (stage E4).
# check-soc-top.mjs puts this text in front of every program. Numbers: gen/ap_soc_regs.h.
.equ ROM,      0x00000000
.equ CLINT,    0x02000000
.equ PLIC,     0x0C000000
.equ UART,     0x10000000
.equ GPIO,     0x10001000
.equ TIMER,    0x10002000
.equ WDOG,     0x10003000
.equ SYSCTL,   0x10004000
.equ SPI,      0x10005000
.equ DMA,      0x10006000
.equ HOLE,     0x10007000
.equ PWRCTL,   0x10008000
.equ SRAM,     0x80000000
.equ TB_STATUS, 0x20
.equ TB_PUTC,   0x24
.equ TB_EVENT,  0x28
.equ TB_ARG,    0x2C

UART0 · register manual
OffsetRegisterBitsFieldAccessResetHeld byMeaning
0x000TXDATA7:0datawonot storedThe low byte is the next byte to send. Byte to send.
0x004STATUS0roomroblockTransmit room and receive queue state. The transmitter can take a byte.
0x004STATUS1rx_readyroblockAt least one received byte waits.
0x004STATUS2rx_fullroblockThe receive queue is full.
0x008IRQ_ENABLE0roomrw0x0regsWhich status bits raise interrupt source 1. ROOM raises the request.
0x008IRQ_ENABLE1rx_readyrw0x0regsRX_READY raises the request (new in v1.5).
0x00CRXDATA7:0dataroblockThe oldest received byte. The read removes it from the queue. Received byte.
0x010DIV15:0cyclesrw0x0010regsBit time in clk_sys cycles (new in v1.5). clk_sys cycles a bit.
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.