fabricgate / crc32Verified
Hardware CRC-32 calculator matching zlib.crc32 for nanopynq
fabricgate pull fabricgate/crc32:1.0.0 --platform tangnano20k/nanopynqVersions
Platforms (v1.0.0)
CRC-32 calculator
A CRC-32 checksum in hardware. You send bytes to the FPGA one at a time and read back their CRC-32,
the same checksum that zip files, PNG images, and Ethernet frames use. Python has it too, as
zlib.crc32, so you can check the circuit's answer against the computer's.
Built with nanopynq. Nothing to install: in Chrome or Edge, on this version's page, select your board, press Open the panel, then Write to the board, Connect, and Open the notebook.
What is on the board
| IP | Address | What it is |
|---|---|---|
crc | 0x7000 | the CRC-32 calculator |
leds | 0x1000 | the six on-board LEDs |
buttons | 0x2000 | buttons S1 and S2 |
sys | 0x0 | design information |
The registers of crc (byte offsets):
| Offset | Name | Access | Meaning |
|---|---|---|---|
0x0 | init | wo | write anything to start over |
0x4 | data | wo | the next byte (the low 8 bits of what you write) |
0x8 | crc | ro | the CRC-32 of the bytes since init |
0xc | length | ro | how many bytes were written since init |
init and data are write-only: register_map omits them, and the panel does not read them.
Try it
The first cell of the notebook shows ol.crc.register_map: {'crc': 0, 'length': 0} on a freshly
written board, and zlib.crc32(b"") is 0 as well.
The standard check value: the CRC-32 of b"123456789" is 0xcbf43926.
import zlib
def crc32_on_board(data):
ol.crc.write(0x0, 0) # init
for b in data:
ol.crc.write(0x4, b) # data
return ol.crc.read(0x8)
data = b"123456789"
hex(crc32_on_board(data)), hex(zlib.crc32(data)), ol.crc.read(0xc)
Random bytes, compared with zlib:
import os
data = os.urandom(100)
crc32_on_board(data) == zlib.crc32(data)
Each byte is one write over the USB serial link, so this is a demonstration, not a fast checksum: about a thousand bytes a second.
From local Python with pip install "nanopynq[fabricgate]":
from nanopynq import Overlay
ol = Overlay("fabricgate://fabricgate/crc32:1.0.0", board="tangnano9k") # or board="tangnano20k"
License
MIT License. Copyright (c) 2026 FabricGate Contributors.