VeriLoC: Line-of-Code Level Prediction of Hardware Design Quality from Verilog Code

Raghu Vamshi Hemadri, Jitendra Bhandari, Andre Nakkab, Johann Knechtel, Badri P. Gopalan, Ramesh Narayanaswamy, Ramesh Karri, Siddharth Garg · DOI

Abstract

VeriLoC is a novel framework designed to predict hardware design quality—specifically timing and routing congestion—at the individual line-of-code (LoC) level directly from Verilog. By leveraging specialized Large Language Model (LLM) embeddings and a hierarchical context-aware architecture, it achieves up to a 61x speedup over industry-standard Electronic Design Automation (EDA) tools while significantly outperforming previous state-of-the-art predictive models.

Introduction

In modern chip design, "design closure"—the point where a design meets all its area, power, and timing goals—represents a massive bottleneck. Currently, designers only receive accurate feedback on metrics like routing congestion and timing slack after running synthesis and layout tools, a process that can take hours or even days.

If a design fails these checks, engineers must "back-annotate" the errors to the original Verilog code, fix them, and restart the process. This iterative loop can stretch into months. While recent AI models have attempted to predict these metrics at the module level, they often rely on intermediate circuit representations that lose high-level semantic meaning and fail to pinpoint the specific lines of code causing the issues.

The VeriLoC Framework

VeriLoC introduces a novel architecture that treats Verilog code as a first-class citizen, providing near-instant feedback to designers by predicting quality metrics directly from the source code.

Overview of the VeriLoC framework, illustrating the transition from RTL modules to annotated code with predicted timing and congestion issues.

Hierarchical Context-Aware Architecture

To predict issues for a specific line, VeriLoC utilizes a hierarchical approach that concatenates three types of information:

  1. Local: The embedding of the target line.
  2. Neighboring: Embeddings of the lines immediately preceding and following it (a context window).
  3. Global: A "module embedding" that represents the entire file's logic.
Detailed architecture of VeriLoC showing the CL-Verilog embedding extraction, hierarchical concatenation, and the final classification/regression stages.

LLM-based Feature Extraction

The framework employs CL-Verilog 13B, an LLM specifically pre-trained on hardware description languages. Instead of code generation, VeriLoC extracts internal activations (embeddings) from the model's penultimate layer to represent the semantic meaning of the Verilog. These high-dimensional vectors are then compressed using an encoder-decoder framework into a compact 128-dimension latent space. Finally, these features are fed into XGBoost or LightGBM models, which are optimized for the imbalanced nature of hardware data.

Key Insights

  • Semantics over Structure: Predicting from raw Verilog is often more effective than using synthesized gate-level graphs. A single line representing a complex multiplier is semantically clear to an LLM but becomes a confusing "sea of gates" in a netlist.
  • The Power of Comments: Including code comments in the embeddings improved accuracy, suggesting that comments contain design intent or structural hints that help the model identify complex logic blocks.
  • Context is King: Line-level prediction fails in isolation. A line like always @(posedge clk) is only "congested" if the logic inside that block is complex, necessitating the combination of local and global embeddings.

Results and Performance

VeriLoC was evaluated using the OpenABCD dataset, featuring designs like the Ariane RISC-V processor. Ground truth labels were generated using industry-standard tools (Synopsys RTL Architect) at a 45nm technology node.

  • High Precision: The model achieved F1-scores of 0.86 for line-level congestion and 0.95 for line-level timing prediction.
  • Timing Accuracy: For module-level timing (Worst Negative Slack), it reduced the Mean Average Percentage Error (MAPE) from the 14–18% seen in previous methods to just 4%.
  • Massive Speedup: VeriLoC provides a 14x average speedup and a 61x median speedup compared to full industry EDA flows.

Limitations and Future Work

While VeriLoC represents a significant step forward, several challenges remain. Currently, the model operates on individual "leaf" modules and does not account for inter-module dependencies critical in multi-million gate SoCs. Future work will focus on validating the model on diverse proprietary industrial RTL and exploring more efficient inference methods, such as distilled models or Mixture-of-Experts (MoE) architectures, to further reduce the computational cost of running large LLMs.

Summary updated

BibTeX
@inproceedings{hemadri2025veriloc,
  author = {Raghu Vamshi Hemadri and Jitendra Bhandari and Andre Nakkab and Johann Knechtel and Badri P. Gopalan and Ramesh Narayanaswamy and Ramesh Karri and Siddharth Garg},
  title = {{VeriLoC: Line-of-Code Level Prediction of Hardware Design Quality from Verilog Code}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=idir4VfpuZ},
}
Figure