RTL Studio Open IDE

1.3 · SOC CLASS

One-hot slave select

Implement priority-free one-hot slave select logic from a hit vector in SystemVerilog.

Video coming soon. This lesson page stays at the same URL when the lecture publishes.

What you practice

One-hot slave select (1.3). Implement priority-free one-hot slave select logic from a hit vector in SystemVerilog. It is in One-Hot Slave Select — Part 1 · Address Map & Decode of the SoC Masterclass. Turn a memory map into combinational decode, one-hot selects, and an AXI-Lite fabric.

SoC lessons simulate the fabric and the peripheral together in the IDE. Verilator is the simulator; the waveform is where address and response show up.

What you will learn

You will implement a priority-free one-hot slave select logic using the hit vector from the address decoder. This technique ensures that only one slave is selected when exactly one address matches. It is a fundamental pattern for simple AMBA or AXI-like interconnects.

Learning objectives

  • Understand how to propagate a one-hot hit vector directly to a select signal.
  • Learn to use always_comb for combinational logic in SystemVerilog.
  • Verify the design using a testbench that checks specific address hits and errors.
  • Inspect simulation logs to confirm correct slave selection.

Theory

In a simple memory-mapped I/O system, the address decoder generates a one-hot vector called addr_hit. Each bit in addr_hit corresponds to a specific slave device. If bit 1 is high, it means the address belongs to the timer slave. The slave select logic must pass this hit vector directly to the slave_sel output. This is a priority-free operation because the decoder guarantees that at most one bit is high. If multiple bits were high, it would indicate a decoding error, but that is handled by decode_err. The assignment is a simple wire connection inside a combinational block.

ConceptDescription
One-hotOnly one bit is high in the vector at any time.
Priority-freeNo need for case/if-else chains to find the first match.
CombinationalOutput changes immediately with input changes.

Practice

  1. Open RtlStudio and select this chapter from the Examples or Lecture list.
  2. Confirm that student/rtl/ip/soc/slave_select.sv and student/tb/tb_top.sv appear in the Explore tree.
  3. Open student/rtl/ip/soc/slave_select.sv in the editor.
  4. Replace the __TODO__ comment with an assignment that connects addr_hit to slave_sel.
  5. Save the file.
  6. Open the Simulation panel in the left sidebar and click Run.
  7. Read the Log panel to see the INFO: lines and check for INFO: PASS.
  8. If you have VCD support, open the Waveform tab to view signal transitions.

Summary

You implemented a priority-free one-hot slave select by directly assigning the address hit vector to the slave selection signal. This approach leverages the decoder's guarantee that only one bit is active to simplify the logic. The verification confirmed that the slave select signal correctly mirrors the hit vector for valid addresses. This exercise demonstrated how direct combinational assignment can efficiently handle bus arbitration without complex priority encoding.

© 2026 RtlStudio. Licensed under CC BY-NC-ND 4.0. Commercial use and modifications by third parties are not permitted.

Run it in the Verilog IDE

  1. Open the lesson workspace in the IDE. The fabric and the peripheral are one simulation.
  2. Run Verilator and follow the address, write data, and read response on the waveform.
  3. A passing log is not enough when decode or an IRQ line is the point of the lesson — those show up on the VCD.
  4. Run Yosys on the RTL island you just integrated when you want the mapped cells.

The lesson is done when the simulation matches One-hot slave select. Change the source, run the Verilog simulator again, and read the waveform without leaving the IDE. Simulation guide · Yosys guide.