CIRCE is a tightly-coupled cryptographic accelerator integrated through the Core-V eXtension Interface (CV-X-IF) and implementing the CROSS primitives β both R-SDP and R-SDPG variants β on RISC-V.
The accelerator extends the X-HEEP SoC with custom coprocessor instructions and provides a complete software/hardware evaluation flow, including simulation and FPGA execution.
CIRCE/
βββ config/ # Build configuration files and SoC setup
βββ hw/ # Hardware modules
βββ scripts/ # Automation and compilation scripts
βββ sw/ # CROSS test applications and full implementations
βββ tb/ # Testbenches and simulation environments
βββ util/ # Support utilities and helper files
To build the X-HEEP MCU and prepare the Questasim environment:
make mcu-gen
make questasim-buildRun the full (headless) simulation:
make questasim-simRun the selected software application on the simulated SoC:
make questasim-runSimulation UART output is available at:
build/polito_vlsi_crheepto_0/sim-modelsim/uart.log
To inspect the waveforms:
make questasim-guiAll applications are stored under sw/ and fall into two categories:
These applications validate a single R-SDP or R-SDPG primitive, in either software or hardware mode (depending on compile-time flags):
#define ENABLE_<test_name> 1keccak is common to both variants
_dznorm_r2v_rvm_rvmul_syupd_vmul_vpw
_r2vg_rvmg_rvmulg_syupg_vmulg_vpwg
Applications whose names start with CROSS_ or G_CROSS_ contain the complete implementation of the CROSS algorithm.
They are provided for all security levels (1, 3, 5) and optimization corners (b, f, s).
CROSS_1_RSDP_b,CROSS_1_RSDP_f,CROSS_1_RSDP_sCROSS_3_RSDP_b,CROSS_3_RSDP_f,CROSS_3_RSDP_sCROSS_5_RSDP_b,CROSS_5_RSDP_f,CROSS_5_RSDP_s
G_CROSS_1_RSDPG_b,G_CROSS_1_RSDPG_f,G_CROSS_1_RSDPG_sG_CROSS_3_RSDPG_b,G_CROSS_3_RSDPG_f,G_CROSS_3_RSDPG_sG_CROSS_5_RSDPG_b,G_CROSS_5_RSDPG_f,G_CROSS_5_RSDPG_s
Applications can be compiled manually or via the interactive compilation script.
Use:
make app PROJECT=<app_name>Example (unit test):
make app PROJECT=tests/keccakExample (full CROSS implementation):
make app PROJECT=CROSS-apps/CROSS_5_RSDP_fTo simplify compilation and avoid manual copying/configuration, use:
./scripts/compile_apps.sh --testThis will:
- Display an interactive menu of all unit-test applications
- Run
make app PROJECT=<test> - Store the compiled app in:
build/sw
./scripts/compile_apps.sh --completeThis will:
-
Show an interactive menu of all
CROSS_andG_CROSS_applications -
Let the user select which part of the protocol to run:
- keygen
- sign
- sign_open
This must be modified INSIDE the script!
-
Compile the application via
make app PROJECT=... -
Store the final output in:
sw/compiled_apps
This script is the recommended way to build both test benches and full CROSS applications.
Once compiled, the application can be ran through Questasim.
CIRCE can be executed on FPGA using the X-HEEP hardware infrastructure.
make vivado-fpga FPGA_BOARD=zcu104Also in this case, two options are available.
make app PROJECT=<application_name> TARGET=zcu104 LINKER=on_chipAfter this, the FPGA system is ready to run the application.
The repository also provides:
./scripts/compile_apps_fpga.sh <app_folder> <app_name1> [app_name2 ...]This helper script is intended for batch compilation of selected applications for the ZCU104 target. For each specified application, it:
- checks that the application exists under
sw/applications/<app_folder>/ - modifies the protocol-selection macros in the local
main.c - runs:
make app PROJECT=<app_folder>/<app_name> LINKER=on_chip TARGET=zcu104- copies the generated output from
build/sw/appinto a dedicated destination folder
In its current configuration, the script is set to build the sign flow, i.e.:
#define TEST_KEY 0
#define TEST_SIGN 1
#define TEST_SIGN_OPEN 0Therefore, to build keygen or sign_open, the corresponding macro values must be changed inside the script before execution.
For more details on FPGA execution, refer to X-HEEP's FPGA documentation: https://github.com/esl-epfl/x-heep/tree/main/docs/source/How_to
All the commands for the ASIC flow have been left in this repo for completion, even though all the sensitive information and scripts have been removed.
To perform the ASIC synthesis:
make asic
All the post-synthesis functional simulations and power analyses are supported:
make questasim-sim-postsynth
Power analysis is performed on the applications in sw/applications/VCD_triggered_apps/, which isolate representative self-contained cryptographic kernels with high runtime impact and meaningful activity on the accelerated datapath.
To obtain the post-synthesis power results for a specific test, compile the app and then run:
make questasim-sim-postsynth VCD_MODE=2
make power-analysis
The helper script scripts/get_power_results.sh can be used to automatically run this flow on selected applications from sw/applications/VCD_triggered_apps/.
Usage:
./scripts/get_power_results.sh <app1> [<app2> ...]For each selected application, the script:
- compiles it with:
make app PROJECT=VCD_triggered_apps/<appname>- runs the post-synthesis simulation with VCD dumping enabled:
make questasim-sim-postsynth VCD_MODE=2- launches the power analysis step:
make power-analysis- stores the generated reports by renaming:
implementation/power_analysis/reports
to
implementation/power_analysis/reports_<appname>
- Alessandra Dolmeta β alessandra.dolmeta@polito.it
- Valeria Piscopo β valeria.piscopo@polito.it