Skip to content
Open access

Design and Implementation of an OCaml-Based Standalone SystemVerilog Preprocessor Compliant with IEEE 1800-2023

Jul 2026 · Electronics · Vol 15, pp. 3234 · 0 citations · 6 references

TL;DR

Stagira svpp is presented, a standalone SystemVerilog preprocessor implemented in OCaml and designed to follow the preprocessing semantics of IEEE Std 1800–2023, which provides a reusable reference implementation for studying and validating SystemVerilog preprocessing behavior.

Abstract

SystemVerilog preprocessing determines the effective source code consumed by subsequent front-end compilation stages, yet in many toolchains it is implemented as an internal component tightly coupled with lexical, syntactic, or downstream analysis. Such integration is effective for end-to-end compilation flows, but it can obscure preprocessing behavior and make independent validation difficult, especially for macro expansion, conditional compilation, file inclusion, and source-location tracking. This paper presents Stagira svpp, a standalone SystemVerilog preprocessor implemented in OCaml and designed to follow the preprocessing semantics of IEEE Std 1800–2023. Preprocessing is modeled as an independent, directive-driven frontend stage, in which macro definitions, conditional-compilation contexts, file-inclusion hierarchies, source-location mappings, diagnostics, and auxiliary directive states are maintained through explicit state updates. The implementation supports object-like and function-like macros, token-level macro operators, nested conditional compilation, macro-driven file inclusion with cycle detection, predefined macros, source-location remapping, command-line macro/include configuration, and selected stateful directives. The evaluation uses a focused semantic test suite to exercise implemented preprocessing mechanisms and representative boundary cases. Within the evaluated scope, Stagira svpp passes all 48 test cases and exhibits consistent behavior for tested scenarios including nested conditionals, token-level macro operations, macro-expanded include arguments, cyclic inclusion detection, and source location-related diagnostics. A representative comparison with Icarus Verilog and Quartus II further illustrates observable behavioral differences in selected include-related scenarios. The current evaluation focuses on semantic correctness and boundary behavior rather than large-scale performance benchmarking, which has been identified as a direction for future work. By decoupling preprocessing from later frontend phases and making preprocessing state explicit, Stagira svpp provides a reusable reference implementation for studying and validating SystemVerilog preprocessing behavior.

Read PDF

Similar papers

Preprint Aug 2026

DepWareTrans: Dependency-Aware Incremental Repository Migration across Co-executable Languages

This paper proposes a dependency-aware incremental migration framework that elevates the unit of translation from individual files to dependency-consistent batches and improves scalability and reliability in repository-level code translation.

Sivajeet Chand, Alexander Pretschner, Steve Haupt et al. · 2 citations
Open access Aug 2026

From Logging Configuration to Code Execution: A Systematization of Log4j 2 File-Write Primitives in HTTP-Exposed JMX

This work distinguishes ActiveMQ paths from documentation-limited Apache James, WildFly, Apache Karaf, and Red Hat AMQ cases, and distinguishes ActiveMQ paths from documentation-limited Apache James, WildFly, Apache Karaf, and Red Hat AMQ cases.

A. Caciulescu, Matei Badanoiu, R. Rughiniș et al. · 0 citations

Automated Generation of RISC-V Extensions with Formal Correctness Guarantees

Janus is presented, an LLM-assisted framework that synthe-sizes custom instructions integrated into the Ibex RISC-V core while keeping correctness outside the agent, demonstrating a practical path for using LLMs to explore ISA specialization without making the agent part of the trusted correctness boundary.

Elisavet Lydia Alvanaki, Jia-Kun Wang, Eugenio Muscinelli et al. · 0 citations
Book Open access Sep 2026

Demonstrating SAGE: A Dataflow-Native Framework for Modular, Controllable, and Transparent LLM-Augmented Reasoning

This demo presents SAGE as a pipeline-native runtime system and demonstrates it through an OPC-facing control plane and includes a compact distributed comparison against a LangChain RPC baseline over a shared 15-workload RAG suite, where SAGE nearly doubles full-RAG throughput under matched 8-node settings.

Jun Liu, Shu-Hao Zhang · 0 citations

Generators - Deferred Evaluation in XPath 4

This paper introduces generators as a first-class abstraction for deferred evaluation in XPath 4.0 and defines a composable library of functions that enables complex data-processing pipelines without eager evaluation.

Dimitre Novatchev · 0 citations
Preprint Sep 2026

SIMT-Aware Lockstep Verification and Functional-Coverage Closure Methodology for an Open-Source RISC-V GPGPU: A UVM 1.2 Environment

A UVM 1.2 environment and methodology that wraps a bus-master SIMT DUT with role-inverted agents, integrates Vortex's functional simulator (SimX) as a per-configuration golden model over DPI-C, and renders verdicts via two injection-qualified checkers.

Samuel Moussa, Steven Ibrahim, Ahmad Sudky et al. · 0 citations

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.