Skip to content
hw.dev
hw.dev/signal/uhdm2rtlil-recursion-stack-limit-2026
SignalCHIPS Alliance

A 64-Level Guard Stops One Hardware Parser From Crashing

A synthesis frontend now turns runtime recursion into a bounded warning instead of a 75,000-frame stack crash.

Thesis connection

A deterministic failure mode makes automated chip builds easier to diagnose and safe to rerun.

#eda#testing#verification#tools
Read Original

The Universal Hardware Data Model (UHDM) to register-transfer-level intermediate language (RTLIL) frontend, which translates parsed SystemVerilog into Yosys's internal chip-design format, tried to expand mutually recursive functions until the process crashed after roughly 75,000 stack frames. The source function stopped after a runtime counter reached ten, but synthesis works before that runtime value exists and couldn't prove where to stop.

The frontend now limits nested expansion to 64 calls, emits a warning, and drops the deeper call. A regression reproduces the original recursion, proves a separate output still has the expected structure, and demonstrates that the old build crashes. The repaired case completes its standards test in 0.16 seconds.

Crashing is a poor answer to valid source that a synthesis tool can't implement. A bounded diagnostic gives an automated build a stable result and tells the designer what to rewrite. Other hardware-language frontends should add explicit resource limits around expansion passes before malformed or runtime-dependent input reaches the host process stack.