RTL Studio Open IDE

Multiplexers

4:1 Priority Mux (One-Hot Select) — L1 Upgrade

4:1 Priority Mux with Valid/Skid Buffer for L1 Cache Upgrade

About this block

Simulate it in the Verilog IDE

Mediumverilogsimsyn

4:1 Priority Mux (One-Hot Select) — L1 Upgrade is a Verilog reference block in the Multiplexers catalog. Multiplexers, demultiplexers, and data-path selectors. Marked Medium: more state or a wider datapath, still one workspace in the IDE.

This IP implements a 4:1 priority multiplexer with a valid/skid buffer interface.

It selects one of four 32-bit data inputs based on a one-hot select signal, where higher index inputs take priority over lower index inputs.

The integrated skid buffer ensures backpressure handling for continuous data streams, preventing data loss when the output is not ready.

  1. Choose Open in IDE. RTL Studio loads the packaged workspace for 4:1 Priority Mux (One-Hot Select) — L1 Upgrade.
  2. Read the Verilog module in the editor. The catalog line for this block: 4:1 Priority Mux with Valid/Skid Buffer for L1 Cache Upgrade.
  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:1 Priority Multiplexing: Supports four 32-bit data inputs (d0-d3).
  • One-Hot Select: Uses a 4-bit one-hot select signal (sel) for input selection.
  • Priority Logic: sel[3] > sel[2] > sel[1] > sel[0].
  • Skid Buffer: Handles backpressure when ready_out is low by storing incoming data.
  • Valid/Ready Handshake: Provides valid_in/valid_out for flow control.
  • Reset: Asynchronous active-low reset (rst_n).

Interface

Signal NameDirectionWidthDescription
clkInput1Clock input
rst_nInput1Asynchronous active-low reset
selInput4One-hot select signal
d0Input32Data input 0
d1Input32Data input 1
d2Input32Data input 2
d3Input32Data input 3
valid_inInput1Input valid signal
valid_outOutput1Output valid signal
ready_outOutput1Ready signal (high if skid is empty)
doutOutput32Multiplexed output data

Architecture

The module uses a combinational priority mux to determine the selected data. A skid buffer stores data when the output is not ready. The skid buffer drains automatically when the output becomes ready.

Verification

The testbench verifies reset behavior, basic passthrough, priority selection, and skid buffer operations. All test cases passed successfully in the simulation.

Test CaseDescriptionResult
TC1Reset StatePASS
TC2Basic Passthrough (D0)PASS
TC3Priority (D2 overrides D0)PASS
TC4Skid DrainPASS
TC5Skid Fill and HoldPASS
TC6Skid Drain after HoldPASS

More in Multiplexers

All Multiplexers blocks