High-Throughput DAQ Server & FPGA Simulator
The data acquisition server for the SpinQuest experiment at Fermilab, built to catch spill data off multiple FPGA boards at once, plus the fake FPGA it gets tested against.
// THE STORY
SpinQuest is a particle physics experiment at Fermilab. Its detectors fire data in bursts called spills, and when a spill happens the readout has one chance to get it off the FPGA boards and onto disk. Miss it and the data is gone.
I built the server that catches it. It takes TCP, UDP, or UNIX socket streams from several boards at once, pulls the 64-bit words out of the window framed by a start and end preamble, and writes each board's spill to its own file.
The catch with writing something like this is that you cannot test it against a live accelerator. So the repo ships a second binary, a fake FPGA that simulates any number of boards clocking at whatever frequency you give it. That is what the server is actually developed against.
// WHAT STANDS OUT
SO_REUSEPORT, not a dispatcher
The kernel hashes each board to a fixed worker, so every file write is lock-free.
Three protocols, one server
TCP, UDP, and UNIX domain sockets, switched with a flag.
You cannot test on a live beam
So it ships a fake FPGA that clocks out spills at any frequency you ask for.
No leaked descriptors
A UniqueFD wrapper closes everything, including on the crash path.