Home / Learn Verilog / logic: One Type for wire and reg

logic: One Type for wire and reg

SystemVerilog replaces wire/reg confusion.

Quick summarySystemVerilog replaces wire/reg confusion.

How to think about this

Verilog vs SystemVerilogVerilogwire for assignreg for alwaysSystemVeriloglogic for both
Verilog vs SystemVerilog

The basic idea

logic can be driven by one assign or one always block; the tool decides if it is a net or a variable.

Why this comes up

Removes the most common beginner error.

The mechanics

Use logic everywhere except multi-driver buses.

Where it is used

  • Everyday RTL design
  • FPGA and ASIC projects
  • Testbenches and debugging

Try it

logic with assign and alwaysVerilog: edit and run

Same type for both styles.

Careful:This simulator runs the core of SystemVerilog (logic, always_ff, always_comb, enum, typedef, int, loops with int, break/continue, inside, immediate assert). Features shown only in the grey code box need a full simulator (Icarus -g2012, Verilator, Questa, VCS, Xcelium).

Quick check

1. logic replaces...