Build System

Overview of the Make-based build system for VHDL development.

Overview

The project uses a comprehensive Makefile to automate:

  • Compilation: GHDL-based VHDL compilation

  • Testing: Automated test execution

  • Documentation: Sphinx documentation building

  • Project management: Statistics and cleanup

Make Targets

Core Targets

make help          # Show all available targets
make test          # Run complete test suite
make build         # Compile all VHDL sources
make clean         # Remove build artifacts

Testing Targets

make test-gates           # Test basic gates only
make test-combinational   # Test combinational logic
make test-sequential      # Test sequential logic
make test-or-gate        # Test specific component
make test-decoder        # Test specific component
make test-dff            # Test specific component

Documentation Targets

make docs          # Build documentation
make docs-serve    # Serve documentation locally
make docs-dev      # Development mode (build + serve)
make docs-clean    # Clean documentation build
make docs-check    # Check for broken links
make docs-install  # Install Python dependencies

Utility Targets

make stats              # Show project statistics
make list-components    # List all VHDL components
make install           # Install GHDL (macOS only)
make check-ghdl        # Verify GHDL installation

Build Configuration

GHDL Settings:

  • Standard: VHDL’08

  • Work Directory: work/

  • Flags: --std=08

File Organization:

The build system automatically discovers:

  • Source files in src/ hierarchy

  • Test files in test/ hierarchy

  • Builds in isolated work/ directory

Parallel Execution:

# Use multiple CPU cores
export MAKEFLAGS=-j$(nproc)  # Linux
export MAKEFLAGS=-j$(sysctl -n hw.ncpu)  # macOS

Customization

Environment Variables:

export GHDL=ghdl-custom     # Use custom GHDL binary
export GHDL_FLAGS="--std=93" # Use VHDL'93 standard

Adding New Targets:

To add a new component test:

test-my-component: check-ghdl $(WORK_DIR)
     @cd $(WORK_DIR) && \
     $(GHDL) -a ../src/path/my_component.vhd && \
     $(GHDL) -a ../test/path/my_component_tb.vhd && \
     $(GHDL) -e my_component_tb && \
     $(GHDL) -r my_component_tb --stop-time=1ms && \
     echo "$(GREEN)βœ“ My Component test passed$(NC)"

Dependencies

Required Tools:

  • GHDL: VHDL compiler and simulator

  • Make: Build automation (GNU Make 3.81+)

  • Git: Version control

Optional Tools:

  • Python 3.7+: For documentation

  • GTKWave: Waveform viewer for debugging