Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

LiteX Setup

LiteX SoC builder framework for generating DDR controllers, peripherals, and SoC infrastructure.

Installation

1. Install LiteX

# Using pip (recommended)
pip3 install --user litex litex-boards

# Verify
python3 -c "import litex; print(litex.__version__)"

2. Clone LiteX Ecosystem (for development)

mkdir ~/litex && cd ~/litex
wget https://raw.githubusercontent.com/enjoy-digital/litex/master/litex_setup.py
chmod +x litex_setup.py

./litex_setup.py --init --install --user

This installs:

  • litex - Core framework
  • litex-boards - Board definitions
  • litedram - DDR controller generator
  • liteeth - Ethernet MAC/PHY
  • litepcie - PCIe controller
  • litesata - SATA controller

Test LiteX

Generate a simple SoC

# For VCU-118
litex_soc --board vcu118 --cpu-type microwatt --build

# For Arty A7
litex_soc --board arty --cpu-type vexriscv --build

Build time: ~5-10 minutes.

LiteDRAM for DDR4

PowerCommons uses LiteDRAM for VCU-118 DDR4 memory.

Test DDR4 initialization

cd ~/litex/litedram
./litedram_gen.py --sdram-module MT40A512M16 --sdram-data-width 64

PowerPC Support in LiteX

PowerCommons has contributed Microwatt (PowerPC) CPU support to LiteX.

Check CPU options

litex_soc --cpu-list | grep -i power

Expected output:

microwatt

Configuration for VCU-118

Example build command:

litex_soc \
    --board vcu118 \
    --cpu-type microwatt \
    --cpu-variant standard \
    --sys-clk-freq 100e6 \
    --integrated-rom-size 0x10000 \
    --integrated-sram-size 0x2000 \
    --with-ethernet \
    --build

Output: build/vcu118/gateware/vcu118.bit

Directory Structure

~/litex/
├── litex/               # Core framework
├── litex-boards/        # Board support
├── litedram/            # DDR controllers
├── liteeth/             # Ethernet
├── litepcie/            # PCIe
└── litesata/            # SATA

Environment Variables

Add to ~/.bashrc:

export PATH=$HOME/.local/bin:$PATH
export LITEX_BOARDS=$HOME/litex/litex-boards

Common Issues

“Command not found: litex_soc”

export PATH=$HOME/.local/bin:$PATH

“Board not found”

pip3 install --user --upgrade litex-boards

Synthesis errors with Vivado Ensure Vivado is in PATH:

source /opt/Xilinx/Vivado/2025.1/settings64.sh

Advanced: Custom SoC Configuration

Create soc_config.py:

from litex_boards.targets import vcu118
from litex.soc.cores.cpu import Microwatt

class CustomSoC(vcu118.BaseSoC):
    def __init__(self):
        super().__init__(
            cpu_type="microwatt",
            sys_clk_freq=125e6,
            with_ethernet=True
        )

if __name__ == "__main__":
    soc = CustomSoC()
    soc.build()

Run:

python3 soc_config.py

Documentation

Next Steps