TALOS-V2 is an RTL implementation of a Karpathy's microGPT language model for the DE1-SoC / Cyclone V FPGA.
The project includes the FPGA RTL, generated model ROMs, simulation files, Python host utilities, and board-level scripts needed to build, program, and run inference over JTAG.
- SystemVerilog inference core
- DE1-SoC top level with switch, LED, HEX display, and JTAG/MMIO control
- Fixed-point model weights stored as ROM hex files
- RTL sampler for hardware token generation
- ModelSim testbench for deterministic core simulation
- Python tools for JTAG inference, reference runs, and weight export
rtl/src/ Synthesizable RTL
rtl/src/include/ RTL include fragments
rtl/generated/ Fixed-point model ROM hex files
rtl/microgpt/ Saved model weights and training dataset
rtl/python/ Python host and reference utilities
rtl/tcl/ System Console and Quartus TCL scripts
rtl/sim/ ModelSim testbenches
rtl/ip/ JTAG-to-Avalon bridge IP
rtl/docs/ Additional notes and archived writeups
Root-level batch files provide the main workflow commands.
- Intel Quartus Prime 18.1 Lite or compatible Cyclone V toolchain
- ModelSim Intel FPGA Edition
- Python 3
- DE1-SoC board for hardware inference
If Quartus is not installed in a standard location, set QUARTUS_ROOTDIR before running the build or programming scripts.
Run commands from the repository root.
Simulate the RTL core:
run_core_sim.batBuild the FPGA project:
compile_only.batProgram the DE1-SoC:
program_fpga.batBuild and program in one step:
run_de1soc.batRun inference over JTAG:
run_inference.bat --sampler rtl --steps 15 --temperature 0.5 --seed 2 --streamRun the Python reference model:
reference_microgpt.bat --count 20 --temperature 0.5SW0: enableSW1: reset, high resets and low runs
Status outputs:
LEDR0: readyLEDR1: busyLEDR2: generation doneLEDR3: JTAG activityLEDR4: reset deassertedLEDR5: enable stateLEDR6: busy blinkLEDR7..9: low bits of the last sampled tokenHEX0..1: last sampled token idHEX2..3: generated token countHEX4: top-level stateHEX5: switch state
The RTL uses Q4.12 fixed-point ROM files in rtl/generated/. To regenerate them from the saved model weights:
cd rtl
python python\export_weights.py --weights microgpt\weights_only.npy --outdir generatedThe main local checks are:
run_core_sim.bat
cd rtl\python
python -m unittest test_reference_equivalence.pyFor hardware validation, rebuild the Quartus project, program the board, and run the JTAG inference command.
The RTL follows the microGPT transformer structure, but it uses fixed-point hardware arithmetic and an RTL-friendly sampler. Outputs are deterministic for the same seed and configuration.