svlang and svlang-lint: A Pure-Rust IEEE 1800-2023 SystemVerilog Compiler Front End and Semantic Static Analyzer for Hardware Design and Verification
Purpose: Open-source static analysis for SystemVerilog (IEEE 1800-2023) and the Universal Verification Methodology (UVM, IEEE 1800.2-2020) is split between two incomplete tool classes. Concrete-syntax-tree (CST) linters check unelaborated tokens without resolving types, class specializations, or component hierarchies, while open-source RTL simulators elaborate synthesizable logic but omit large parts of object-oriented verification, constrained randomization, and UVM semantics. Methods: This paper presents svlang, a SystemVerilog (IEEE 1800-2023) front end and word-level RTL/SVA lowering library written in safe Rust (143,840 lines across 20 workspace crates, with zero external Cargo dependencies in the 12-crate compiler and lowering core). Built on top of svlang, svlang-lint provides a parallel semantic static analyzer, a CST repair engine, and a language server (dv-lsp). Ten differential parity gates verify preprocessing, lossless parsing, four-state constant evaluation, IEEE 1800 §§11.6/11.8 context-determined expression typing, UVM class specialization, and netlist lowering against the C++ Slang v12.1 reference compiler. On this elaborated model, svlang-lint executes 433 rule implementations (461 catalog entries across 20 categories) covering polynomial-time constraint interval and difference-bound cycle checks, class-lineage UVM objection and TLM-to-covergroup flow checks, multi-clock CDC and FSM reachability checks, and provenance-guarded CST autofixes across 38 rule modules. Results: svlang passes 1,024/1,024 (100.0%) applicable CHIPS Alliance sv-tests compliance cases with zero false accepts or rejects, matches Slang on 99,712 typed expressions across 904 compilations and 172/172 UVM 2020.3.1 class specializations, and lowers 1,081 standalone RTL top modules (68.7% under strict defaults; 86.5% when time-zero check flags are relaxed) across 16 open-source silicon repositories at 48,834 lines/s. On 415 paired (bad.sv, good.sv) defect fixtures, Verible, Verilator, and Icarus Verilog together discriminate 122/415 rules (29.4% union), missing 293/415 (70.6%) verification, constraint, UVM, and CDC defects. Semantic resolution removes all ERROR false positives on OpenTitan's shared DV libraries (170 → 0) and Accellera uvm-core (8 → 0), produces 30/30 (100.0%) compile-clean CST rewrites on active autofix fixtures (29/30 single-run fixed-point convergence), lints the 86,476-line uvm-core library in 1.43 s (23.7× warm replay speedup via .svlang_lint_cache), and exposes empty coverage-collector stubs in core-v-verif. Conclusion: Keeping macro token provenance alongside full IEEE 1800-2023 elaboration in Rust makes it practical to check RTL, UVM hierarchies, and constraints together and apply safe source fixes at interactive speeds.
Authors
- Mayur Kubavat (ORCID: https://orcid.org/0009-0009-1087-8558)
Publication Details
- Journal
- Research Square
- Published
- 2026-11-25
- DOI
- https://doi.org/10.21203/rs.3.rs-11813840/v1
- Primary Topic
- Embedded Systems Design Techniques
- Type
- preprint