The pipeline has a simple memory port. The chip has an AHB-Lite bus. Write the adapter between them, with the two things an ERROR response asks for.
Hardware context: A small model of the core as test code, started at a reset vector with a hart number, running a hello program that writes two words to RAM; the same program runs on the real ap_rv32 with the same reset_vector and hart_id inputs. Integrating a processor core into a chip: what to tie, what to connect and what to observe
The lesson read the data port of the real core with an analyser. It showed what a manager must put on the bus, and not the logic that does it. That logic is the adapter of this problem.
The pipeline already keeps a request steady while the bus waits, and it gives the write data one phase after the request. So most of the adapter is wiring. The part that needs thought is the ERROR response.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
trial | 10 | input of each check |
Full specification
| Bus signal | Value |
|---|---|
htrans | NONSEQ, 10 in binary, when a request starts a transfer. IDLE, 00, in every other cycle |
haddr, hwrite | addr and write |
hsize | size, as a number of three bits: 0, 1 or 2 |
hburst, hmastlock | Always 0: every transfer is a single one, and never locked |
hprot | The parameter HPROT |
hwdata | wdata: the pipeline shows it in the data phase already |
| Signal | Value |
|---|---|
ready | hready |
rdata | hrdata |
err_first | 1 in the cycle after the first cycle of an ERROR response. That first cycle has hresp at 1 and hready at 0 |
| Cycle | hresp | hready | A request shown by the pipeline |
|---|---|---|---|
| First cycle of the ERROR | 1 | 0 | Goes to the bus unchanged, like in any wait |
| Second cycle of the ERROR | 1 | 1 | With CANCEL_ON_ERROR at 1: the bus sees IDLE, so no transfer starts. With 0: unchanged |
How to read a result: a public case shows one cycle. It gives htrans of the data port, err_first, htrans of a second copy that never cancels, and ready. A private case runs a sequence of accesses and checks every cycle of both copies.
Examples
Example 1
A Request Behind a Write- Input
a write and a read, in the second cycle: the read is requested while the write is in its data phase
- Output
data_htrans = 2, err_first = 0, other_port_htrans = 2, ready = 1
The data port shows NONSEQ, type 2, for the read. No error is around: err_first is 0. The other port shows the same. The bus is ready.
Example 2
The First Cycle of an ERROR- Input
a read that the bus refuses, with a write requested behind it: the first cycle of the ERROR response
- Output
data_htrans = 2, err_first = 0, other_port_htrans = 2, ready = 0
The bus has hresp at 1 and hready at 0. The request behind it must stay as it is: NONSEQ on both ports. err_first is still 0: it is a register. ready is 0.
Example 3
The Second Cycle of an ERROR- Input
the same, one cycle later: the second cycle of the ERROR response
- Output
data_htrans = 0, err_first = 1, other_port_htrans = 2, ready = 1
err_first is 1. The data port turns the request into IDLE, type 0: the write is cancelled. The other port, set up like the instruction port, still shows NONSEQ.
Constraints and Contract
- The reset is asynchronous and active low. The bench checks err_first right after a reset, before any clock edge.
- Every output but err_first has no clock. The bench reads all outputs 1 ns after it has set the inputs.
- The bench builds two copies: one with HPROT 0011 and CANCEL_ON_ERROR 1, one with HPROT 0010 and CANCEL_ON_ERROR 0.
- haddr, hwrite and hsize are checked only in a cycle with a transfer or a request. hwdata is checked in the data phase of a write, and rdata when a read completes.
- After a cancelled request the pipeline goes on to its next access. The cancelled one is not shown again.
Hints
Hint 1
An ERROR response has two cycles. Which of them can you tell from hresp and hready alone, and which one do you need to remember?
Hint 2
The first cycle of an ERROR is a wait like any other. What does AHB ask of a manager during a wait?
Hint 3
One flip-flop is enough. It feeds err_first, and on the data port it also decides the transfer type.
What the grader checks: Transfers with no wait and with one to three wait states. A read and a write that end in ERROR, at once and after waits, with a request right behind and with nothing behind. Two ERROR responses close together. Bytes and half words. Idle cycles. An ERROR on the last transfer. Three mixed sequences. Two copies with different parameters see every sequence. Every cycle is checked.
15 checks on Icarus Verilog · server. Run the examples first, then check the full regression. Full checks use the server judge. Downloads contain your source only; samples require the simulation service. A passing result establishes the tested cases, not a proof for all possible inputs.
See all 2 problems on this path