Skip to content

Instantly share code, notes, and snippets.

@pamaury
Last active June 22, 2026 13:15
Show Gist options
  • Select an option

  • Save pamaury/89e40b57b13a4f3f0073392efd9b4d03 to your computer and use it in GitHub Desktop.

Select an option

Save pamaury/89e40b57b13a4f3f0073392efd9b4d03 to your computer and use it in GitHub Desktop.

How to create a bitstream cache for a manually downloaded bitstream

  1. If you are building a bitstream manually using Vivado, run:
./bazelisk.sh build //hw/bitstream/vivado:earlgrey_cw340_archive

then use

./bazelisk.sh cquery //hw/bitstream/vivado:earlgrey_cw340_archive

to the get the path to the bitstream archive. copy it somewhere safe, outside of the bazel cache.

  1. Download/Build a bitstream and extract it somewhere. The content should look like this:
$ ls -R
.:
chip_earlgrey_cw340  manifest.json

./chip_earlgrey_cw340:
lowrisc_systems_chip_earlgrey_cw340_0.1.bit  memories.mmi

Note that if you download a bitstream build from a pull request, it is will typically be deeply nested inside a build-bin/hw/top_earlgrey/chip_earlgrey_cw340 directly. In what follows, we will refer to $BITSTREAM_MANIFEST the absolute path to the file manifest.json above.

  1. Create an empty directory somewhere which will hold the cache itself. Denote it by $BITCACHE_DIR and make sure that it exists:
BITCACHE_DIR=/tmp/bitstream_cache
mkdir "$BITCACHE_DIR"
  1. Run at least one bazel command to force the existence of a stamp file:
$ ./bazelisk.sh build //util/py/scripts:bitstream_cache_create
  1. Create the cache:
./bazelisk.sh run //util/py/scripts:bitstream_cache_create.py -- \
   --schema rules/scripts/bitstreams_manifest.schema.json \
   --stamp-file bazel-out/volatile-status.txt \
   --out "$BITCACHE_DIR"
   "$BITSTREAM_MANIFEST"
  1. Now you can run any command using the cache as follows:
BITSTREAM="--cache /tmp/bitstream_cache/ --offline" ./bazelisk.sh query @bitstreams//...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment