S4.5.1 The Bridge State Machine

MediumImplement22 minIcarus Verilog · serverReview the topic

Keep the peripheral selected for the whole write while the next address is already on the fast bus.

Hardware context: ap_soc AHB-to-APB branch. Peripheral integration

Implement the route controller for a two-device APB branch. An upstream decoder supplies offer and the target bit gpio. The datapath holds the payload separately.

Each sample shows outputs after a rising edge. Inputs describe the cycle ending at that edge. Samples form one continuous run.

Signals in the Timeline

SignalWidthRole
sample12input of each check
Full specification

Synchronous active-low reset cancels any transfer and drops all outputs. While idle, accept an offer on the rising edge. gpio selects GPIO when high and UART otherwise.

After acceptance, spend one full cycle in setup, then enter access. Select only the saved device in both phases. Raise enable only during access.

Ignore new offers during setup and stalled access. Hold access while pready is low. At a ready access edge accept a new offer directly into setup or return to idle.

Examples

Example 1

Cancel the Port
Input
reset_n=0, offer=0, gpio=0, pready=0
Output
uart_sel = 0, gpio_sel = 0, enable = 0

All peripheral outputs fall.

Example 2

Start a UART Write
Input
reset_n=1, offer=1, gpio=0, pready=0
Output
uart_sel = 1, gpio_sel = 0, enable = 0

The selected target sees its setup cycle.

Example 3

Change the Offered Target
Input
reset_n=1, offer=0, gpio=1, pready=1
Output
uart_sel = 1, gpio_sel = 0, enable = 1

The existing write advances to access on UART.

Constraints and Contract

  • Drive uart_sel, gpio_sel and enable between edges from the saved transfer. Treat offer as a candidate, including during waits.

Hints

Hint 1

Draw a row for the cycle before the edge.

Hint 2

Mark the edges where a new destination can take effect.

Hint 3

Try changing gpio during a long access.

What the grader checks: Two decoded targets on one clock, including replacement and reset in flight.

289 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

Report a problem with this page

Your code SystemVerilogSaved locally
Ln 1, Col 1Tab indents · Ctrl/⌘ + Enter runs samples
Not run yet

Cancel the Port

Input
reset_n=0, offer=0, gpio=0, pready=0
Expected output
uart_sel = 0, gpio_sel = 0, enable = 0

All peripheral outputs fall.

Run samples executes all 3 public checks. Check all tests runs 289 checks on the server.

Icarus Verilog · server