V9.2.1 A Release-Order Checker

MediumVerify30 minap_soc v1.5 · clock and reset checker · serverReview the topic

Write a passive checker of the chip's reset release order, built into the chip bench at its clock-and-reset logic. It stays silent through every kind of reset on the good chip and reports on hidden faulty chips.

Hardware context: The release order of ap_crg: the bus before the core, and a warm reset during a DMA copy. A release-order checker at the clock-and-reset logic.

A chip releases its resets in steps. ap_soc lets the bus out of reset first, then the core, so the core's first fetch finds a bus that already runs. A test that checks only that both resets are up at the end cannot see a wrong order. A checker that watches every edge can.

The bench builds your checker into soc_tb at the clock-and-reset logic, ap_crg. It runs on clk_sys, and its resetn is the power-on reset. So it can watch the system and core resets while they are low. Write the body. Report when one of three rules breaks.

Rule 1: the core is never out of reset while the bus is in reset. Rule 2: the core leaves reset only after the bus has left it, never in the same edge. Rule 3: a reset request is taken back once its reset has come. A request from the watchdog or the software register that stays high over 60 edges of clk_sys has outlived its reset.

Each check runs a table on the bus-manager seat. Every table lets the watchdog bite once, then makes one more reset. It is a pin reset, a software reset, a power failure, a long pin reset, or a pin reset mid-copy. On the good chip your checker stays silent; on each hidden chip it must report.

Full specification
The module the server wraps around your body (you write only the body)
module learner_checker(input logic clk, resetn, resetn_sys, resetn_core, wdog_reset_req, soft_reset_req, output logic report);
  // your body
endmodule
PortSignal of ap_crgNote
clkclk_sysThe RC oscillator until the PLL locks, then the PLL; the bench samples report at each rising edge
resetnpor_n, the power-on resetThe bench counts a report only while it is 1
resetn_systhe reset of the bus and the peripheralsActive low; released on clk_sys
resetn_corethe reset of the coreActive low; on the good chip released 2 cycles of clk_aon after the bus
wdog_reset_reqthe watchdog's requestHeld high until the reset it asks for arrives
soft_reset_reqSOFT_RESET bit 1 of ap_sysctlHeld high until the reset it asks for arrives

Every reset is asserted with no clock. A warm reset lasts 4 cycles of clk_aon (56 ns) after its cause is gone. The core leaves 2 cycles of clk_aon after the bus. The board's pin reset lasts as long as the table holds the pin: 200 ns, and 800 ns in one table.

Given Files

Read-only files supplied by the bench.

ports.sv
// Observation site: soc_tb.clock_reset
module learner_checker(input logic clk, input logic resetn, input logic resetn_sys, input logic resetn_core, input logic wdog_reset_req, input logic soft_reset_req, output logic report);
// Supply the module body only.
endmodule
report.txt
soc_tb samples report on each rising edge of clk with resetn high. Assert report for a sampled violation. The bench counts reports.
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.
Watchdog · register manual
OffsetRegisterBitsFieldAccessResetHeld byMeaning
0x000KEY31:0valuewonot stored0x51, then 0xA2 on the next watchdog write, unlocks one write to CONTROL. Key word.
0x004CONTROL31:0valuewonot storedWrite 1 while unlocked: armed. Arms once. 1 arms the watchdog.
0x008SERVICE31:0valuewonot storedWrite 1: the kick. 1 is a kick.

Examples

Example 1

A Bite, Then a Pin Reset
Input
wait 20; w 0x10003000 = 0x51; w 0x10003000 = 0xa2; w 0x10003004 = 0x1; wait 900; r 0x10004004; reset 10 board cycles; wait 100; r 0x10004004
Output
silent on the good chip; reports on every hidden chip

Power-up, the watchdog's reset and the pin reset: three releases, each bus first and core second. Each request ends as soon as its reset arrives.

Example 2

A Bite, Then a Software Reset
Input
wait 20; w 0x10003000 = 0x51; w 0x10003000 = 0xa2; w 0x10003004 = 0x1; wait 900; r 0x10004004; w 0x10004008 = 0x2; wait 120; r 0x10004004
Output
silent on the good chip

SOFT_RESET bit 1 raises soft_reset_req, which stays high until the bus reset it asks for arrives, then falls.

Example 3

What a Report Means
Input
a hidden chip
Output
your checker reports at least once

The bench counts the edges at which report is 1 while resetn is 1. The grader asks only whether that count is above 0.

Constraints and Contract

  • Use assign, always_comb or always_ff @(posedge clk), with if, else and begin/end. Local state is bit or logic, up to 32 bits a variable. Nothing else of SystemVerilog is accepted: no system tasks, no hierarchy, no directives.
  • Report only on a broken rule: a report on the good chip fails the case.
  • Each check builds the chip bench once. That took about 11 s on the laptop (measured at stage E13); expect an estimated 40 s on the live server.

Hints

Hint 1

Rule 2 is about an edge: compare what the core does now with what the bus did at the last edge.

Hint 2

How long can a reset request stay high on the good chip? The watchdog's reset also resets the watchdog.

Hint 3

A long pin reset is legal. Which rule must not count the length of a reset?

What the grader checks: Five tables. Each runs on the good chip, where your checker stays silent and the bench passes. Each also runs on every hidden faulty chip, where your checker must report. The grader sees only whether your checker reported, not when or which rule fired. One hidden chip breaks the order and one breaks the end of a request. No hidden chip makes the core and the bus leave in the same edge, so the grade does not prove rule 2.

5 checks on ap_soc v1.5 · clock and reset checker · 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 SystemVerilogSaved locally
Ln 1, Col 1Tab indents · Ctrl/⌘ + Enter runs samples
Not run yet

A Bite, Then a Pin Reset

Input
wait 20; w 0x10003000 = 0x51; w 0x10003000 = 0xa2; w 0x10003004 = 0x1; wait 900; r 0x10004004; reset 10 board cycles; wait 100; r 0x10004004
Expected output
silent on the good chip; reports on every hidden chip

Power-up, the watchdog's reset and the pin reset: three releases, each bus first and core second. Each request ends as soon as its reset arrives.

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

ap_soc v1.5 · clock and reset checker · server