RTL Studio Open IDE

Arbiters

Least Recently Used (LRU) Arbiter — L2 Upgrade

4-input LRU arbiter with weight masking, park mode, and hold lock functionality.

About this block

Simulate it in the Verilog IDE

Hardverilogsimsyn

Least Recently Used (LRU) Arbiter — L2 Upgrade is a Verilog reference block in the Arbiters catalog. Round-robin, fixed-priority, and grant-based resource arbiters. Marked Hard: a larger reference. Simulate the packaged testbench before you change the RTL.

This IP implements a 4-input Least Recently Used (LRU) arbiter with weight masking and park capabilities. It resolves arbitration conflicts by granting access to the requester that has not been used for the longest time.

The design supports dynamic masking of request lines and a dedicated park mode for specific IDs. A hold-lock feature allows the current grant to be maintained across clock cycles despite request changes. The implementation is written in Verilog and targets synthesis-friendly logic.

This IP is suitable for L2 cache interconnects or similar bandwidth-sensitive systems where fair and deterministic arbitration is required. The design is fully verified and ready for integration into SystemVerilog/Verilog projects.

  1. Choose Open in IDE. RTL Studio loads the packaged workspace for Least Recently Used (LRU) Arbiter — L2 Upgrade.
  2. Read the Verilog module in the editor. The catalog line for this block: 4-input LRU arbiter with weight masking, park mode, and hold lock functionality.
  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-bit Request Input: Supports up to 4 masters.
  • Weight Masking: Dynamic masking of request lines to disable specific masters.
  • LRU State Machine: Uses pairwise comparison logic for accurate LRU tracking.
  • Park Mode: park_en signal forces grant to a specific ID (park_id) if active and unmasked.
  • Hold Lock: hold_lock signal freezes the grant output during ongoing transactions.
  • Valid Output: Indicates when a grant is asserted.
  • Resettable State: LRU state resets to MRU default on assertion of rst_n.
  • Verified: Comprehensive testbench with 6 test cases covering basic, masking, contention, park, hold, and idle scenarios.

Interface

The module interface is defined as follows.

Signal NameDirectionWidthDescription
clkInput1Clock input
rst_nInput1Active-low asynchronous reset
reqInput4Request signals from 4 masters
maskInput4Mask signals to disable specific requests
park_enInput1Enable park mode
park_idInput2Target ID for park mode
hold_lockInput1Hold current grant
gntOutput4Grant signals to 4 masters
validOutput1Valid output indicating grant is active

Architecture

The arbiter uses a pairwise LRU state representation. There are 6 pairs for 4 requesters: (0,1), (0,2), (0,3), (1,2), (1,3), (2,3). Each pair has a 2-bit state encoding relative recency.

The LRU state is updated whenever a grant is issued. The winner becomes MRU relative to all other active requesters. If park mode is enabled, the specified ID is granted and updated as MRU. If hold lock is asserted, the grant remains stable regardless of inputs.

Verification

The testbench verifies the following scenarios:

Test CaseDescriptionExpected Result
TC1Basic single requestGrant matches request, valid high
TC2MaskingMasked request ignored, valid high
TC3LRU behaviorLRU requester granted on contention
TC4Park functionalityPark ID granted when active
TC5Hold lockGrant held stable despite request change
TC6No active requestsValid low

All test cases passed in the simulation log. The simulation output confirms:

  • INFO: PASS

More in Arbiters

All Arbiters blocks