Goto

Collaborating Authors

 refinement law


Formally-Verifiable and Human-Interpretable RTL Generation with LLM-Guided Stepwise Refinement

arXiv.org Artificial Intelligence

Large language models (LLMs) are accelerating register-transfer level (RTL) development, but ensuring the correctness of generated designs remains a major challenge. Existing LLM-driven workflows rely heavily on simulation-based verification, which provides limited correctness guarantees, and often offer little insight into the design decisions behind the generated RTL. We present a framework for LLM-guided, correct-by-construction RTL generation that combines the generative capabilities of LLMs with the mathematical rigor of stepwise refinement. The framework translates natural-language requirements into a formal hardware contract and progressively refines the contract into an implementation. At each refinement step, the LLM proposes a design decision, while the refinement engine applies the corresponding transformation only after formally verifying its correctness. The resulting program is formally verified against the contract and then translated into synthesizable RTL. The recorded derivation allows every line of generated RTL to be traced back to the design decisions and requirements that motivated it. Beyond generating verified implementations, the framework provides reliable verification feedback and reusable design experience, laying the foundation for self-improving hardware generation.


Towards Large Language Model Aided Program Refinement

arXiv.org Artificial Intelligence

Program refinement involves correctness-preserving transformations from formal high-level specification statements into executable programs. Traditional verification tool support for program refinement is highly interactive and lacks automation. On the other hand, the emergence of large language models (LLMs) enables automatic code generations from informal natural language specifications. However, code generated by LLMs is often unreliable. Moreover, the opaque procedure from specification to code provided by LLM is an uncontrolled black box. We propose LLM4PR, a tool that combines formal program refinement techniques with informal LLM-based methods to (1) transform the specification to preconditions and postconditions, (2) automatically build prompts based on refinement calculus, (3) interact with LLM to generate code, and finally, (4) verify that the generated code satisfies the conditions of refinement calculus, thus guaranteeing the correctness of the code. We have implemented our tool using GPT4, Coq, and Coqhammer, and evaluated it on the HumanEval and EvalPlus datasets.