V12.3.2 The Clocks That Never Stopped

MediumDebug20 minap_soc v1.5 · recorded bootReview the topic

A short test should stop two peripheral clocks for a moment. It passed, but both coverage bins it was written to fill stayed empty. Find the transfer that went wrong, and why.

A coverage review found two holes: no test had ever stopped the clock of UART0 or of the timer. Someone wrote the short assembly test below to close both. It stops the two clocks, reads CLK_GATE back, starts them again and passes. It ran on the coverage build of the chip bench.

The merged report still shows both bins empty. The test passed, so the run itself gives no error. The coverage report, the program and its loads and stores are the only evidence. Name the transfer that went wrong first: its cycle, the wrong part, its address and its register. Then choose the cause.

Full specification
The test (assembly, run from ROM after the bench's three instructions that write TB_STATUS = 2). defs.S gives SYSCTL and TB_STATUS.
    li   s0, SYSCTL
    li   t1, 0x1f & ~((1 << 1) | (1 << 3))   # UART0 is source 1, the timer source 3
    sw   t1, 0x14(s0)                         # CLK_GATE: stop both clocks
    lw   t2, 0x14(s0)                         # read it back
    bne  t2, t1, 1f
    li   t1, 0x1f
    sw   t1, 0x14(s0)                         # every clock on again
    li   t1, 0x900d
    sw   t1, TB_STATUS(s0)
2:  j    2b
1:  li   t1, 0xbad00001
    sw   t1, TB_STATUS(s0)
3:  j    3b
CLK_GATE at 0x1000_4014: 1 lets that block's clock run; reset value 0x1F (facts §27.3).
CLK_GATE bit01234
BlockUART0GPIOTimer and PWMSPIDMA
Interrupt source12345

gate.<block>.shut counts each time that block's clock gate closes, as the gate takes its enable at a falling edge of clk_sys. A gate closed for one cycle or more is counted.

Diagnose the Failing Run

Recorded Console and Result

verdict=pass
reason=pass
status=0000900d
mismatches=0
cycles=35

Recorded Coverage

Public plan binHits
gate.uart.shut0
gate.timer.shut0

Retired Memory Transfers

CyclePC (hex)OperationAddress (hex)Data (hex)
1280000008store1000402000000002
1680000014store1000401400000015
1880000018load1000401400000015
2380000024store100040140000001f
2780000030store100040200000900d
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

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.