Build the decoupler that a region needs before it is swapped: it lets an open request finish, then isolates the region and answers for it.
Hardware context: ap_fpga: three boot orders, and one region of the fabric swapped behind a decoupler. FPGA SoC bring-up and partial reconfiguration
A region of the fabric of ap_fpga is about to be rewritten. While it changes, its outputs are noise, and it cannot answer. The decoupler sits between the region and the static side.
All state changes on the rising edge of clk. rst_n is a synchronous reset, active low. Every output except decoupled depends only on the state and the inputs of that moment.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
sample | 10 | input of each check |
Full specification
| State | decoupled | What passes |
|---|---|---|
| PASS | 0 | Everything, both ways, unchanged. |
| DRAIN | 0 | Only the open request and its answer: r_req, r_write, r_addr, r_wdata, s_ack and s_rdata pass. The stream and the interrupt are held already: s_valid, s_irq, s_data and r_ready are 0. |
| ISOLATED | 1 | Nothing. Every output to the region is 0: r_req, r_write, r_addr, r_wdata and r_ready. s_valid, s_irq, s_data and s_rdata are 0. A request of the static side is answered at once: s_ack = s_req and s_err = s_req. |
| State now | On the rising edge of clk | Next state |
|---|---|---|
| Any | rst_n is 0 | ISOLATED: after reset the fabric holds no design yet |
| PASS | decouple is 1 and a request is still open after this edge (s_req is 1 and r_ack is 0) | DRAIN |
| PASS | decouple is 1 and no request is open after this edge | ISOLATED |
| DRAIN | decouple is 0 | PASS |
| DRAIN | decouple is 1 and no request is open after this edge | ISOLATED |
| ISOLATED | decouple is 0 | PASS |
| Any other case | No change |
In PASS and DRAIN, s_ack is r_ack and s_err is 0.
Examples
Example 1
Reset- Input
Reset: the region starts isolated
- Output
r_ready = 0, s_data = 0x0, s_irq = 0, s_valid = 0, r_wdata = 0x0, r_addr = 0x0, r_write = 0, r_req = 0, s_rdata = 0x0, s_err = 0, s_ack = 0, decoupled = 1
The region starts isolated: decoupled is 1 and nothing passes either way.
Example 2
Decouple Is 0- Input
decouple is 0: the region joins the static side
- Output
r_ready = 1, s_data = 0xc0, s_irq = 1, s_valid = 1, r_wdata = 0x1234, r_addr = 0x3, r_write = 1, r_req = 0, s_rdata = 0xbeef, s_err = 0, s_ack = 0, decoupled = 0
One edge later the state is PASS. The stream, the interrupt and the request wires pass unchanged.
Example 3
A Request in PASS- Input
A request passes to the region and its answer comes back
- Output
r_ready = 0, s_data = 0x0, s_irq = 0, s_valid = 0, r_wdata = 0x0, r_addr = 0x5, r_write = 0, r_req = 1, s_rdata = 0x5a5a, s_err = 0, s_ack = 1, decoupled = 0
r_req carries s_req to the region, and the answer r_ack comes back as s_ack with its data.
Constraints and Contract
- Implement module pr_decoupler with the given ports.
- Use only your ports. Force, release, defparam, bind and hierarchical names are refused.
Hints
Hint 1
Write the three states and their edges first. Read the table of next states row by row.
Hint 2
Sort the outputs into two groups: the request and its answer, and the stream with the interrupt. DRAIN treats the two groups differently.
Hint 3
A request is open after an edge if s_req is 1 and r_ack is 0 at that edge.
What the grader checks: Pass-through with random traffic and late answers; decouple rising while idle, while a request is open, and on the edge of its answer; decouple falling in the drain; a drain ended by a dropped request and one that never ends; a new request right after a drain; resets in pass and in a drain; input changes between edges; a long random tail.
244 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