V7.1.2 Every Route on the Map

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

Turn the memory map into a route test. Send the seat, the DMA and the debug manager to every target they can reach, and every hole an error. Hidden faulty chips each break one route.

Hardware context: The fabric of ap_soc v1.5: generated decoders, a four-manager AHB-Lite matrix, default subordinates and two bridges. A route test from three managers, holes included.

The fabric of ap_soc is the thing under test. Its map is a test list: each window is a route that must reach its target, and each hole must answer ERROR. Three managers can drive the fabric from the bench. They are the bus-manager seat in the core's port, the DMA, and the debug manager behind the JTAG pads.

Write a sequence table that proves the routes. From the seat, reach each of the five AHB targets: ROM, ap_clint, ap_plic, SRAM and the bridge. Reach a register behind the fast APB bus and one behind the slow APB bus. Prove the first and the last word of SRAM. A write to ROM must answer ERROR.

From the DMA: a copy from a fast APB register into SRAM, checked byte for byte. Its destination must not be a multiple of 4. Then a copy from SRAM into a register, and one from the last word of SRAM. Then a copy whose source is a hole, which must end in FAULT. From the debug manager: a read of a register and a write to SRAM that the seat reads back. Add a read of a hole, and check its ERROR bit. Last, from the seat: a read of each kind of hole answers ERROR.

Each hidden faulty chip breaks one route. Your table must pass on the good chip and fail on each of them.

Full specification
TargetWindowA value to prove the route
Boot ROM0x0000_0000 to 0x0000_0FFFA read answers OKAY (no image is loaded: 0). A write answers ERROR
ap_clint0x0200_0000 (MSIP)Bit 0 is read and write
ap_plic0x0C00_0004 (priority of source 1)Bits 2:0 are read and write
SRAM0x8000_0000 to 0x8000_FFFFAny word
Fast APBap_sysctl CHIP_ID 0x1000_4000; UART0 DIV 0x1000_0010CHIP_ID reads 0x2A53_10C5. DIV: 16 bits, reset value 16
Slow APBap_pwrctl STATUS 0x1000_8004; WAKE_ENABLE 0x1000_8008STATUS bit 6 reads 1 while PD_PER is on. WAKE_ENABLE: bits 1:0
Holes0x4000_0000 (no AHB target); 0x8001_0000 (above SRAM); 0x1000_7000 (an APB page nobody owns); 0x1000_9000 (reserved)ERROR

Debug rows: jtag mr A 0 M E reads the word at A through the debug manager. It checks (value & M) == (E & M). jtag mw A D writes it. jtag status 0 0 M E checks the last command's {halted, error, busy} against M and E. Bit 1 is ERROR.

The DMA: write SRC, DST and LEN, then 1 to START. STATUS bit 0 is BUSY, bit 1 DONE, bit 2 FAULT; write 1 to clear bits 1 and 2. It moves one byte at a time. An address in the APB window stays fixed for the whole job (facts 27.9). Any other address steps by one. A dma copy row does all of this and waits for the end.

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.

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.
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.
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.
ap_pwrctl · register manual
OffsetRegisterBitsFieldAccessResetHeld byMeaning
0x000REQUEST0sleepwonot storedStarts a power sequence of PD_PER. 1 starts the switch-off.
0x000REQUEST1wakewonot stored1 starts the switch-on.
0x004STATUS2:0stateroblockWhere the sequencer is, and the levels it drives. 0 on, 1 isolate, 2 save, 3 off, 4 switch on, 5 restore.
0x004STATUS4isolateroblockIsolation enable.
0x004STATUS5saveroblockRetention save level.
0x004STATUS6power_onroblockPower switch closed.
0x008WAKE_ENABLE0padrw0x0regsWhich events may wake PD_PER. The wake detector.
0x008WAKE_ENABLE1watchdogrw0x0regsThe watchdog's early warning.
0x00CWAKE_CAUSE0padw1cblockWhy the last wake happened. A written 1 clears a bit. The wake detector.
0x00CWAKE_CAUSE1watchdogw1cblockThe watchdog's early warning.
0x00CWAKE_CAUSE2softwarew1cblockREQUEST bit 1.
0x010IRQ_ENABLE2:0causerw0x0regsWhich wake causes raise interrupt source 9. Numbered as WAKE_CAUSE.

Examples

Example 1

The Good Chip
Input
your table
Output
pass; visited shows every region and an ERROR

Every manager reaches every target, and every hole answers ERROR.

Example 2

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

One route goes somewhere else or loses a byte; a row or a block monitor sees it.

Example 3

What Does Not Count
Input
a table from the seat alone
Output
refused

A route that only the DMA uses is never tried.

Constraints and Contract

  • At most 120 rows.
  • The good chip must pass. The run must visit ROM, ap_clint, ap_plic, SRAM, UART0, ap_sysctl, the DMA registers and ap_pwrctl, and see an ERROR. Each hidden faulty chip must fail one of your rows.

Hints

Hint 1

A DMA copy from a register reads the same address every time: four copies of its byte 0.

Hint 2

A destination that is not a multiple of 4 puts the first byte in lane 1, 2 or 3. Read the words around it with a mask.

Hint 3

Every route needs a value that only the right target gives back.

What the grader checks: Your table runs on the pre-built ap_soc v1.5 bench with +core=bfm, on the good chip and on several hidden faulty chips. The good chip must pass with no bench error and visit every region the contract names. The block monitors of the bench, such as the DMA monitor and the bus checkers, watch every run. A faulty chip can fail on their line. The grader cannot see which manager reached which target; it sees the regions visited and 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 every region and an ERROR

Every manager reaches every target, and every hole 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