What you practice
interface basics (1.7). Bundle shared signals into an interface to simplify DUT wiring and improve modularity. It is in Interfaces — Part 1 · Design in SV of the SystemVerilog Masterclass. Synthesizable SystemVerilog that removes Verilog ambiguity and cuts boilerplate.
The same IDE is the SystemVerilog simulator. Slang lints the file, Verilator runs it, and the waveform viewer sits next to the source.
What you will learn
You will learn how to use SystemVerilog interfaces to bundle multiple related signals into a single named container, reducing wiring clutter and improving design readability and reusability.
Learning objectives
- Define an interface block containing shared signals and modports.
- Connect the interface to a DUT as a single port.
- Use modports to clarify directionality for DUT and testbench.
- Understand how interfaces simplify top-level module port declarations.
Theory
An interface in SystemVerilog groups related signals, clocks, and modports into a single reusable construct.
| Feature | Description |
|---|---|
interface | Encapsulates signals, clocks, and logic into one named block |
modport | Declares signal directions *from the perspective of a module* using the interface |
dut_mp | In this lesson, modport where DUT sees data_in, ctrl, valid as inputs and data_out as output |
tb_mp | Modport where testbench drives data_in, ctrl, valid and observes data_out |
Interfaces eliminate long port lists like input [7:0] data_in, input [1:0] ctrl, input valid, ... and replace them with a single dut_if port.
Practice
- Open this chapter in RtlStudio; confirm
student/rtl/design.svandstudent/tb/tb.svappear in Explore. - Open
student/rtl/design.svand fill in the missinglogickeywords in the interface header and signal declarations. - Run Simulation from the left sidebar; check the Log panel for
INFO:messages. - If VCD is generated, open the Waveform tab to view signal transitions aligned with test checkpoints.
Summary
You practiced declaring and instantiating a SystemVerilog interface to bundle clock, reset, and data signals into a single named container. By replacing the __TODO__ placeholders with logic, you enabled clean, modular signal sharing between the DUT and testbench. This approach eliminates long, error-prone port lists and enforces signal direction consistency via modports. The simulation and synthesis results confirmed that the interface-based design behaves correctly and synthesizes to the expected netlist.
Run it in the Verilog IDE
- Open the lesson in the IDE. The SystemVerilog for this topic is already in the editor.
- Lint with Slang before you simulate. It covers both Verilog and SystemVerilog in this IDE.
- Run Verilator and inspect the VCD. Interfaces, classes, and assertions count only if the simulator agrees.
- Run Yosys when the lesson is synthesizable RTL, and keep testbench-only constructs out of that module.
The lesson is done when the simulation matches interface basics. Change the source, run the Verilog simulator again, and read the waveform without leaving the IDE. Simulation guide · Yosys guide.