RowHammer experiments on real SDRAM, from Python.
An FPGA memory controller for the Terasic DE10-Standard that issues every SDRAM command itself, checks each command against the datasheet, and counts every bit that reads back wrong.
Tutorial · Guide · Design · Results
import dubram
exp = dubram.Experiment(
attack=dubram.attack.SingleSided(aggressor=6071, seconds=10), # hammer one row for 10 s
refresh=dubram.refresh.Periodic(), # refresh stays on, as the datasheet requires
)
result = exp.run(trials=3, controls=True) # three runs, and a control in another bank
print(result.rows) # the rows that flipped, as a plain listYou need a DE10-Standard, Quartus Prime Lite 25.1, and Python 3.10 or later on Linux: see Requirements.
source scripts/env.sh # Quartus and System Console on the PATH
scripts/build.sh --program # Python environment, bitstream, program the FPGA
source .venv/bin/activate
python -m dubram selftest # the link answers and the clock runs at 100 MHz
python -m dubram accept # the acceptance test of the programmed board
python docs/tutorial/01_first_flip.py # the experiment aboveNo board yet? scripts/build.sh --no-build sets up Python alone, and python docs/tutorial/07_saved_results.py loads and plots the saved results.
Next: the tutorial, nine short lessons that start with this experiment.
- The scheduler is the only source of SDRAM commands, and it issues one only when the timing of the memory allows it.
- The sequencer runs the step program that the host loads: write rows, pause refresh, hammer, wait, read back.
- The back-off counts the activations of each bank and issues refreshes when a count reaches its threshold.
- The instrumentation only watches: it checks every command that leaves the FPGA against the datasheet, compares the read data with the pattern that was written, and counts and traces the commands.
Architecture describes the design, and the register map its interface to the host.
docs/ # tutorial/, guide/ (the Python package), design/ (the controller), img/
fpga/ # rtl/ (the controller), sim/ (testbenches), de10_standard/ (the board project)
host/ # dubram/ (the Python package), tests/ (its unit tests)
results/ # data/ (measured on a board), plots/ (drawn from the data)
scripts/ # env.sh, build.sh, reproduce.sh (runs everything that needs no board)
docs/README.md lists every page.
