V6.6.2 The Match at Its Exact Cycle

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

Firmware can only say that the timer matched "eventually". From the seat you can say at which cycle. Pin the timer's match to its cycle, and catch every faulty chip of a hidden set.

Hardware context: The SRAM wrapper, the bridges and the checkers of ap_soc v1.5 under stimulus only the seat makes. The timer's match at its exact cycle, and every byte lane.

Write a table for the bus-manager seat that proves the Timer and PWM block matches at its exact cycle. Straight after reset, set DIV_TOP = 2 and COMPARE = 2, enable the match request and ap_plic source 3, and start the timer. The core's external pin must still be low in the cycle before the match is due, and high in the cycle after. Then stop the timer, clear the match, and claim and complete source 3.

Your table must pass on the good chip and fail on each chip of a hidden set. Which faults the set holds, the page does not say. Use the Timeline of a sample run to find the cycles.

Full specification
RegisterAddressUse
DIV_TOP0x1000_200CThe prescaler: the slot advances every DIV_TOP + 1 cycles
COMPARE0x1000_2010The slot (0 to 3) that matches
RUN0x1000_20001 starts the count from the slot it holds; 0 stops it
IRQ_ENABLE, IRQ_CLEAR0x1000_2018, 0x1000_2014Enable the match request; clear it
ap_plic0x0C00_000C priority 3, 0x0C00_2000 enable bit 3, 0x0C20_0004 claimSource 3 is the timer

The delay field of a row is the number of clk_sys cycles the seat waits before that row. A seat row takes a fixed number of cycles, so a table's timing is the same on every run.

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.

Timer and PWM · register manual
OffsetRegisterBitsFieldAccessResetHeld byMeaning
0x000RUN0runrw0x0regsStarts and stops the counter. 1: the counter runs.
0x004DUTY2:0slotsrw0x0regsHow many of the four slots drive the PWM pin high. 0 to 4.
0x008CAPTURED1:0slotroblockThe slot number saved when the capture input fired. Slot number.
0x00CDIV_TOP7:0toprw0x00regsPrescaler: the last count before the slot number steps. A write restarts the prescaler. Last prescaler count.
0x010COMPARE1:0slotrw0x0regsThe slot number that raises match. Slot number.
0x014IRQ_CLEAR0matchwonot storedWriting 1 to bit 0 clears the stored match flag. 1 clears the flag.
0x018IRQ_ENABLE0matchrw0x0regsLets the stored match flag raise interrupt source 3. 1 enables the request.
0x020EVENT0enablerw0x0regsSix teaching fields (S6.8). Plain read and write.
0x020EVENT1onlineroblockA level from the hardware.
0x020EVENT2kickwonot storedA written 1 makes one pulse.
0x020EVENT3pendingw1cblockSet by an event; a written 1 clears it.
0x020EVENT4seenrcblockSet by an event; a read clears it.
0x020EVENT5routerw0x0blockTakes the first write only.
0x024EVENT_COUNT_LOW31:0valueroblockLow 32 bits of the 64-bit event counter. Count, low word.
0x028EVENT_COUNT_HIGH31:0valueroblockHigh 32 bits of the event counter. Count, high word.
ap_plic · register manual
OffsetRegisterBitsFieldAccessResetHeld byMeaning
0x004 + 4 × (n − 1), n = 1 to 16PRIORITY2:0levelrw0x0blockPriority of source n, 0 to 7. 0 never competes. Priority.
0x001000PENDING16:1sourcesroblockPending bits; bit number = source ID. One bit for each source.
0x002000ENABLE16:1sourcesrw0x0000blockEnable bits; bit number = source ID. One bit for each source.
0x200000THRESHOLD2:0levelrw0x0blockThe core sees a request only above this priority. Threshold.
0x200004CLAIM4:0idrw0x00blockRead: claim, returns the winner's ID and clears its pending bit. Write: complete, names the ID that is done. Source ID.

Examples

Example 1

The Good Chip
Input
your table
Output
pass

The pin is low in the cycle before the match and high in the cycle after.

Example 2

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

A match that comes early, late or never fails one of your rows.

Example 3

What Does Not Count
Input
a wait for the pin with a limit
Output
refused

It passes on a timer that matches too early.

Constraints and Contract

  • At most 64 rows.
  • The good chip must pass. Each hidden faulty chip must fail one of your rows.

Hints

Hint 1

A wait that ends "when the pin rises" passes on a chip whose timer is early.

Hint 2

Check the pin twice: low in the cycle before the match, high in the cycle after.

Hint 3

The delay of a row counts from the end of the row before it.

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. The hidden set holds timers whose match comes early, much later or not at all, or just one clock late. So a table must check both edges: the pin low just before the match, and high in the cycle after. On the late chip the bench's own timer monitor is off, so only your rows can see it. The grader cannot see which row caught which chip; it sees only that each hidden chip fails. The Timeline of a sample run shows the first 256 cycles of the good chip.

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

The pin is low in the cycle before the match and high in the cycle after.

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

ap_soc v1.5 · bus seat · server