Reproduction of https://github.com/DfX-NYUAD/GNNUnlock
This project reproduces the steps of Lilas Alrahis et al. in GNNUnlock up to evaluating the GNN (Graph Neural Network).
SFLL-HD explains that I was able reproduce the success of the original authors for netlists locked with SFLL-HD and Cross Compilation explains an essential shortcoming with GNNUnlock.
I chose to reproduce the setup in ANTI_SAT_DATASET_c7552 except with SFLL-HD_2. This setup uses 24 netlists of c2670 and c5315 as training graphs, 9 netlists of c3540 as validation graphs, and 12 netlists of c7552 as testing graphs (total: 45 netlists). Each netlist is locked with various key sizes and different values and are contained in Datasets/SFLL_HD_2.
The training log for this setup is shown in Datasets/SFLL_HD_2/log_training.txt. The GNN performance on the test graphs is shown below:
Confusion Matrix
True \ Predicted | restore | perturb | main |
---|---|---|---|
restore | 888 | 0 | 0 |
perturb | 0 | 654 | 22 |
main | 15 | 5 | 8518 |
F1 Score by Class
main | perturb | restore |
---|---|---|
0.992 | 0.980 | 0.998 |
In GNNUnlock, training, validation, and testing are all done on non-cross-compiled netlists. Any realistic implementation of logic locking would flatten the design heirarchy before compiling which would further obfuscate the main design/pertub/restore node classes.
All netlists were compiled with Synthesizer/dc_shell_script.tcl, while Synthesizer/dc_shell_script_cross_compile.tcl would be a more "realistic" implementation.
- Run
source setup_conda_env.sh
to setup the anaconda enviroment - Run
setup_GraphSAINT.sh
to clone GraphSAINT and build it
Remain in the gnnunlock-env
anaconda enviroment while working within this repository.
The bolded directories at each step contain the relevant files.
- Obtain Benchmarks in Bench format. These are already saved in Benchmarks
- Convert to Verilog.
python convert_bench_files_to_verilog.py
- Lock with SFLL and AntiSAT.
python lock_netlists.py
- Synthesize with Design Compiler™. Examples are already saved in SynthesizedLockedNetlists
cd Synthesizer/
python synthesize_netlists.py
- Assign roles (train, validation, test). Examples are saved in Datasets
- Convert to graph and extract features.
python convert_netlists_to_graph.py
- Train GNN.
./trainGNN.sh
Adjust the phase: end
parameter in DATE21.yml to increase the training time. Data were collected with end: 2000
to be consistant with GNNUnlock.