RTL Studio Open IDE

5.1 · SOC CLASS

Fixed master CPU stub

Implement a fixed master CPU stub FSM to drive AXI write transactions for GPIO and timer programming.

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

What you practice

Fixed master CPU stub (5.1). Implement a fixed master CPU stub FSM to drive AXI write transactions for GPIO and timer programming. It is in CPU Stub Master — Part 5 · Integration & Capstone of the SoC Masterclass. Tie a CPU stub, decode, peripherals, DMA, and IRQ into a mini-SoC capstone.

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 finite state machine (FSM) for a fixed master CPU stub. This stub drives an AXI interface to program GPIO and timer registers. This is a critical step in integrating a processor model with peripheral IP.

Learning objectives

  • Understand the structure of an AXI4-Lite write transaction sequence.
  • Implement a reset-safe FSM to control bus handshakes.
  • Sequence multiple write operations to different peripheral addresses.
  • Verify the design using a testbench that checks address and completion signals.

Theory

The CPU stub acts as a master that initiates memory-mapped I/O (MMIO) writes. It must follow the AXI4-Lite protocol strictly. An AXI write transaction involves three channels: Address (AW), Data (W), and Response (B). The master asserts awvalid and wvalid. The slave responds with awready and wready. Once data is accepted, the slave sends a response on the B channel. The master must wait for bvalid and assert bready to complete the transaction. The FSM must manage these handshakes to ensure data is not lost and the bus is not stalled incorrectly. Resetting the FSM to a known idle state is essential to prevent undefined behavior on power-up.

Practice

Open this chapter in RtlStudio and navigate to the Explore panel. You will see the student/ directory structure. Open ` student/rtl/ip/soc/cpu_stub.sv . This file contains the skeleton of the CPU stub module. You need to fill in the reset logic for the state register and the AXI control signals. The FSM logic for the active state is already provided in the else block. Open student/tb/tb_top.sv to see how the testbench instantiates the design and checks the results. Run Simulation from the sidebar to test your implementation. Check the Log panel for INFO:` messages indicating success or failure.

Summary

You implemented a fixed MMIO master FSM to handle GPIO and timer programming within the SoC integration. This exercise reinforced your ability to manage peripheral communication through a structured state machine approach. The successful simulation confirms that your design correctly interfaces with the system-on-chip components.

© 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 Fixed master CPU stub. Change the source, run the Verilog simulator again, and read the waveform without leaving the IDE. Simulation guide · Yosys guide.