Code repository for the paper:
DeepGate: Learning Neural Representations of Logic Gates, ACM/IEEE Design Automation Conference (DAC), 2022.
Min Li*, Sadaf Khan*, Zhengyuan Shi and Qiang Xu
Applying deep learning (DL) techniques in the electronic design automation (EDA) field has become a trending topic in recent years. Most existing solutions apply well-developed DL models to solve specific EDA problems. While demonstrating promising results, they require careful model tuning for every problem. The fundamental question on "How to obtain a general and effective neural representation of circuits?" has not been answered yet. In this work, we take the first step towards solving this problem. We propose DeepGate, a novel representation learning solution that effectively embeds both logic function and structural information of a circuit as vectors on each gate. Specifically, we propose transforming circuits into unified and-inverter graph format for learning and using signal probabilities as the supervision task in DeepGate. We then introduce a novel graph neural network that uses strong inductive biases in practical circuits as learning priors for signal probability prediction. Our experimental results show the efficacy and generalization capability of DeepGate.
The experiments are conducted on Linux, with Python version 3.7.4, PyTorch version 1.8.1, and Pytorch Geometric version 2.0.1.
To set up the environment:
git clone https://github.com/Ironprop-Stone/DeepGate.git
cd deepgate
conda create -n deepgate python=3.7.4
conda activate deepgate
pip install -r requirements.txt
Please refer to DATASETS.md
for the preparation of the dataset files.
To train the DeepGate,
cd src
python main.py [--args]
For settings of experiments, run the scripts in directory ./experiments/prob/
. For example:
bash ./experiments/prob/recgnn_deepgate.sh
Run test.sh
in directory ./experiments/prob/
.
After training the DeepGate model, we can apply it for the downstream task: test point insertion. We provide a separate directory ./tpi
for this task. Please read ./tpi/README.md
first. More details about how to run the TPI will be coming soon.
The repo supports NeuroSAT/CircuitSAT and the DeepGate-SAT.
- NeuroSAT: the CNF-based problems are converted into bipartite graphs, and the edge_index defines the edge from literals to clauses. Run neurosat.sh to train the model. The visualization of voter will be added soon.
- CircuitSAT: Run circuitsat.sh to train the DG-DAGRNN described in the CircuitSAT paper. The evaluation will be coming soon.
This code uses DAGNN, D-VAE and neurosat/NeuroSAT as backbone. We gratefully appreciate the impact these libraries had on our work. If you use our code, please consider citing the original papers as well. The code organization follows the one from CenterNet. Thanks!