This repository contains the SystemVerilog RTL implementation of ASCON-128 with a fully scripted flow for simulation, ASIC synthesis, and post-synthesis verification. Powered by FuseSoC + Verilator + Synopsys Design Compiler.
This architecture is described in:
Compact Yet Fast: An Efficient d-Order Masked Implementation of Ascon
If you use this code in academic work, please cite the paper.
rtl/— Verilog/SystemVerilog RTL for the ASCON core (e.g., parameters inascon_params.sv).tb/— C++ testbench for Verilator (tb_auto.cpp,tb_utils.*).fpga/— FPGA wrapper/integration files (e.g., CW305 support).plots/— Optional folder for figures/analysis artifacts.ascon.core— FuseSoC core description (filesets, targets, tool options).fusesoc.conf— Local FuseSoC settings (cores root, backends).makefile— The automation brain (see below 👇)..gitignore,README.md.
ℹ️ Some directories (e.g.,
build/,netlist/,synth/report/) are generated by the Makefile and appear only after running the flow.
# 0) Requirements
# - FuseSoC, Verilator
# - (for synthesis) Synopsys Design Compiler in PATH (dc_shell)
# 1) Full RTL simulation (build + run + verify)
make simulation
# 2) ASIC synthesis with Design Compiler + copy artifacts
make synthesis
# 3) Post-synthesis gate-level simulation
make post_synth_sim
# 4) FPGA bitstream (CW305)
make fpgabitstream
# 5) Clean everything
make cleanThe Makefile orchestrates the entire flow around the FuseSoC core
myascon:ascon_top:1.0.0 (declared in ascon.core) and a local ./build directory.
BUILD_DIR = ./build— where FuseSoC generates builds and logs.CORE_NAME = myascon:ascon_top:1.0.0— matchesascon.core.FUSESOC = fusesoc --cores-root <this_repo>— pinned to use this tree.
-
make simulation_buildCleans previous artifacts and builds the Verilator simulation via FuseSoC. -
make simulation_runRuns the compiled simulation. -
make simulation_verifyCompares Verilator’s debug output against the Python golden model:python3 test_ascon.py > output.txt diff output.txt ./build/.../debug_output.txt > diff_output.txt || true
If
diff_output.txtis empty → ✅ test passed. -
make simulationConvenience alias: build + run + verify (the full RTL sim loop). -
make synthesis(Design Compiler) Launches DC via FuseSoC, then:- Copies synthesized netlist(s) into
./netlist/ - Syncs synthesis reports into
./synth/report/new_report/
- Copies synthesized netlist(s) into
-
make update_netlistCopiesascon_top_syn.*from the build tree →./netlist/. -
make update_synth_reportsRsyncs DC reports →./synth/report/new_report/. -
make post_synth_simRuns gate-level simulation (using the netlist) through the FuseSoC targetpostsynth_simulation. -
make fpgabitstreamBuilds the FPGA implementation and generates the bitstream via Vivado, using the FuseSoC target cw305-ascon defined in ascon.core -
make cleanWipes./build, FuseSoC cache, and temporary files. -
make allRun synthesis then post-synthesis simulation.
- Fails early if
fusesocis missing. - Fails early if
dc_shellis not inPATHwhen you callmake synthesis.
-
Keep parameters aligned between:
rtl/ascon_params.svtb/tb_auto.cpp(e.g.,PAR,d)
-
Mismatches will surface during
make simulation_verify.
The fpga/ folder holds the integration/wrapper files (e.g., CW305).
FPGA build targets can be added through FuseSoC (see ascon.core), but they’re not wired into the Makefile by default.
- “
fusesocnot found” → Activate the environment providing FuseSoC. - “
dc_shellnot found” → Source your Synopsys DC setup beforemake synthesis. - “
vivadonot found” → Add Vivado to your PATH beforemake fpgabitstream. - Differences in
diff_output.txt→ Check parameter consistency and recent RTL/TB edits.
- Flow management: FuseSoC
- Simulation: Verilator (+ C++ testbench)
- ASIC synthesis: Synopsys Design Compiler
- Cipher: ASCON-128 (lightweight AEAD)
Happy hacking! ✨