V7.2.2 Across the Always-On Crossing

MediumVerify35 minap_soc v1.5 · always-on APB + slow-crossing input checker · serverReview the topic

Write a checker on both sides of the asynchronous bridge to the always-on bus. Every slow transfer must be the fast transfer that is waiting for it. Hidden faulty chips pass every register readback.

Hardware context: ap_soc's AHB-to-APB bridge and its asynchronous bridge to the always-on bus. A checker across the always-on crossing.

The slow APB bus of ap_soc runs on clk_aon, a clock unrelated to clk_sys. The asynchronous bridge copies each fast transfer across with a request and an acknowledge, then copies the answer back. The fast side waits in its access phase the whole time.

Write a checker that runs on the slow clock. As each slow transfer ends, compare it with the fast transfer waiting on the other side. The fast side must be in its access phase. Direction and address must be the same. For a write, the data and the byte strobes must be the same, bit for bit.

Your checker must stay silent on the good chip and report on each chip of a hidden set. Every hidden chip passes a test that writes the slow registers and reads them back.

Full specification
The ports the server gives your body
input logic clk, resetn,                 // clk_aon and the always-on reset: report is sampled on this clock
input logic psel, penable, pready, pwrite, input logic [31:0] paddr, pwdata, input logic [3:0] pstrb,   // the slow APB bus
input logic peer_psel, peer_penable, peer_pwrite, input logic [31:0] peer_paddr, peer_pwdata, input logic [3:0] peer_pstrb,   // the fast request into the crossing
output logic report
PortSignal
psel, penable, pready, pwrite, paddr, pwdata, pstrbThe slow APB bus after the crossing, before its slot decoder
peer_*The fast APB transfer into the crossing (its select, enable and payload); it holds still while it waits

The always-on blocks: the watchdog at 0x1000_3000 and ap_pwrctl at 0x1000_8000. ap_pwrctl WAKE_ENABLE (0x1000_8008) has two writable bits, 1:0. Sampling the fast side on the slow clock is safe here only because the fast transfer holds still until the crossing answers.

Given Files

Read-only files supplied by the bench.

ports.sv
// Observation site: soc_tb.aon_apb,soc_tb.async_input
module learner_checker(input logic clk, input logic resetn, input logic psel, input logic penable, input logic pready, input logic pwrite, input logic [31:0] paddr, input logic [31:0] pwdata, input logic [3:0] pstrb, input logic peer_psel, input logic peer_penable, input logic peer_pwrite, input logic [31:0] peer_paddr, input logic [31:0] peer_pwdata, input logic [3:0] peer_pstrb, 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_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 checker, every case
Output
silent; the bench's checks pass

Each slow transfer is the fast transfer, bit for bit.

Example 2

Busy Slow Bus
Input
queued reads, byte writes and debug reads
Output
silent

One transfer crosses at a time; the fast side always waits.

Example 3

A Hidden Faulty Chip
Input
your checker on a faulty chip
Output
reports

A bit or a lane differs across the crossing, though the register reads back right.

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. Expressions use ports, local names, literals and the operators ! ~ & | ^ + - == != && || < > <= >= << >> ? : and bit selects. Nothing else of SystemVerilog is accepted: no braces, no system tasks, no hierarchy.
  • Report only on a violation: a report on the good chip fails the case.
  • Each check builds the chip bench once with your checker inside. That took about 17 s on the laptop (measured); expect an estimated 40 s or more on the live server.

Hints

Hint 1

A register with two writable bits reads back right even if bit 31 of the write was wrong.

Hint 2

Which slow cycle is the one where the transfer ends?

Hint 3

A read carries no data and no strobes worth comparing.

What the grader checks: Your checker is built into the ap_soc v1.5 bench at the two sites, sampled on clk_aon. Each case runs on the good chip, where the checker must stay silent. It runs on each hidden faulty chip too, where it must report. The grader cannot see whether you compare the address and direction too, only that the hidden chips are reported.

3 checks on ap_soc v1.5 · always-on APB + slow-crossing input 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

The Good Chip

Input
your checker, every case
Expected output
silent; the bench's checks pass

Each slow transfer is the fast transfer, bit for bit.

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

ap_soc v1.5 · always-on APB + slow-crossing input checker · server