A checker that was silent on its block bench reports on the good chip once it is bound into the chip bench. Find the two rules that held only on the block bench and repair the checker, without losing its real rules.
Hardware context: Checkers bound onto the fast APB bus of ap_soc v1.5. Repairing a block checker whose assumptions fail at chip level.
The UART0 team gives you their APB checker. On their block bench it was silent on every good run and caught their bugs. You bind it at the chip's fast APB bus, where the fast blocks and the bridge to the slow bus answer. It reports on the good chip.
Repair the checker. Keep what is true of APB on every bus; remove or rewrite what was only true of the UART0 block bench. It must stay silent on every good chip run and still report on each hidden faulty chip.
Full specification
module learner_checker(input logic clk, resetn, psel, penable, pwrite, input logic [3:0] pstrb, output logic report);
// your body
endmodule
| On the UART0 block bench | On the chip's fast APB bus |
|---|---|
| UART0 answers in its first access cycle | The bridge to the slow bus holds an access for 10 to 14 cycles |
| The block bench left an idle cycle after every transfer | The bus-manager seat can run transfers back to back, select held |
| One completer | Six completers and the slow bridge, and holes that answer an error at once |
| Strobes from the requester: a byte, an aligned half-word or the word | The same: the bridge makes them from the size of the AHB write |
Given Files
Read-only files supplied by the bench.
ports.sv
// Observation site: soc_tb.fast_apb
module learner_checker(input logic clk, input logic resetn, input logic psel, input logic penable, input logic pwrite, input logic [3:0] 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.
| who | op | Meaning |
|---|---|---|
core | w wh wb | Write a word, a half, a byte of data at address; the answer must be OKAY |
core | r rh rb | Read; (value & mask) must equal (expect & mask) |
core | we re | Write or read that must answer ERROR |
core | wq rq | As w and r, with the next row's address phase on this row's data phase (back to back) |
core | poll | Read until the masked value is the expected one; data = the most reads (0: 1,000) |
core | irq | The interrupt pins now (bit 0 software, 1 timer, 2 external) against mask and expect |
core | wait_irq | Wait until a pin of mask is high; data = the most cycles |
core | idle | End a back-to-back run |
dma | copy | One job from address to data of mask bytes; STATUS must be expect (2 DONE, 4 FAULT) |
jtag | idcode | TAP reset, read IDCODE, compare |
jtag | halt resume step | Debug control (a halt waits for the core) |
jtag | rr rw | Read or write the register numbered address (0x1000 + n, a CSR, 0x7b0, 0x7b1) |
jtag | stream | Start background word reads at address A, count D, maximum random gap M, expected word E |
tb | wait_release | Wait for the system bus and core resets to release. Seat tables also hold each row at dispatch during reset. |
tb | watchdog | Set the seat stall limit to data system clocks (zero disables it). A stalled request reports its row, address and direction. |
tb | gaps | Maximum random gap D before each seat row, in system cycles (0 disables gaps) |
jtag | mr mw | Read or write a word of memory through the debug manager |
jtag | arm status | "Halt at reset" = data; {halted, error, busy} against mask and expect |
jtag | cmd | Command number address (0 to 7, facts 27.10) with the word data; its reply against mask and expect |
tb | uart_send | Send the byte data to the chip |
tb | uart_expect | The next byte from the chip must be expect; address = the most bit times to wait |
tb | gpio_set gpio_pulse | Pad address to level data; a pulse of data cycles of CLK |
tb | gpio_expect | The sixteen pads against mask and expect |
tb | reset supply | The reset pin, or the supply, for data cycles of CLK |
tb | wait_event | Wait until the test writes address to TB_EVENT |
tb | arg | Deposit data in TB_ARG |
tb | wait_status | Wait until (TB_STATUS & mask) equals (expect & mask) |
tb | poke peek | Back-door write of mask bytes (0: 4) of data; back-door read against mask, expect |
tb | wait | Only the delay |
sym | a symbol name | Back-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.
## The sequence table
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.
| who | op | Meaning |
| --- | --- | --- |
| `core` | `w` `wh` `wb` | Write a word, a half, a byte of `data` at `address`; the answer must be OKAY |
| `core` | `r` `rh` `rb` | Read; `(value & mask)` must equal `(expect & mask)` |
| `core` | `we` `re` | Write or read that must answer ERROR |
| `core` | `wq` `rq` | As `w` and `r`, with the next row's address phase on this row's data phase (back to back) |
| `core` | `poll` | Read until the masked value is the expected one; `data` = the most reads (0: 1,000) |
| `core` | `irq` | The interrupt pins now (bit 0 software, 1 timer, 2 external) against `mask` and `expect` |
| `core` | `wait_irq` | Wait until a pin of `mask` is high; `data` = the most cycles |
| `core` | `idle` | End a back-to-back run |
| `dma` | `copy` | One job from `address` to `data` of `mask` bytes; STATUS must be `expect` (2 DONE, 4 FAULT) |
| `jtag` | `idcode` | TAP reset, read IDCODE, compare |
| `jtag` | `halt` `resume` `step` | Debug control (a halt waits for the core) |
| `jtag` | `rr` `rw` | Read or write the register numbered `address` (`0x1000 + n`, a CSR, `0x7b0`, `0x7b1`) |
| `jtag` | `stream` | Start background word reads at address A, count D, maximum random gap M, expected word E |
| `tb` | `wait_release` | Wait for the system bus and core resets to release. Seat tables also hold each row at dispatch during reset. |
| `tb` | `watchdog` | Set the seat stall limit to `data` system clocks (zero disables it). A stalled request reports its row, address and direction. |
| `tb` | `gaps` | Maximum random gap D before each seat row, in system cycles (0 disables gaps) |
| `jtag` | `mr` `mw` | Read or write a word of memory through the debug manager |
| `jtag` | `arm` `status` | "Halt at reset" = `data`; `{halted, error, busy}` against `mask` and `expect` |
| `jtag` | `cmd` | Command number `address` (0 to 7, facts 27.10) with the word `data`; its reply against `mask` and `expect` |
| `tb` | `uart_send` | Send the byte `data` to the chip |
| `tb` | `uart_expect` | The next byte from the chip must be `expect`; `address` = the most bit times to wait |
| `tb` | `gpio_set` `gpio_pulse` | Pad `address` to level `data`; a pulse of `data` cycles of CLK |
| `tb` | `gpio_expect` | The sixteen pads against `mask` and `expect` |
| `tb` | `reset` `supply` | The reset pin, or the supply, for `data` cycles of CLK |
| `tb` | `wait_event` | Wait until the test writes `address` to TB_EVENT |
| `tb` | `arg` | Deposit `data` in TB_ARG |
| `tb` | `wait_status` | Wait until `(TB_STATUS & mask)` equals `(expect & mask)` |
| `tb` | `poke` `peek` | Back-door write of `mask` bytes (0: 4) of `data`; back-door read against `mask`, `expect` |
| `tb` | `wait` | Only the delay |
| `sym` | a symbol name | Back-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
| Offset | Register | Bits | Field | Access | Reset | Held by | Meaning |
|---|---|---|---|---|---|---|---|
0x000 | REQUEST | 0 | sleep | wo | not stored | Starts a power sequence of PD_PER. 1 starts the switch-off. | |
0x000 | REQUEST | 1 | wake | wo | not stored | 1 starts the switch-on. | |
0x004 | STATUS | 2:0 | state | ro | block | Where the sequencer is, and the levels it drives. 0 on, 1 isolate, 2 save, 3 off, 4 switch on, 5 restore. | |
0x004 | STATUS | 4 | isolate | ro | block | Isolation enable. | |
0x004 | STATUS | 5 | save | ro | block | Retention save level. | |
0x004 | STATUS | 6 | power_on | ro | block | Power switch closed. | |
0x008 | WAKE_ENABLE | 0 | pad | rw | 0x0 | regs | Which events may wake PD_PER. The wake detector. |
0x008 | WAKE_ENABLE | 1 | watchdog | rw | 0x0 | regs | The watchdog's early warning. |
0x00C | WAKE_CAUSE | 0 | pad | w1c | block | Why the last wake happened. A written 1 clears a bit. The wake detector. | |
0x00C | WAKE_CAUSE | 1 | watchdog | w1c | block | The watchdog's early warning. | |
0x00C | WAKE_CAUSE | 2 | software | w1c | block | REQUEST bit 1. | |
0x010 | IRQ_ENABLE | 2:0 | cause | rw | 0x0 | regs | Which wake causes raise interrupt source 9. Numbered as WAKE_CAUSE. |
## ap_pwrctl (base 0x1000_8000, interrupt source 9, clk_aon, PD_AON) | Offset | Register | Bits | Field | Access | Reset | Held by | Meaning | | --- | --- | --- | --- | --- | --- | --- | --- | | `0x000` | REQUEST | 0 | sleep | wo | | not stored | Starts a power sequence of PD_PER. 1 starts the switch-off. | | `0x000` | REQUEST | 1 | wake | wo | | not stored | 1 starts the switch-on. | | `0x004` | STATUS | 2:0 | state | ro | | block | Where the sequencer is, and the levels it drives. 0 on, 1 isolate, 2 save, 3 off, 4 switch on, 5 restore. | | `0x004` | STATUS | 4 | isolate | ro | | block | Isolation enable. | | `0x004` | STATUS | 5 | save | ro | | block | Retention save level. | | `0x004` | STATUS | 6 | power_on | ro | | block | Power switch closed. | | `0x008` | WAKE_ENABLE | 0 | pad | rw | `0x0` | regs | Which events may wake PD_PER. The wake detector. | | `0x008` | WAKE_ENABLE | 1 | watchdog | rw | `0x0` | regs | The watchdog's early warning. | | `0x00C` | WAKE_CAUSE | 0 | pad | w1c | | block | Why the last wake happened. A written 1 clears a bit. The wake detector. | | `0x00C` | WAKE_CAUSE | 1 | watchdog | w1c | | block | The watchdog's early warning. | | `0x00C` | WAKE_CAUSE | 2 | software | w1c | | block | REQUEST bit 1. | | `0x010` | IRQ_ENABLE | 2:0 | cause | rw | `0x0` | regs | Which wake causes raise interrupt source 9. Numbered as WAKE_CAUSE. |
Examples
Example 1
Register Blocks- Input
tb wait (30 cycles); core r 0x10004000; core w 0x10000010 = 0x8; core r 0x10000010; core w 0x10001008 = 0x40; core r 0x10001000
- Output
the starter is silent here
Every register block answers at once, as UART0 did on its own bench.
Example 2
The Slow Bridge- Input
tb wait (30 cycles); core r 0x10008004; core w 0x10008008 = 0x1; core r 0x10008008; core w 0x10008008 = 0x0
- Output
the starter reports on the good chip
An access to ap_pwrctl stays in its access phase for 10 or more cycles. The rule "an access lasts one cycle" was a fact about UART0, not about APB.
Example 3
Back to Back- Input
tb wait (30 cycles); core rq 0x10004000; core rq 0x10004010; core rq 0x10000004; core wq 0x1000402c = 0x55; core idle 0x00000000; core r 0x1000402c
- Output
the starter reports on the good chip
After an access the next setup can follow at once, with select still high. The UART0 bench never did that, so its checker assumed an idle cycle.
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.
- Each check builds the chip bench once. That took about 11 s on the laptop (measured); expect an estimated 40 s on the live server.
Hints
Hint 1
Run the starter: which good-chip case reports first?
Hint 2
Look at the trace of a slow read: what does the bus do after the first access cycle?
Hint 3
A rule that is true of the APB protocol stays. A rule that is true of one completer goes.
What the grader checks: Five tables, each run on the good chip (silent, and the bench passes) and on each hidden faulty chip (your checker reports). The grader cannot see when your checker reported or which rule fired. The hidden chips need two of the rules you keep: the select rule and the strobe rule. They break none of the others. So the grade proves the silence and those two catches, not each rule. Your checker cannot see PREADY, the address or the data.
5 checks on ap_soc v1.5 · fast APB 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