Write the checker for the APB5 sideband: PWAKEUP held until PREADY, request user signals stable, response user signals valid at completion.
Hardware context: An APB5 link with wake-up and user signals between a requester and a clock-gated completer. Write a checker for PWAKEUP and the four user signals that stays silent on legal traffic.
Lesson P3.13 lost a write when PWAKEUP fell in a wait state. The bench's checker said nothing, because it never looked at PWAKEUP. This checker looks at the APB5 sideband the base checker ignores.
Write module apb5_side_checker. Add one to errors for every rule broken at an edge. The rules are short, but each has a "when". PWAKEUP matters only after it has been high with PSEL. PWUSER matters only in writes, and PRUSER only at a read's completion.
Seven requester and completer pairs drive it. One is correct. It raises PWAKEUP early, with PSEL, after PSEL and not at all, and pulses it once with no transfer. Its user signals take random values wherever the protocol does not care. The six others each break one rule.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
pclk | 1 | stimulus, the same for every design |
presetn | 1 | stimulus, the same for every design |
psel | 1 | output of the design under test |
penable | 1 | output of the design under test |
pwrite | 1 | output of the design under test |
pready | 1 | output of the design under test |
pwakeup | 1 | output of the design under test |
pauser | 4 | output of the design under test |
pwuser | 4 | output of the design under test |
pruser | 4 | output of the design under test |
pbuser | 4 | output of the design under test |
your errors | 32 | output of the design under test |
Full specification
module apb5_side_checker (
input logic pclk,
input logic presetn,
input logic psel,
input logic penable,
input logic pwrite,
input logic pready,
input logic pwakeup,
input logic [3:0] pauser,
input logic [3:0] pwuser,
input logic [3:0] pruser,
input logic [3:0] pbuser,
output int errors
);
// your checker
endmodule
| Rule | What must hold |
|---|---|
| wake-up | Once PWAKEUP and PSEL are 1 at one edge of a transfer, PWAKEUP stays 1 at every later edge until completion. |
| PAUSER | The same value at every edge of a transfer, from the setup edge to the completion edge. |
| PWUSER | In a write, the same value at every edge from setup to completion. In a read it may hold anything. |
| PRUSER | Not x or z at the completion edge of a read. At other edges it may hold anything. |
| PBUSER | Not x or z at the completion edge of every transfer. At other edges it may hold anything. |
A setup edge has PSEL 1 and PENABLE 0; a completion edge has PSEL, PENABLE and PREADY all 1. PWAKEUP may rise before, with or after PSEL, and may stay low for a whole transfer. Each scenario has two reset edges and 36 more.
For each pair you get alarm = yes or no; for the correct one, also the scenario and cycle of your first alarm.
Examples
Example 1
Legal Traffic Must Stay Silent- Input
Pair: keeps every rule Scenarios: PWAKEUP a cycle early, reads and writes with waits; PWAKEUP with PSEL, after it, or not at all; A PWAKEUP pulse with no transfer, then back-to-back user values; Long waits
- Output
alarm = no
Scenario 2 raises PWAKEUP after PSEL and leaves it low for two transfers. Both are legal. PWUSER changes during reads, which is legal too.
Example 2
Up with PSEL, Down at Once- Input
Pair: PWAKEUP dropped as the access phase starts Scenarios: PWAKEUP a cycle early, reads and writes with waits; PWAKEUP with PSEL, after it, or not at all; A PWAKEUP pulse with no transfer, then back-to-back user values; Long waits
- Output
alarm = yes
PWAKEUP rises in the setup cycle together with PSEL and falls in the first access cycle. The rule started at the setup edge.
Example 3
Unknown Read Sideband- Input
Pair: PRUSER unknown when the read completes Scenarios: PWAKEUP a cycle early, reads and writes with waits; PWAKEUP with PSEL, after it, or not at all; A PWAKEUP pulse with no transfer, then back-to-back user values; Long waits
- Output
alarm = yes
PRUSER is x in the completion cycle of a read: the one cycle where it must be valid.
Constraints and Contract
- User signals are four bits wide. Every other input is always 0 or 1.
- Use only your ports. errors never decreases.
Hints
Hint 1
Remember PAUSER and PWUSER at the setup edge, then compare at each access edge.
Hint 2
For wake-up, keep one bit: "PWAKEUP has been high together with PSEL in this transfer". Clear it at the setup edge and at completion.
Hint 3
Use $isunknown for the x checks, and only at the edges where the value must be valid.
What the grader checks: Your checker watches one correct and six faulty pairs over four scenarios. Passing shows it catches these six faults and stays silent where the protocol does not care. It cannot see glitches, which only exist between edges.
7 checks on Icarus · browser samples / server checks. Run the examples first, then check the full regression. Full checks use the server judge. Downloads contain public samples only. A passing result establishes the tested cases, not a proof for all possible inputs.
See all 2 steps and the final capstone