Bridging the Semantic Gap from Natural Language Specifications to RTL with Layered Formal Guidance
Organizations: Microelectronics Thrust, The Hong Kong University of Science and Technology (Guangzhou)
Abstract
While large language models (LLMs) have shown promise in generating register-transfer level (RTL) code from natural-language specifications, their reliability remains limited on designs with complex control logic and temporal behavior. This stems from a fundamental semantic gap: high-level natural language often leaves implementation-critical details underspecified, forcing LLMs to infer unstated assumptions. This paper presents Layered Formal Guidance, a novel framework that bridges this semantic gap by using formal properties as an intermediate semantic layer between natural-language specifications and RTL generation. Our framework applies formal guidance across three layers: property-driven specification augmentation before generation, property-consistency checking after generation, and counterexample-guided refinement after checking. Experiments on RTLLM benchmarks and various open-source IP designs demonstrate that our framework achieves higher functional correctness and lower sampled output-trace diversity. Furthermore, we show that Layered Formal Guidance can flexibly augment both general-purpose LLMs and domain-specific models to substantially improve their generation reliability.
Figures & tables
| Metric | FPU | OR1200 | ||
|---|---|---|---|---|
| Average #SVA / Task | 18.3 | 17.3 | ||
| Syntactically Valid Rate | 85.8% | 91.0% | ||
| Non-vacuity Rate | 91.9% | 88.8% | ||
| Setting | Pass@1 | Time (s) | Pass@1 | Time (s) |
| Original Spec | 5.6% | 94.8 | 12.2% | 88.5 |
| Original Spec + CEX | 5.6% | 142.6 | 18.1% | 137.5 |
| Model | Setting | FPU | OR1200 | CVDP | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| pass@1 | pass@5 | pass@10 | pass@1 | pass@5 | pass@10 | pass@1 | pass@5 | pass@10 | ||
| Qwen 3.6 | Base model | 2.22 | 11.11 | 22.22 | 29.48 | 40.97 | 42.11 | 31.15 | 43.23 | 50.00 |
| Base model + SVA | 13.33 | 33.95 | 44.44 | 34.53 | 45.27 | 50.53 | 35.38 | 60.39 | 69.23 | |
| Base model + SVA + CEX | 17.78 | 43.25 | 55.56 | 42.52 | 52.41 | 54.74 | 36.41 | 61.85 | 70.51 | |
| DeepSeek-Coder | Base model | 0.00 | 0.00 | 0.00 | 0.45 | 2.25 | 4.51 | 13.64 | 21.78 | 24.24 |
| Base model + SVA | 3.33 | 10.19 | 11.11 | 6.32 | 20.16 | 27.07 | 27.56 | 36.77 | 39.74 | |
| Model | Setting | VerilogEvalMachine | VerilogEvalHuman | RTLLM 2.0 | |||
|---|---|---|---|---|---|---|---|
| pass@1 | pass@5 | pass@1 | pass@5 | pass@1 | pass@5 | ||
| RTLCoder | Base 7B | 61.20 | 76.50 | 41.60 | 50.10 | 43.50 | 48.10 |
| +SVA+CEX | 65.26 | 79.80 | 49.04 | 57.17 | 62.90 | 66.27 | |
| OriGen | Base 7B | 74.10 | 82.40 | 54.40 | 60.10 | 50.90 | 60.90 |
| +SVA+CEX | 78.23 | 85.55 | 61.90 | 67.20 | 69.10 | 74.40 | |
| CodeV-R1 | Base 8B | 76.50 | 84.10 | 69.90 | 79.30 | 72.90 | 86.10 |
RTL Code Generation
Register-transfer-level (RTL) code generation turns hardware specifications into synthesizable circuits, balancing functional correctness with area, timing, and power.
See all 37 papers