Home / Learn Verilog / Interfaces

Interfaces

Bundle bus signals.

The short versionBundle bus signals.

Theory in plain words

Interface bundlebus_ifvalidinputdatareadyoutput
Interface bundle

Definition

An interface groups related signals so you connect one port instead of twenty.

Why you need this

Cleaner bus connections.

How it works

interface ... endinterface and modport.

Where you'll see this

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

Try it

Without interface: many portsVerilog: edit and run

Three signals per connection; an interface would carry all in one.

With an interface
interface stream_if(input logic clk);\n  logic valid, ready;\n  logic [7:0] data;\n  modport src (output valid, data, input ready);\n  modport dst (input valid, data, output ready);\nendinterface\n\nmodule producer(stream_if.src s); ... endmodule\nmodule consumer(stream_if.dst s); ... endmodule
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).

Test what you just read

1. Interface groups...