Verilog-to-PyG - A Framework for Graph Learning and Augmentation on RTL Designs

Yingjie Li, Mingju Liu, Alan Mishchenko, Cunxi Yu

Introduction

Modern hardware design complexity requires advanced methodologies for optimization and analysis. Machine learning (ML), particularly Graph Neural Networks (GNNs), has emerged as a powerful tool for predicting design Quality-of-Results (QoR) early in the cycle. However, the hardware community faces two significant hurdles: an infrastructure gap between hardware description languages (HDLs) and graph ML libraries, and a severe scarcity of diverse, labeled datasets.

Verilog-to-PyG (V2PYG) addresses these challenges by providing an open-source framework that bridges Verilog RTL and the PyTorch Geometric (PyG) platform. It offers a robust pipeline for converting designs into graph formats and introduces novel data augmentation techniques to generate the massive datasets necessary for training effective GNNs.

The V2PYG Pipeline

The V2PYG framework integrates established Electronic Design Automation (EDA) tools—Yosys for front-end parsing, ABC for logic manipulation, and OpenROAD for physical design—into a cohesive ML-ready pipeline.

The V2PYG framework pipeline, showing the flow from design description to graph generation and automated labeling.

The framework extracts two primary graph representations:

  1. And-Inverter Graphs (AIGs): Technology-independent representations using only two-input AND gates and inverters, ideal for learning fundamental logic structures.
  2. Mapped Netlists: Technology-dependent graphs reflecting actual hardware gates from specific standard cell libraries (e.g., 7nm), capturing physical implementation details.

Logic-Preserving Data Augmentation

A core contribution of V2PYG is its approach to data scarcity. Unlike image data, circuit logic cannot be randomly altered without breaking functionality. V2PYG leverages logic synthesis transformations—originally designed for optimization—as a means of "functionally equivalent" data augmentation.

Illustration of combinational augmentation techniques: (a) original logic, (b) rewriting, (c) refactoring, and (d) resubstitution.

By randomly applying operations like Rewriting, Refactoring, and Resubstitution at the node level, the framework generates thousands of structurally distinct yet functionally identical versions of a circuit. This allows for the creation of diverse datasets from a single source design. Additionally, Sequential Augmentation via retiming moves registers across logic boundaries to vary timing characteristics without changing functional behavior.

Automated Labeling and Multi-Fidelity

V2PYG automates the collection of "ground truth" labels by piping augmented designs through the OpenROAD flow. This enables the extraction of performance metrics (area, power, delay) at various stages—from high-level synthesis to final placement and routing. This multi-fidelity approach allows models to learn features at different levels of abstraction, from abstract logic flows to detailed physical implementations.

Key Insights and Results

The framework's utility was demonstrated on standard benchmarks (ITC'99, ISCAS'85), where it successfully generated thousands of unique, functionally verified samples. For instance, augmenting the i10.aig benchmark produced variations ranging from 1,900 to 2,600 AND gates, following a Gaussian-like distribution of features—ideal for robust ML training.

Crucially, 100% functionality preservation was confirmed via Combinatorial Equivalence Checking (CEC). By implementing these features as a command (aigaug) within the widely used ABC tool, the authors have made high-quality hardware graph data generation accessible to the broader research community.

Conclusion and Future Work

V2PYG provides the necessary infrastructure to scale graph-based ML for hardware design. Future developments include handling more complex sequential state machines and integrating with MLIR CIRCT for higher-level hardware representations. The framework is open-source and available at https://yu-maryland.github.io/Verilog-to-PyG/.

Summary updated

Abstract

The complexity of modern hardware designs necessitates advanced methodologies for optimizing and analyzing modern digital systems. In recent times, machine learning (ML) methodologies have emerged as potent instruments for assessing design quality-of-results at the Register-Transfer Level (RTL) or Boolean level, aiming to expedite design exploration of advanced RTL configurations. In this presentation, we introduce an innovative open-source framework that translates RTL designs into graph representation foundations, which can be seamlessly integrated with the PyTorch Geometric graph learning platform. Furthermore, the Verilog-to-PyG (V2PYG) framework is compatible with the open-source Electronic Design Automation (EDA) toolchain OpenROAD, facilitating the collection of labeled datasets in an utterly open-source manner. Additionally, we will present novel RTL data augmentation methods (incorporated in our framework) that enable functional equivalent design augmentation for the construction of an extensive graph-based RTL design database. Lastly, we will showcase several using cases of V2PYG with detailed scripting examples. V2PYG can be found at \url{https://yu-maryland.github.io/Verilog-to-PyG/}.
BibTeX
@inproceedings{li2023verilog,
  author = {Yingjie Li and Mingju Liu and Alan Mishchenko and Cunxi Yu},
  title = {{Verilog-to-PyG - A Framework for Graph Learning and Augmentation on RTL Designs}},
  booktitle = {ICCAD},
  year = {2023},
  url = {https://openreview.net/forum?id=UvqJubzw_0},
}
Figure