V6.2.1 A Reset Check from the Description

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

Turn the register description of three blocks into a reset check. Check every reset value under the right mask, every access that must answer ERROR, and a hole in each page.

Hardware context: The register description of ap_soc v1.5 (regs/*.json, the register-model table) turned into a sweep. A reset check of three blocks from their description.

The table below is the register-model description of UART0, GPIO and ap_sysctl, one line per field. Write the reset check it implies, as a sequence table for the bus-manager seat. The table runs straight after reset.

Read every register that has a readable field. Check each field that has a reset value and does not move by itself. Where the reads of a register answer ERROR, check that a read does; do the same for writes. Leave TB_STATUS, TB_PUTC and TB_EVENT alone: the bench reads a meaning into them. Last, offset 0xFFC of each page holds no register: check that it answers ERROR to a read and to a write.

This is ap_soc's rule for a wrong access (facts 27.6): an error, not a silent zero. Hidden faulty chips each break one thing your check covers.

Full specification
RegisterAddressFieldBitsAccessResetMoves by itselfA readA write
TXDATA0x1000_0000data7:0wo—noERROROKAY
STATUS0x1000_0004room0ro—yesOKAYERROR
STATUS0x1000_0004rx_ready1ro—yesOKAYERROR
STATUS0x1000_0004rx_full2ro—yesOKAYERROR
IRQ_ENABLE0x1000_0008room0rw0x0noOKAYOKAY
IRQ_ENABLE0x1000_0008rx_ready1rw0x0noOKAYOKAY
RXDATA0x1000_000cdata7:0ro—yesOKAYERROR
DIV0x1000_0010cycles15:0rw0x10noOKAYOKAY
DIR0x1000_1000value15:0rw0x0noOKAYOKAY
IN0x1000_1004value15:0ro—yesOKAYERROR
OUT0x1000_1008value15:0rw0x0noOKAYOKAY
SET0x1000_100cvalue15:0w1s—noERROROKAY
CLR0x1000_1010value15:0w1c—noERROROKAY
TGL0x1000_1014value15:0w1t—noERROROKAY
IRQ_ENABLE0x1000_1018value15:0rw0x0noOKAYOKAY
LEVEL_MODE0x1000_101cvalue15:0rw0x0noOKAYOKAY
ACTIVE_HIGH0x1000_1020value15:0rw0xffffnoOKAYOKAY
STATUS0x1000_1024value15:0w1c—yesOKAYOKAY
MASKED_STATUS0x1000_1028value15:0ro—yesOKAYERROR
CHIP_ID0x1000_4000value31:0ro0x2a5310c5noOKAYERROR
RESET_CAUSE0x1000_4004power_on0ro—yesOKAYERROR
RESET_CAUSE0x1000_4004pin1ro—yesOKAYERROR
RESET_CAUSE0x1000_4004watchdog2ro—yesOKAYERROR
RESET_CAUSE0x1000_4004software3ro—yesOKAYERROR
RESET_CAUSE0x1000_4004debug4ro—yesOKAYERROR
SOFT_RESET0x1000_4008timer0wo—noERROROKAY
SOFT_RESET0x1000_4008chip1wo—noERROROKAY
STRAPS0x1000_400cboot0ro—yesOKAYERROR
PINMUX0x1000_4010select31:0rw0x0noOKAYOKAY
CLK_GATE0x1000_4014uart00rw0x1noOKAYOKAY
CLK_GATE0x1000_4014gpio1rw0x1noOKAYOKAY
CLK_GATE0x1000_4014timer2rw0x1noOKAYOKAY
CLK_GATE0x1000_4014spi3rw0x1noOKAYOKAY
CLK_GATE0x1000_4014dma4rw0x1noOKAYOKAY
LOCK0x1000_4018pinmux0w1s0x0noOKAYOKAY
LOCK0x1000_4018clk_gate1w1s0x0noOKAYOKAY
LOCK0x1000_4018debug2w1s0x0noOKAYOKAY
TB_STATUS0x1000_4020value31:0rw0x0noOKAYOKAY
TB_PUTC0x1000_4024value31:0rw0x0noOKAYOKAY
TB_EVENT0x1000_4028value31:0rw0x0noOKAYOKAY
TB_ARG0x1000_402cvalue31:0rw0x0noOKAYOKAY

Bits shows the field's position. A read or a write of ERROR means the register has no readable or no writable field. "Moves by itself" marks a field the hardware changes; mask it out of a reset read.

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.

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.
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.
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; visited shows UART0, GPIO, ap_sysctl and an ERROR

Every reset value matches the description, and every wrong access answers ERROR.

Example 2

A Hidden Faulty Chip
Input
your table on a faulty chip
Output
fail

One reset value or one read path is wrong; one of your rows must see it.

Example 3

A Volatile Field
Input
RESET_CAUSE with every bit in the mask
Output
fails on the good chip

The power-on bit is set after the first reset. A reset read must mask what moves.

Constraints and Contract

  • At most 120 rows.
  • The good chip must pass straight after reset. Each hidden faulty chip must fail one of your rows.

Hints

Hint 1

RESET_CAUSE says why the chip reset: its bits move by themselves.

Hint 2

A register with only write-only fields answers ERROR to a read: use core re.

Hint 3

The mask of a reset read is the OR of its fixed fields' masks. Its expect is the OR of their reset values, each in its own field.

What the grader checks: Your table runs straight after reset with +core=bfm, on the good chip and on several hidden faulty chips. The good chip must pass, and the region map must show UART0, GPIO, ap_sysctl and an ERROR answer. The grader cannot see whether you covered every register, only that each hidden chip fails.

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; visited shows UART0, GPIO, ap_sysctl and an ERROR

Every reset value matches the description, and every wrong access answers ERROR.

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

ap_soc v1.5 · bus seat · server