Makefile
A Makefile is a text file containing instructions for a build automation tool called “make.” It specifies how to compile, link, and execute various files within a project, ensuring efficient and consistent builds
Key Roles in VLSI Verification
- Automating Simulation Flow:
- Compiles HDL code (Verilog, VHDL)
- Elaborates testbenches
- Runs simulations
- Generates coverage reports
- Manages regression runs
- Enforcing Dependencies:
- Checks for file modifications
- Recompiles only necessary files, saving time
- Enhancing Reproducibility:
- Provides a consistent build process across environments
- Promoting Collaboration:
- Facilitates shared project management
Benefits in VLSI Verification
- Efficiency: Automates repetitive tasks, saving time and effort.
- Organization: Keeps projects structured and manageable.
- Reproducibility: Ensures consistent builds across different machines and environments.
- Collaboration: Facilitates teamwork by providing a shared build system.
Basic Structure
- Targets: Labels representing actions to be performed (e.g., compile, simulate).
- Dependencies: Files required for a target to be built.
- Recipes: Commands to execute when building a target.
Basic Example:
# Compiler and flags
VERILOG_COMPILER = verilator
# Dependencies
design.v: design.sv #This means if design.sv changes, design.v needs to be recompiled before proceeding.
# Targets
all: design.vcd #This is the default target executed when you simply type make in the terminal.
#Below line: Defines the recipe for all targets. It uses the VERILOG_COMPILER variable to compile design.v and testbench.v into an executable called design. Then, it executes the design executable.
design.vcd: design.v testbench.v
$(VERILOG_COMPILER) -o design design.v testbench.v
./design
clean:
rm -rf design design.vcd #It removes the design and design.vcd files.
Learn More
- https://makefiletutorial.com
- https://www.gnu.org/software/make/manual/make.html
Resources