Table of Contents
Fetching ...

Anvil: A General-Purpose Timing-Safe Hardware Description Language

Jason Zhijingcheng Yu, Aditya Ranjan Jha, Umang Mathur, Trevor E. Carlson, Prateek Saxena

TL;DR

Anvil addresses pervasive timing hazards in hardware design by introducing a general-purpose HDL with a novel static type system that enforces timing safety across registers and signals. It models timing via events, lifetimes, and an event graph, allowing dynamic timing behaviors to be expressed while maintaining compile-time guarantees and safe module composition through timing contracts. The language provides channel-based communication, explicit timing control, and a formal safety framework, and it compiles to SystemVerilog with modest area and power overheads. Empirical evaluation across latency-sensitive components demonstrates practical viability, integration with SV projects, and no additional cycle latency. The work shows timing safety need not come at the cost of expressiveness, enabling safer, more reliable hardware design flows.

Abstract

Expressing hardware designs using hardware description languages (HDLs) routinely involves using stateless signals whose values change according to their underlying registers. Unintended behaviours can arise when the stored values in these underlying registers are mutated while their dependent signals are expected to remain constant across multiple cycles. Such timing hazards are common because, with a few exceptions, existing HDLs lack abstractions for values that remain unchanged over multiple clock cycles, delegating this responsibility to hardware designers. Designers must then carefully decide whether a value should remain unchanged, sometimes even across hardware modules. This paper proposes Anvil, an HDL which statically prevents timing hazards with a novel type system. Anvil is the only HDL we know of that guarantees timing safety, i.e., absence of timing hazards, without sacrificing expressiveness for cycle-level timing control or dynamic timing behaviours. Unlike many HLS languages that abstract away the differences between registers and signals, Anvil's type system exposes them fully while capturing the timing relationships between register value mutations and signal usages to enforce timing safety. This, in turn, enables safe composition of communicating hardware modules by static enforcement of timing contracts that encode timing constraints on shared signals. Such timing contracts can be specified parametric on abstract time points that can vary during run-time, allowing the type system to statically express dynamic timing behaviour. We have implemented Anvil and successfully used it to implement key timing-sensitive modules, comparing them against open-source SystemVerilog counterparts to demonstrate the practicality and expressiveness of the generated hardware.

Anvil: A General-Purpose Timing-Safe Hardware Description Language

TL;DR

Anvil addresses pervasive timing hazards in hardware design by introducing a general-purpose HDL with a novel static type system that enforces timing safety across registers and signals. It models timing via events, lifetimes, and an event graph, allowing dynamic timing behaviors to be expressed while maintaining compile-time guarantees and safe module composition through timing contracts. The language provides channel-based communication, explicit timing control, and a formal safety framework, and it compiles to SystemVerilog with modest area and power overheads. Empirical evaluation across latency-sensitive components demonstrates practical viability, integration with SV projects, and no additional cycle latency. The work shows timing safety need not come at the cost of expressiveness, enabling safer, more reliable hardware design flows.

Abstract

Expressing hardware designs using hardware description languages (HDLs) routinely involves using stateless signals whose values change according to their underlying registers. Unintended behaviours can arise when the stored values in these underlying registers are mutated while their dependent signals are expected to remain constant across multiple cycles. Such timing hazards are common because, with a few exceptions, existing HDLs lack abstractions for values that remain unchanged over multiple clock cycles, delegating this responsibility to hardware designers. Designers must then carefully decide whether a value should remain unchanged, sometimes even across hardware modules. This paper proposes Anvil, an HDL which statically prevents timing hazards with a novel type system. Anvil is the only HDL we know of that guarantees timing safety, i.e., absence of timing hazards, without sacrificing expressiveness for cycle-level timing control or dynamic timing behaviours. Unlike many HLS languages that abstract away the differences between registers and signals, Anvil's type system exposes them fully while capturing the timing relationships between register value mutations and signal usages to enforce timing safety. This, in turn, enables safe composition of communicating hardware modules by static enforcement of timing contracts that encode timing constraints on shared signals. Such timing contracts can be specified parametric on abstract time points that can vary during run-time, allowing the type system to statically express dynamic timing behaviour. We have implemented Anvil and successfully used it to implement key timing-sensitive modules, comparing them against open-source SystemVerilog counterparts to demonstrate the practicality and expressiveness of the generated hardware.

Paper Structure

This paper contains 42 sections, 7 theorems, 40 equations, 12 figures, 2 tables.

Key Result

Lemma C.12

If $(e_1 \to e_2) \in G$, then $e_1 \leq_G e_2$.

Figures (12)

  • Figure 1: Module Top interfaced with Memory.
  • Figure 2: Top: Anvil guiding designer through timing safe design. Bottom: BSV timing unsafe schedules.
  • Figure 3: High-level comparison between the flows enabled by verification- (top) and language-based (bottom) approaches. Steps involving manual effort are marked with the person icon. White and gray dashed boxes represent design and verification stages, respectively.
  • Figure 4: Cache output waveform expressed safely with static (left) and dynamic (right) timing contract.
  • Figure 5: Anvil checking the unsafe version of Top interfacing with memory subsystem with and without cache.
  • ...and 7 more figures

Theorems & Definitions (21)

  • Definition C.1: Execution log
  • Definition C.2: Local execution log
  • Definition C.3: Compositional execution log
  • Definition C.4: Concretization
  • Definition C.5: Program execution log
  • Definition C.6: Well-typed Anvil term
  • Definition C.7: Well-typed Anvil process
  • Definition C.8: Well-typed Anvil program
  • Definition C.9: Timestamp
  • Definition C.10: Event pattern timestamp
  • ...and 11 more