This repository contains a bazel rule set for running ghdl, the
VHDL simulator and synthesizer.
bazel installation via bazelisk. I recommend downloading bazelisk
and placing it somewhere in your $PATH under the name bazel.Everything else will be downloaded for use the first time you run the build.
See rules.md for the generated rule documentation.
rules_vhdlThis workspace is fully integrated with the foundational rules_vhdl
graph module. VHDL dependency graphs are declared once using vhdl_library, and
the GHDL backend translates this metadata into compilation, elaboration, and test
execution steps.
vhdl_library (from @rules_vhdl): Groups VHDL source files and
describes dependencies. It generates a transitive VHDLLibraryProvider.ghdl_analyze: Consumes vhdl_library targets and compiles VHDL files
using ghdl -a into an isolated, hermetic GHDL object directory.ghdl_elaborate: Takes compiled GHDL object targets and elaborates them
using ghdl -e.ghdl_test: Groups compilation, elaboration, and execution into an
executable test rule using ghdl -r inside a sandboxed test runner.This rule set is completely hermetic. All dependencies are set up automatically
by bazel. In addition, ghdl_analyze automatically rewrites absolute sandbox
execution paths inside generated .cf library indexes into relative paths,
enabling robust compilation across different sandboxed actions.
In general, see integration/ for example use.
The module is available through my bazel registry at https://github.com/filmil/bazel-registry.
load("@rules_vhdl//vhdl:defs.bzl", "vhdl_library")
load("@rules_ghdl//:rules.bzl", "ghdl_analyze")
# 1. Group the sources
vhdl_library(
name = "lib_src",
srcs = ["hello.vhdl"],
library = "lib",
)
# 2. Analyze the library
ghdl_analyze(
name = "lib",
library = ":lib_src",
args = ["--ieee=synopsys"],
)
load("@rules_ghdl//:rules.bzl", "ghdl_test")
ghdl_test(
name = "hello_world_test",
srcs = ["test.vhdl"],
entity = "hello_world",
)
To run tests in the integration/ directory:
cd integration && bazel test //...
1.2.1 +1d2026-06-13 | |
1.2.02026-06-12 |