Home / Learn Verilog / Multiple Modules per File and File Organisation

Multiple Modules per File and File Organisation

One module per file is best; tools accept either.

Quick summaryOne module per file is best; tools accept either.

How to think about this

Project layoutrtl/ - design filestb/ - testbenchesconstraints/ - pin and timingsim/ - scripts and outputs
Project layout

The basic idea

Verilog lets you place any number of modules in a file.

Why this comes up

Large projects need one file per module for tooling and version control.

The mechanics

Name the file after the module: adder4.v holds adder4.

Where it is used

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

Try it

Two small modules togetherVerilog: edit and run

Two inverters make a buffer.

Quick check

1. Best practice file layout?