Skip to main content

A package manager for FPGA/HDL development: resolve, fetch and assemble IP cores from the LibFPGA registry.

Project description

lfpga

A package manager for FPGA/HDL development. Resolve, fetch and assemble open IP cores from the LibFPGA registry into a source list your simulator or synthesis tool can consume.

The registry is the pypi.org of FPGA IP: curated, ownership-claimed, and toolchain-verified. lfpga is the pip, and its superpower is that every package can carry an earned verification badge (lints clean, synthesizes, testbench passes).

$ lfpga init my-soc
$ lfpga add libfpga
Found libfpga: https://github.com/libfpga/libfpga
  license MIT · verilog · ✓ lint, synth, testbench, formal
$ lfpga add picorv32
$ lfpga install
  libfpga        a4ef4a3fa4ac  1 files  ✓ lint, synth, testbench, formal
  picorv32       e9c4c5b8...   1 files  unverified

Wrote lfpga.lock and build/sources.f (2 source files).

Then point your tool at the generated filelist:

$ verilator --lint-only -f build/sources.f
$ iverilog -o sim.vvp -f build/sources.f
# Vivado: read_verilog -f build/sources.f (via -f)

Why a package manager for FPGA is different

FPGA IP is source, not binaries: there is no ABI and no linking, so lfpga vendors declared HDL files and hands them to the tool of your choice. It does not replace your simulator or synthesizer; it produces the inputs they expect. See the design notes for the full rationale (name collisions, fuzzy versioning, filesets, vendor primitives).

Install

pip install lfpga        # Python 3.11+

Commands

Command What it does
lfpga init [name] Create a libfpga.yaml here
lfpga add <pkg> Add a dependency (name, name@rev, or a git URL)
lfpga install Resolve, pin (lfpga.lock), fetch, and write build/sources.f
lfpga list Show the locked dependencies and their badges
lfpga sources [--format verilator] Emit the assembled source list
lfpga sim [--tool iverilog|verilator] Run a simulation (deps + your testbench)
lfpga synth [--top M] Synthesize with Yosys and report area
lfpga import <.core|Bender.yml> Import a FuseSoC or Bender project
lfpga publish [repo] List your core in the registry and queue verification

Publish your core

If you maintain an open FPGA core, one command lists it in the LibFPGA registry and queues it for the verification toolchain (Verilator lint, Yosys synth, an Icarus testbench):

$ lfpga publish
Publishing https://github.com/you/your-core to the LibFPGA registry...
✓ Listed as 'your-core'  →  https://libfpga.com/cores/your-core
  Queued for verification: lint, synth, testbench.
  Claim it to prove ownership: https://libfpga.com/cores/your-core/claim

Add the badge to your README:
  [![lfpga](https://libfpga.com/cores/your-core/badge.svg)](https://libfpga.com/cores/your-core)

It reads the libfpga.yaml committed on your default branch, so make sure it is pushed. Badges are always earned by the toolchain, never self-declared.

Keep it fresh in CI

Drop this into .github/workflows/lfpga.yml and every push re-lists your core and refreshes its badge (no secrets needed):

name: LibFPGA
on:
  push:
    branches: [main]
jobs:
  publish:
    runs-on: ubuntu-latest
    steps:
      - uses: libfpga/lfpga@v0.4.0

The manifest (libfpga.yaml)

One file, like Cargo.toml: it both declares your dependencies and (if you publish) describes this repo as a package for the registry.

name: my-soc
dependencies:
  libfpga: "*"                       # latest default branch
  picorv32: { rev: v1.0.3 }          # pin a tag, branch or commit
  libfpga-myhdl: { modules: [lfpga_mac] }   # sub-select from a repo
  private-mac: { git: "https://github.com/acme/mac.git" }

The lockfile (lfpga.lock)

Commit it. Because HDL builds are source-and-elaborate, reproducibility is lockfile-first: it pins the exact commit and the exact build sources, so a build is identical across machines and over time.

Status

Phase 2: everything in Phase 1 plus lfpga sim (Icarus/Verilator) and lfpga synth (Yosys) that actually build from the resolved sources, sim/synth filesets, and import from FuseSoC .core and Bender.yml. On the roadmap: Edalize backends for vendor flows, and lfpga publish gated by the verification toolchain.

MIT licensed. Part of LibFPGA.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lfpga-0.4.0.tar.gz (22.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lfpga-0.4.0-py3-none-any.whl (22.1 kB view details)

Uploaded Python 3

File details

Details for the file lfpga-0.4.0.tar.gz.

File metadata

  • Download URL: lfpga-0.4.0.tar.gz
  • Upload date:
  • Size: 22.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for lfpga-0.4.0.tar.gz
Algorithm Hash digest
SHA256 c56a6024a4fbc4ef4e5a9d760f63f52530c59cd20c5fd28a5b5c5b088534bbb9
MD5 9576f92f004768c79b2040dcd1f12c93
BLAKE2b-256 63ff62067abf2c7bc186dd2c6dc14aebb2631591402d08afe62fb2821adc90e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for lfpga-0.4.0.tar.gz:

Publisher: publish.yml on libfpga/lfpga

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lfpga-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: lfpga-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 22.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for lfpga-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 03e599e9344c9b4627ded30c75b79daa12ca1318c4b748b620ce67a0c7a9a210
MD5 2469bf2d8bfd8f69a4e8028a17e05090
BLAKE2b-256 b525e98aa1fda4c10e81431c4118744fd7fd9945c4d940b8f85b3589e232b423

See more details on using hashes here.

Provenance

The following attestation bundles were made for lfpga-0.4.0-py3-none-any.whl:

Publisher: publish.yml on libfpga/lfpga

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page