RTL Studio Open IDE

0.2 · SYSTEMVERILOG CLASS

Goodbye wire/reg, Hello logic

Replace legacy wire/reg with logic in module ports and internal signals to unify net/variable semantics.

Watch on YouTube

What you practice

Goodbye wire/reg, Hello logic (0.2). Replace legacy wire/reg with logic in module ports and internal signals to unify net/variable semantics. It is in Hello SystemVerilog — Part 0 · SV Warming Up of the SystemVerilog Masterclass. Move from Verilog to SystemVerilog and get the Verilator simulation flow running.

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

Today you will replace legacy wire and reg declarations with the SystemVerilog logic type to eliminate net/variable confusion and unify signal declarations.

Learning objectives

  • Understand why logic simplifies declarations in modern RTL.
  • Identify ports and signals that should use logic instead of wire/reg.
  • Update module port declarations to use logic exclusively.
  • Verify correct behavior using a testbench that exercises combinational and sequential logic.

Theory

The logic type in SystemVerilog combines the functionality of wire and reg into a single type. It can be assigned by both continuous assignments (assign) and procedural blocks (always_ff, always_comb). This eliminates the need to choose between wire (for continuous assignments) and reg (for procedural assignments), reducing errors in multi-driven designs.

TypeAssignment SourceUse Case
wireContinuous (assign) onlyNet connections
regProcedural blocks onlyRegisters, variables
logicEitherUnified, modern replacement

Note: logic is *not* a flip-flop by itself—it becomes a register only when assigned in a sequential block.

Practice

  1. Open this chapter in RtlStudio; confirm files appear in Explore.
  2. Open student/rtl/design.sv and replace each __TODO__ with logic in all port declarations.
  3. Run Simulation and check the Log panel for expected output.
  4. Open the Waveform tab to verify signal transitions align with stimulus steps.

Summary

You replaced legacy wire and reg declarations with the logic type across the DUT’s port list, eliminating net vs variable confusion in both combinational and sequential logic. The testbench confirmed correct signal propagation for all input combinations, validating that logic behaves as expected under both continuous and procedural assignments. Synthesis confirmed the design maps cleanly to standard cells without unintended multi-drivers or type mismatches. The key takeaway is that logic is the unified, modern data type for all RTL signals, simplifying code and reducing common design errors.

Run it in the Verilog IDE

  1. Open the lesson in the IDE. The SystemVerilog for this topic is already in the editor.
  2. Lint with Slang before you simulate. It covers both Verilog and SystemVerilog in this IDE.
  3. Run Verilator and inspect the VCD. Interfaces, classes, and assertions count only if the simulator agrees.
  4. 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 Goodbye wire/reg, Hello logic. Change the source, run the Verilog simulator again, and read the waveform without leaving the IDE. Simulation guide · Yosys guide.