rules_vivado drives the AMD/Xilinx Vivado FPGA toolchain from Bazel: VHDL and Verilog compile, elaborate, simulate, synthesize, place-and-route, generate a bitstream, and program the device, all as hermetic Bazel build actions rather than clicks in a GUI or a pile of ad-hoc TCL. This is the module that turns the Cocoapuffs board flow into bazel build. This post kicks off a short series. Over the…
I have been writing a set of technical reports on the internals of Fuchsia, Google’s capability-based microkernel operating system, aimed squarely at electrical, RTL, and FPGA engineers rather than at kernel hackers. This post kicks off a series in which I walk through the reports one volume at a time, roughly one a month. The whole set is a fourteen-volume reference; the complete PDF is…
Interviews for FPGA and digital-design roles draw from a stable, well-defined body of knowledge, yet candidates routinely stumble on it because the questions are asked crisply and must be answered under pressure. I am publishing a preparation guide for exactly that situation: a 29-page report, “The FPGA Hardware Interview”, organized as a sequence of topic reviews, each followed by…
Fuchsia’s Zircon kernel now boots on Cocoapuffs, my homebrew RISC-V system-on-chip on an AMD Artix-7 FPGA: as far as I know, the first Fuchsia boot on programmable hardware. The boot video and the full chain, from a SERV serial loader through OpenSBI to userspace, are below; the rest of the post is the five bugs that stood in the way. Here is the whole thing as a screencast: programming the…
I’m excited to announce the release of bazel_local_nix 0.1.0! bazel_local_nix provides Bazel rules that make Nix packages available inside a Bazel workspace without a host-level Nix installation and without nix-portable. What’s New? Earlier versions of this project relied on shimming Bazel through a nix-portable nix-shell wrapper. That approach has been completely removed and replaced…
tl;dr: I revived the upspin project source code. See it at https://github.com/filmil/upspin, and https://github.com/filmil/upspin-gdrive. Read on to learn what that actually means. History Upspin was a project intended to provide a global namespace for all digital artifacts. It ended up mostly being used as a distributed file store, although the idea was more general than that. It was quite useful…
Synod is a distributed Paxos coordination agent implemented in Go. It manages a highly available, synchronized Key-Value store across a network of peers using the Paxos consensus algorithm. It allows multiple dynamically joining network nodes to agree on a shared state, ensuring fault tolerance and consistency across the cell. Find it at: https://github.com/filmil/synod Quickstart This quickstart…
mkill is a Go program that continuously monitors memory usage of the programs owned by the current user. It kills the program with the sharpest rise in memory utilization when the overall system memory occupancy goes beyond the user-configured kill threshold. Download a binary release, or see the source code on Github. I created mkill because I am handling some programs which tend to run away with…
A link page of interesting libraries and utilities I found. Libraries, utilities, etc. https://registry.bazel.build/modules/rules_verilator https://github.com/lromor/fpga-assembler https://registry.bazel.build/modules/yosys https://github.com/oxidecomputer/quartz https://github.com/corundum/corundum https://www.gaisler.com/grlib-ip-library https://surfer-project.org/…
fshlib fshlib is a simple shell library for logging. It provides a set of functions to log messages with different severity levels. Github repo: https://github.com/filmil/fshlib Usage To use the library, source the log.bash file in your script: source "path/to/log.bash" Then you can use the logging functions: log::info "This is an info message" log::warn "This is a warning message" log::error…
note to self: do not remove .bazelversion from projects The other day, I was pondering whether to keep setting particular bazel version in projects. I even removed some, to see what would become of it. Since I use the bazelisk installation method, I get automatic bazel updates when a new version is released. It turns out that this remains a bad idea. An auto-update to bazel 8.5.0 caused some of my…
This repository provides Bazel rules for creating self-extracting archives (“shar"s) out of shell binaries. See section “what is this” below for details. Details at: https://github.com/filmil/rules_shar Usage To use the rules, add the following to your MODULE.bazel file: bazel_dep(name = "rules_shar", version = "0.0.0") # Select your version, of course. Then, in your BUILD.bazel…
Bazel rules to support a debian rootfs The idea of this repository is to provide a hermetic, ephemeral and reproducible repository of prebuilt binaries, which can then be brought into bazel builds to remove the dependence on local binary installations. Find the project page at: https://github.com/filmil/bazel_debian_rootfs This is otherwise a difficult task. Making a hermetic bazel build involves…
This is another piece of news in my quest for hermetic, ephemeral, and reproducible builds (“HER”). If you read my articles in the past months or so, you may have noticed that I am looking for good ways of creating completely hermetic, ephemeral, reproducible, but also practical builds. Issues to solve The following is a list of issues with my previous HER build approaches: I do not want to manage…
This is a collection of links to interesting articles and knowledge sources about the Bazel build system that I found. I’m motivated to do this after spending considerable time developing a thing that already existed. Just because I was not following the “right” communities I basically wasted a lot of effort reinventing a wheel. Useful wheel, but reinventing nevertheless. I plan…
This is another piece of news in my quest for hermetic, ephemeral, and reproducible builds (“HER”). If you read my articles in the past months or so, you may have noticed that I am looking for good ways of creating completely hermetic, ephemeral, reproducible, but also practical builds. In the past, I offered two approaches to HER builds that I believe take a stab at providing HER properties,…
Update 2025-10-19: I made a searchable index of modules available from my registry at https://www.hdlfactory.com/bazel-registry. As Bazel 9.0 promises to disable the old dependency management approaches based on WORKSPACE by the end of 2025, I figured we should better start preparing. This is my preparation central. Bazel modules promise to usher the era of trivial bazel dependency management.…
lit2md: a literate program converter from code to Markdown lit2md is a simplistic literate programming (LP) converter. See at: https://github.com/filmil/lit2md It takes a source code file annotated with special “literate” programming comments, and outputs a markdown file in which the literate programming comments are converted into markdown text, and code is converted into code blocks.…
Writing XDC Clock Constraints for Vivado This guide explains how to properly constrain a digital design with multiple clocks in an XDC (Xilinx Design Constraints) file, specifically for use in Vivado batch mode. We’ll cover primary clocks, generated clocks, and the relationships between them. The Foundation: Primary Clocks A primary clock is a clock that enters the FPGA from an external…
Decentralized Downloads for Bazel: Introducing bazel_rules_bt In the world of reproducible builds and efficient dependency management, Bazel stands out as a powerful tool. However, fetching large or uncommon dependencies can sometimes be a bottleneck. Enter bazel_rules_bt, a set of Bazel rules that uses the BitTorrent protocol to bring decentralized file downloading capabilities directly into your…
I asked Gemini to teach me about the VHDL resolved signals. What you read below is the result. Mastering Resolved Signals in VHDL: A Comprehensive Guide for Digital Design 1. Introduction to Signals in VHDL The Fundamental Role of Signals in Hardware Description In VHDL, signals serve as the foundational elements for representing physical wires and interconnections within a digital circuit. They…
How to shoot yourself in the foot with inout signals They say that no good deed goes unpunished. Here’s an example of a footgun in VHDL which stems from in my view an eminently reasonable desire to keep the entity interface definitions compact. When defining entities in VHDL, I try to keep the entity definition compact and keep the rate of mistakes low by grouping individual signals into records,…
I asked Gemini to teach me the VHDL type conversions. What you read below is the result. An annoying generated podcast will be available for a while. VHDL IEEE Libraries and Numeric Type Conversions: A Definitive Reference Introduction The VHSIC Hardware Description Language (VHDL) is a formal, strongly-typed language engineered for use in all phases of the creation of electronic systems,…
I updated the repository https://github.com/filmil/vivado-docker/ with the changes required to package Vivado 2025.1. As of this writing, version 2025.1 is the last published version. I hope that the updated version will remove some of the bugs I discovered in the previous version I dockerized, which was 2023.2. I use the container built from this repository as the basis for my vivado tooling for…
rules_nixpkgs use This is a run-down of tips and tricks for the use of rules_nixpkgs, a rule set for bringing in nix packages for use in bazel. I got involved with the use of rules_nixpkgs as a result of my work on hermetic, ephemeral and reproducible builds. My additions to the process are in the repository bazel_local_nix, which allows an ephemeral nix installation, only in service of the…
Bid allows you to create a build rule that runs a single bazel build action inside a Docker container. And if you can run a single action, you can run more if you so choose. This helps you if you must use software which is hard to bazelize, such as typically some EDA packages. The limitation is, you must have a way to invoke docker run. I can afford to do that, but depending on your setup you…
Other formats: Original content is at: https://github.com/filmil/bazel-ebook The rendered HTML edition at: https://hdlfactory.com/bazel_ebook_html/ Introduction This repository is a set of bazel build rules that allow you to write a moderately complex book in the Markdown text format, and produce EPUB and Kindle’s MOBI formats from them. You can also produce a PDF format book, which allows…
A quick note about correct use of glbl.v in a Verilog simulation in Vivado. This note is way less confusing than any notes you may find elsewhere on the Internet. glbl.v is a small collection of “global” signals that are being referred to in Vivado’s simulation sources for primitive elements in AMD (fka Xilinx) devices, such as OSERDES2 and others. This file gets included automatically in…
From: https://github.com/filmil/go-vcd-parser Value Change Dump (VCD) File parser This is a parser for the Value Change Dump files, a.k.a VCD file format. The file format is defined in the IEEE Standard 1800-2003. Specifically, the format supported at the moment is the 4-value format. Some pragmatic extensions are supported, such as those produced by the nvc VHDL simulator. The correct behavior of…
Reusing the general approach from this post gives a way for setting Shift_L+Shift_R as layout change: $ gsettings set org.gnome.desktop.wm.keybindings switch-input-source "['<Shift>Shift_L']" $ gsettings set org.gnome.desktop.wm.keybindings switch-input-source-backward "['<Shift>Shift_R']" This can not be done from the GNOME settings UI. It also works only accidentally, since it is not possible to…
What? $readmemh is a Verilog directive that allows you to initialize an array. It works differently in simulation compared to synthesis. In simulation, this directive behaves as a “read file into array”. In synthesis, this directive behaves as a repository of initial values for, say, block RAM. While the purpose of the directive is documented every which way, the correct usage of the…
From zero to RISC-V in hardware, in 6 minutes Program your FPGA with a one-liner command. It’s a kind of magic. This is a project in sustainable FPGA development that I have been working on. It ties together several smaller projects that I developed in a perpetual quest for hermetic, ephemeral, and reproducible builds. As far as I know, you can not find any setup like this anywhere else.
Be forewarned: HER builds with nix require a functional ranlib This is something seldom known, and a very sharp corner to cut yourself on. But you really want to know if you are using nix. I lost an entire day trying to figure out mysterious “symbol not found” errors while trying to link a hermetic instance of the nvc VHDL compiler under bazel with rules_foreign_cc, in a HER build, when using…
bazel rules for GHDL I present to you https://github.com/filmil/bazel_rules_ghdl: a set of bazel rules for converting VHDL into Verilog. This for example allows running VHDL code in a Verilator simulation. Commercial tools usually do not care what HDL the modules are written in. But usually commercial tools are the final mile in open source HDL development. Before you get there, you want the…
bazel rules for a riscv64 bare metal rust compiler This article assumes that you have bazel installed via the bazelisk method. This is the latest example in my repository at: https://github.com/filmil/bazel-experiments The subdirectory https://github.com/filmil/bazel-experiments/tree/main/riscv64-rust-baremetal shows how to build a bare-metal binary for 64-bit RISC-V, using bazel and a hermetic…
bazel installation via the bazelisk method Here is how I install bazel. I use this installation method on all of my machines. I do not think it is practical to go about this any other way. It is implied in all of my writings about bazel. Why? Sadly, bazel versions are wildly incompatible between major version releases. This means that as you encounter projects using newer and newer bazel versions,…
bazel rules for a riscv64 bare metal GCC compiler The repository https://github.com/filmil/bazel_rules_gcc_riscv64_baremetal contains bazel rules that can be used for a hermetic bare metal GCC cross-compiler for a 64-bit RISC-V machine, running in M-mode. It is based on the toolchain for the muntjac processor. Based on the lowRISC toolchains repo at: https://github.com/lowRISC/lowrisc-toolchains,…
lazygit tips and tricks These are some tips and tricks for lazygit that I keep forgetting how to do. Split a commit into multiple commits Based on the discussion here. Open lazygit 4 to move to the commits panel Enter key to select a commit to split Use regular commands to stage and unstage parts you need. Ctrl-P n to select “move to new commit”. Write the commit message. Ctrl-O does…
Summary Here is how you can set up a hardware server (hw_server) in AMD Vivado 2023.2. Once you do this, that you can move your workbench to a virtual machine in your cloud of choice - mine is GCP - but program a device which is attached to a machine that’s close to you. The FPGA device in question is an AMD Artix-7 A200T. I suspect any other device supported by Vivado will work too.
Google Nest Router (2nd Generation) can serve as an access point I accidentally bought the Google Nest 2nd Generation Router when I needed an Access Point. It turns out that the Router can act as an Access Point and join a mesh network that already has an active Router. Just select “Access Point” when setting it up instead of “Router”. This is very useful in multiple ways:…
Summary This short note defines the notions of hermetic, ephemeral and reproducible software build, as used in my writing. I call this “her” for short. Hermetic A build is said to be hermetic, if each build step only has access to the set of input artifacts that are minimally required for the build to succeed. Hermeticity is useful to ensure build correctness – as it allows us to…
Summary I bother with bazel. Here is why. Background Bazel is a build system. Originally created at Google for internal purposes, then eventually open sourced. Since then, it has not been universally accepted. You can find discussions where bazel is being put down in favor of other build systems. Yet, I have been using bazel in a lot of my recent projects, and have been quite pleased with the…
You, too, can have a fully hermetic, reproducible, and ephemeral bazel build. If you are in a hurry, fast forward to https://github.com/filmil/bazel_local_nix Intro While looking for non-invasive and reproducible ways to create my dev environment, I considered bazel. I wrote up some of the results of this search. I like bazel because not only will it build my project reproducibly, but will also…
Bazel does not like FIFOs Perhaps obvious in retrospect, but it is not possible for a bazel build artifact to generate a named pipe in the filesystem. The after-step checks will object if an output directory contains at least one. I am not sure if this is accidental or not, but it kind of makes sense, since FIFOs are not hermetic, just as network connections are not hermetic. You can see the error…
After a lengthy search I found the below article that explains the use of Unix domain sockets in go: https://johnrefior.com/gobits/read/go-introduction-to-unix-socket-communication
If this advice helped you, let me know. How to run docker containers under Synology NAS, easily and with custom settings Prompted by a recent need to run a local Jupyter instance using the Jupyter Docker Stacks. The easiest way to run docker containers under Synology NAS is to use the Container Manager, which is available through Synology’s Package Center right from the user interface. The…
TIM-011 video playlist TIM-011 was an 8-bit teaching computer that was ostensibly developed by IMP in what is now Serbia. Here is a public collection of videos related to the TIM-011 computer. Most of the videos, and especially the more impressive ones, are by other people. Please see individual videos for authorship information.
TIM-011 was an 8-bit teaching computer that was ostensibly developed by IMP in what is now Serbia. It is hard to develop for any machine without a way to test quickly whether your work results in something usable. Since it takes quite a while to spin up a TIM-011 emulator and run things on it, it was not going to be practical to wait for all the slow machinery to get spun up.
Update 2026-04-17: Bazoekt has been modernized and revived. Sourcegraph has taken over maintenance of zoekt, but what they actually did was disable the old repo and dismantle the zoekt infrastructure, so it couldn’t be compiled. I took over the old version of zoekt, spruced it up so that it builds again, and put it up at https://github.com/filmil/zoekt. Then revived bazoekt on top of that,…