Hardware builds are hard to inherit. A typical one is a Makefile, a TCL script and rules that nobody wrote down. Bazel can make such a build fast and correct. Out of the box, though, it knows nothing about VHDL libraries, netlists or bitstreams. You teach it your domain by authoring rules, and this book shows you how.
Hardware Development with Bazel: Authoring HDL Rules is for hardware, FPGA and build engineers who already use Bazel and now need to extend it. Every technique is taught with published, versioned rulesets that are in daily use for system-on-chip work. GHDL and NVC build and simulate VHDL, VUnit and OSVVM verify it, and a Vivado ruleset reaches a bitstream. The providers and actions in the chapters are the real code from those rulesets, quirks and workarounds included.
You will learn to:
- design providers that pass hardware artifacts along the build graph;
- declare actions, generated sources, depsets and runfiles;
- define toolchains and platforms, and cross-compile;
- wrap uncooperative vendor tools in hermetic, reproducible actions;
- write repository rules and Bzlmod module extensions;
- test your rules, write aspects, and publish your ruleset.
The book has 22 chapters in seven parts. Part I makes the case for Bazel in hardware and describes the build model you extend. Part II covers Starlark and the structure of an HDL ruleset. Parts III to VI cover rule authoring, toolchains, external dependencies, testing and performance. Part VII combines everything into a complete VHDL verification flow and an RTL-to-bitstream flow.
Seven appendices follow. They give quick references for providers, toolchains and ctx, a WORKSPACE to Bzlmod migration checklist, a decision guide, and a field guide to the open HDL toolchain. A public companion repository builds the book's listings, so you can run the examples as you read.
You should be comfortable with an HDL, the command line and everyday Bazel use. The book reviews the Bazel execution model from the rule author's side. It does not teach bazel build from scratch.