Compiler Bugs Detection in Logic Synthesis Tools via Linear Upper Confidence Bound

Hui Zeng, Zhihao Xu, Hui Li, Siwen Wang, Qian MaarXiv 2025 · DOI

Abstract

Logic synthesis tools are critical for translating high-level hardware descriptions into physical gate-level netlists. However, bugs in these compilers can lead to silent hardware failures. This paper presents Lin-Hunter, a metamorphic testing framework that leverages the Linear Upper Confidence Bound (LinUCB) algorithm to intelligently explore the mutation space of hardware models. By prioritizing mutation strategies that trigger unique compiler behaviors, Lin-Hunter identified 18 unique bugs in industry-standard tools like Vivado and Yosys, demonstrating significant improvements in efficiency and diversity over traditional fuzzing methods.

The Challenge of Logic Synthesis

Field-Programmable Gate Arrays (FPGAs) serve as the foundation for modern electronic design across critical sectors, including aerospace and medicine. The reliability of these systems depends heavily on logic synthesis tools—compilers that translate Hardware Description Language (HDL) code into gate-level netlists.

The logic synthesis process: translating HDL code into a gate-level netlist.

Bugs within these tools can introduce silent errors into the final hardware, posing severe safety and security risks. Traditional testing methods, such as random "fuzzing," often fail to explore the complex feature space of these compilers effectively, producing redundant code that misses deep-seated logic errors.

The Lin-Hunter Framework

To address these inefficiencies, the authors developed Lin-Hunter, a framework that combines metamorphic testing with reinforcement learning. The system operates through three primary components:

1. Metamorphic Relationship Construction

Rather than generating code from scratch, Lin-Hunter applies four transformation rules to existing "seed" models. These rules alter the code's structure while preserving its functional output:

  • Non-executing region insertion: Adding code that is never reached during execution.
  • Random if-else insertion: Wrapping logic in "always true" conditions.
  • Subsystem promotion: Moving logic chunks into separate, referenced files.
  • Model transfer: Replicating functionality in a newly constructed model.

If the compiler produces different results for the original and transformed versions, a potential bug is identified.

2. Adaptive Strategy Selection (LinUCB)

Lin-Hunter treats bug hunting as a "Multi-Armed Bandit" problem. It uses the Linear Upper Confidence Bound (LinUCB) algorithm to decide which mutation strategy to apply. By analyzing feedback from synthesis logs (e.g., error patterns and resource utilization), the framework "rewards" strategies that trigger anomalies. This approach balances the exploration of new mutations with the exploitation of known successful strategies.

The Lin-Hunter architecture, featuring metamorphic construction, strategy selection via LinUCB, and equivalence checking.

3. Log-Based Vectorization

Instead of a simple binary "crash/no crash" check, Lin-Hunter uses Word2vec to vectorize synthesis logs. This allows the algorithm to recognize when a mutation triggers a novel internal compiler state, even if it does not result in an immediate crash.

Key Results and Insights

The framework was evaluated against major synthesis tools, including Vivado, Yosys, Iverilog, and Quartus, using over 33,000 unique test cases derived from LegoHDL and real-world Simulink models.

  • Bug Discovery: Lin-Hunter identified 18 unique bugs over three months, 10 of which were previously unknown "zero-day" defects confirmed by developers.
  • Efficiency: The framework achieved a 4x improvement in bug discovery rate compared to random mutation and a 2x improvement over standard epsilon-greedy strategies.
  • Linear Advantage: The authors found that the linear assumption of LinUCB is particularly suited for FPGA synthesis, where features like LUT counts often scale linearly, preventing overfitting and speeding up convergence.

Conclusion

Lin-Hunter demonstrates that intelligent, feedback-driven mutation is far more effective than random fuzzing for verifying complex hardware compilers. While the framework excels at finding "crash" bugs, future work aims to integrate Large Language Models (LLMs) to automate the analysis of inconsistency bugs and generate even more sophisticated, human-like test cases.

Summary updated

BibTeX
@misc{zeng2025compiler,
  author = {Hui Zeng and Zhihao Xu and Hui Li and Siwen Wang and Qian Ma},
  title = {{Compiler Bugs Detection in Logic Synthesis Tools via Linear Upper Confidence Bound}},
  year = {2025},
  eprint = {2509.01149},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2509.01149},
}
Figure