Find why a bus monitor reports fewer transfers than the interface carried, using the words the specification defines.
Hardware context: A performance monitor on one AXI interface. Debug a monitor that counts at most one transfer per cycle and so undercounts a busy bus.
A performance monitor sits on an AXI interface and counts three things. Transfers are handshakes on any of the five channels. Beats are the data transfers on W and R. Transactions are counted when they complete: a write at its B, a read at its last R beat. Its numbers feed a bandwidth report, and the report is low.
Run the failing test to see its log and waveform. The waveform shows every VALID and READY, WLAST and RLAST, and the three counters.
Step 1: find the first cycle where a counter shows a value a correct monitor would not, and name the signal. Step 2: choose the cause from five real bugs. Each one fails in a different way.
Step 3 is optional: fix the monitor and run the tests. They drive random activity on all five channels and compare the three counts with a model.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
n_rows | 6 | input of each check |
Full specification
module xfer_count (
input logic aclk,
input logic aresetn,
input logic awvalid, awready,
input logic wvalid, wready, wlast,
input logic bvalid, bready,
input logic arvalid, arready,
input logic rvalid, rready, rlast,
output logic [15:0] transfers, // every handshake on any of the five channels
output logic [15:0] beats, // data transfers only: W and R
output logic [15:0] txns // completed transactions: a write at its B, a read at its last R
);
...
endmodule
| Counter | Adds one for |
|---|---|
| transfers | every channel whose VALID and READY are both 1 at the edge. Several channels can hand over at the same edge. |
| beats | a W handshake and an R handshake. |
| txns | a B handshake, and an R handshake with RLAST = 1. |
Cycle N is the stretch where the bench's cycle counter shows N. The counters change at the rising edge that starts the cycle. A counter is wrong in cycle N if its value there differs from what a correct monitor shows.
Diagnose the Failing Run
The test below runs the buggy design. Read its log, then find where it first goes wrong in the waveform.
Log
Waveform
Click a signal at a cycle to select it. Or focus the waveform and use the arrow keys: Left and Right move one cycle, Up and Down one signal.
Step 3 is optional: fix the code in the editor, then run the tests.
Examples
Example 1
The Failing Run, Fixed- Input
The script of the failing run, after reset: 12 transfers, 6 beats, 4 transactions
- Output
transfers = 12, beats = 6, txns = 4
Twelve handshakes: two AWs, three Ws, two Bs, two ARs and three Rs. Six of them carry data. Two writes and two reads complete.
Example 2
Every Channel at Once- Input
Two edges where every channel hands over at once, with WLAST and RLAST set
- Output
transfers = 6, beats = 4, txns = 2
Each edge carries five transfers, two of them beats, and completes a write and a read.
Example 3
Offers Are Not Transfers- Input
Every VALID high, every READY low, for three edges
- Output
transfers = 0, beats = 0, txns = 0
VALID without READY moves nothing. All three counters stay at 0.
Constraints and Contract
- Keep the module name and the ports. Reset is asynchronous and clears all three counters.
- Count at the rising edge from the values just before it.
Hints
Hint 1
In the log, count the handshakes yourself, edge by edge. Where does the monitor first fall behind?
Hint 2
Look at the edges where more than one channel hands over.
Hint 3
A transfer is one handshake on one channel. Five channels can give five transfers in one cycle.
What the grader checks: The failing run is simulated live with the shipped monitor. The first wrong cycle and every option's first wrong value come from simulating the correct and each buggy monitor on one bench. The optional fix is checked on eleven scripts of up to 40 edges.
11 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 1 steps and the final capstone