RTL Studio Open IDE

Bus Interfaces

Wishbone Slave 4-Register File — L2 Upgrade

Wishbone slave with 4 registers, retry for invalid addresses, and timeout detection to prevent bus deadlocks.

About this block

Simulate it in the Verilog IDE

Hardverilogsimsyn

Wishbone Slave 4-Register File — L2 Upgrade is a Verilog reference block in the Bus Interfaces catalog. AXI, APB, Wishbone, and other on-chip bus interface adapters. Marked Hard: a larger reference. Simulate the packaged testbench before you change the RTL.

This IP core implements a compliant Wishbone B3 slave interface featuring a 4-register file (32-bit width). It is designed for scenarios requiring robust bus integrity, specifically handling invalid address accesses and preventing bus deadlocks caused by stuck STB (Strobe) signals.

Key features include:

  • Automatic retry (RTY) assertions for out-of-bounds addresses.
  • A configurable timeout mechanism that forces a retry/acknowledge response after a defined number of cycles.
  • Synchronous write logic and combinational read logic for low latency.

This IP core provides a robust Wishbone B3 slave interface with built-in protection against invalid accesses and bus deadlocks. It is suitable for integration into systems where bus stability is critical. The core is fully parameterizable for timeout settings and includes comprehensive test coverage for standard operations and error conditions.

  1. Choose Open in IDE. RTL Studio loads the packaged workspace for Wishbone Slave 4-Register File — L2 Upgrade.
  2. Read the Verilog module in the editor. The catalog line for this block: Wishbone slave with 4 registers, retry for invalid addresses, and timeout detection to prevent bus deadlocks.
  3. Run the packaged testbench with the in-browser Verilator simulator, then open the VCD in the waveform viewer.
  4. Run Yosys in the same IDE for a generic netlist. Sky130 liberty mapping is a separate Pro library option.

RTL Studio is the Verilog simulator and IDE around this block: Slang lint, Verilator, VCD waveforms, and Yosys, in the browser. Simulation guide · Yosys guide.

Features

  • 4 Addressable Registers: Supports 32-bit read/write operations at addresses 0 through 3.
  • Retry Logic: Asserts RTY for any address outside the valid range (0-3).
  • Timeout Handling: Prevents bus deadlocks by asserting RTY and ACK when a transaction exceeds the TIMEOUT_CYCLES limit.
  • Configurable Timeout: The timeout threshold is defined by the TIMEOUT_CYCLES parameter.
  • Simple Interface: Synchronous write logic and combinational read logic for low latency.
  • Reset Behavior: All registers and internal states are initialized to zero on active-low reset.

Interface

SignalDirectionWidthDescription
clkInput1Clock input
rst_nInput1Active-low reset
cycInput1Cycle valid
stbInput1Strobe signal
adrInput4Address bus (supports up to 16 registers, but only 0-3 are valid)
weInput1Write enable
dat_iInput32Data input
dat_oOutput32Data output
ackOutput1Acknowledge
rtyOutput1Retry signal

Architecture

The following diagram illustrates the data flow and control logic.

  • Control Logic: Validates the address and manages the retry state.
  • Timeout Counter: Increments while STB and CYC are active. If the counter reaches the limit, the Retry signal is asserted.
  • Invalid Addresses: Immediately trigger the Retry signal.

Integration

### Instantiation

To instantiate this module in your design:

### Parameters

  • TIMEOUT_CYCLES: Configurable parameter defining the number of cycles before a timeout triggers. Default is 8. Adjust this value based on your master's maximum transaction latency requirements.

Verification

The testbench verifies basic read/write operations and error handling.

Test CaseDescriptionResult
TC1Write and Read Register 0PASS
TC2Write and Read All RegistersPASS
TC3Retry on Invalid AddressPASS
TC4Timeout on Stuck STBPASS

### Running Simulation

  1. Clone the repository.
  2. Run the simulation using your preferred EDA tool (e.g., ModelSim, VCS, Xcelium).
  3. Check the log output for the following:

- TC1 PASS - TC2 PASS - TC3 PASS - TC4 PASS - INFO: PASS

More in Bus Interfaces

All Bus Interfaces blocks