QRNG FPGA Control & Randomness Extraction
Designed the FPGA system that digitizes a quantum random signal and turns it into certified random bits in real time with a hardware Toeplitz hasher.
- When
- Jan – Jul 2022
- Status
- Completed
- Role
- FPGA design & QRNG theory
Overview
This was one of my first two projects in BYU’s CamachoLab, and it took place concurrently and on the same system as the other. Before I arrived, members of the group had been working on designs for a photonic integrated circuit and on-chip transimpedance amplifier that would allow for quantum shot-noise-limited homodyne detection with an exceptionally large signal to noise ratio. The first target application of this would be a quantum random number generator.
The challenge was that these vacuum measurements weren’t uniformly random, and they were mixed with classical noise from the system as well. I was responsible for the entire classical side of the system: the amplifiers, ADCs, and postprocessing system that would allow us to confidently generate random numbers from a purely quantum source.
QRNG theory
The most interesting part of this for me was the information theory side of the project. The signal from our homodyne measurement was the sum of two random Gaussians, from both classical and quantum noise, and we needed to generate purely quantum random numbers. I spent a lot of time learning about how information entropy works, to answer questions ranging from how we could isolate the quantum randomness to how the quantization introduced by the ADCs influenced the rate of bit generation. In the end, the min-entropy of our quantum distribution set how many truly random bits could be extracted from each sample.
Extraction takes raw samples with a peaked, Gaussian distribution (left) and produces a shorter output that is uniformly distributed (right).
Toeplitz hashing in hardware
The main randomness extraction algorithm is done via an operation called Toeplitz hashing. In Toeplitz hashing, the raw bits are multiplied by a random binary matrix, with all arithmetic done modulo 2. In that arithmetic, multiplying bits is an AND and adding them is an XOR, so the whole hash reduces to a grid of simple logic gates, which is exactly what an FPGA does well. This is good, because the speeds at which we wanted to generate uniform quantum random numbers would not be possible on a normal computer.
A small example: the matrix product modulo 2 (left) and the same computation built from AND and XOR gates (right).
Simulation & implementation
Using a Basys3 board with built-in ADCs, I made the full system design, verified it in simulation before running it on the board, and then synthesized and placed it on the Artix-7 in Xilinx Vivado. Below is a simulated example of one important operation of the design: bootstrapping the Toeplitz hash matrix using an initial seed and quantum random numbers from the system. It was important to design the timing such that this bootstrap operation would not corrupt data actively being hashed.
Simulating the hasher in Vivado: input data, hash results, the clock and the bootstrap control signal. The red and blue marks link parts of the Toeplitz matrix register (left) to the results they produce (right).
FPGA architecture
The system runs on a Basys3 board with a Xilinx Artix-7 FPGA:
The FPGA design: the amplified quantum signal is digitized, buffered, hashed by a hardware Toeplitz extractor and streamed out over USB.
- Digitization: the transimpedance amplifier’s output is sampled by the FPGA’s 12-bit XADC, clocked from a 100 MHz oscillator.
- Buffering: a receive controller passes samples through an asynchronous FIFO, so no data is lost between clock domains.
- Extraction in hardware: a Toeplitz hasher built from a matrix constructor (seeded through a bootstrap control input), a multiplier and an accumulator compresses the raw samples into random output bits.
- Output: a transmit controller and USB controller stream the results to a host computer through an FT2232 USB chip.
This was also designed with testing in mind. Based on the operational mode, the module could hash data from the ADCs or from the USB, and it could return values from the input or output of the hasher. This allowed us to run system tests, and it worked 100% of the time over 12+ hours of continuous operation.
Randomness tests
The extracted output passes the full NIST SP 800-22 statistical test suite. As a check, the same tests failed without the quantum signal (that is, without the local oscillator and vacuum measurement). The randomness comes from the quantum measurement, not from the electronics.
Later, I also wrote a separate, heavily optimized C implementation of Toeplitz hashing to run very rapid tests on the FPGA system. It uses bit-level tricks to hash as fast as possible, which made quick checks of the hardware’s output practical. Code on GitHub.
Conclusion
This project was my first introduction to the world of experimental quantum optics! In another post, I describe the work I was able to do on the optics and hardware side of things, as well as the work done to deploy the system at Oak Ridge National Laboratory.
Publication
C. Carver, J. Marchant, B. Fisher, N. Townsend, T. Stowell, A. Barlow, B. Arnesen, S.-H. W. Chiang and R. M. Camacho, “Integrated Differential Conjugate Homodyne Detection for Quantum Random Number Generation,” arXiv:2412.02077 (2024).