V7.5.2 Make the Livelock Show

MediumBreak It25 minap_soc v1.5 · bus seat · serverReview the topic

A faulty matrix loses a transfer when one target changes owner. Build the traffic that makes it fail. The failure must be a check that ends the run.

Hardware context: ap_soc's bench and its limits: the no-progress limit, the hang limit, a poll's limit, the debug host's give-up. Making a livelock fail a check.

On this chip each target port of the matrix has a fault. Say the manager it last served differs from the one it now grants. Then the target sees the transfer, but the manager is not told it was accepted. The target sees the transfer; the manager keeps waiting and asks again. With two managers taking turns at one target, neither ever finishes.

Write a table that passes on the good chip and fails visibly on this one. "Visibly" means a row's check fails. A run that only stops making progress, or meets its cycle limit, does not count. Nothing in such a run says what went wrong. A good chip waiting for an event no one sends ends the same way.

Of the managers you can drive, only the debug manager has a limit on its own wait (see below). While the seat is stuck, no seat row can fail, so the failing row has to be another manager's.

Full specification

Traffic rows (bench manual, "Interconnect and boot experiments (E19)"). jtag stream A D M E starts D debug reads of the word at A. Each read waits a random 0 to M cycles first and is compared with E. The next jtag row and the end of the table wait for the stream. tb gaps 0 D puts a random gap of 0 to D cycles before each later core row; 0 turns gaps off. core rq and core wq put the next row's address phase on this row's data phase. core idle ends such a run.

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.

The bench's JTAG host gives up on a debug read after 64 scans that answer BUSY. The read then returns 0 (tools/soc/ap_soc/bench/soc_tb/soc_pads.sv). Each case gives the bench a seed, and all random gaps come from it. A run with one seed is the same every time.

SRAM is at 0x8000_0000.

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.

Examples

Example 1

The Good Chip
Input
your table
Output
pass

Both managers finish every read.

Example 2

The Faulty Chip
Input
your table on the stated chip
Output
fail: a bench check failed

A debug read gives up and returns 0, which its check refuses.

Example 3

What Does Not Count
Input
the seat alone, or a table that just stops
Output
refused

One manager never changes the owner. A stuck run reports nothing.

Constraints and Contract

  • At most 32 rows.
  • The good chip must pass. The stated faulty chip must fail one of your rows.

Hints

Hint 1

Which two managers can you keep asking for SRAM in the same cycles?

Hint 2

The seat will be stuck too. Which manager has a limit on its own wait?

Hint 3

The debug manager gives up after 64 busy scans and reads 0: give its read an expected value that is not 0.

What the grader checks: Your table runs on the pre-built ap_soc v1.5 bench with +core=bfm. On the good chip it must pass. On the stated faulty chip a row's check must fail. A run that ends by the cycle limit or the no-progress limit does not count. The grader cannot see which row failed.

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

Both managers finish every read.

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

ap_soc v1.5 · bus seat · server