Modular Horner Expansion Diagrams (M-HED)
- Modular Horner Expansion Diagrams (M-HED) are graph-based, canonical representations of integer-valued functions over Z_m that incorporate modular arithmetic for efficient datapath verification.
- They employ reduction rules like eliminating redundant nodes and merging isomorphic nodes to create compact diagrams that support swift arithmetic operations and structural matching.
- The iterative, segment-based equivalence checking approach of M-HED significantly improves memory usage and runtime performance in verifying complex, pipelined, and nested designs.
A Modular Horner Expansion Diagram (M-HED) is a canonical, compact, and graph-based representation of integer-valued functions of word-level variables over the finite ring , where is typically for -bit datapaths. M-HED extends the Horner Expansion Diagram (HED) by incorporating modular arithmetic, enabling equivalence reasoning for datapath designs, even in the presence of complex pipelining and nested loop behaviors. This construction plays a central role in scalable formal equivalence checking by reducing polynomial functions modulo and enforcing reduction rules to maintain a canonical form that efficiently supports arithmetic operations and structural matching.
1. Formal Definition and Structure
The M-HED represents a function over ordered word-level variables as a directed acyclic graph . Each nonterminal node is labeled with:
- (the variable associated with the expansion),
- Two outgoing edges carrying weights ,
- points to the "0" child (), to the "1" child ().
Two distinguished terminal nodes ("0" and "1") represent , often merged if . The semantics of a node are:
Every M-HED is reduced to canonical form by:
- Eliminate Redundant Node: If , is replaced by its 0^ child, and is multiplied into its incoming weights.
- Merge Isomorphic Nodes: Nodes with identical variable, child pointers (after normalization), and weights are merged.
Through bottom-up application of these rules, the reduced M-HED is unique for each polynomial in .
2. Horner Expansion and Arithmetic in M-HEDs
Expansion in one variable follows:
For multivariate polynomials, this expansion recurses on the highest-ordered variable. Arithmetic on HEDs is structured by variable alignment and node type, summarized as follows:
| Terminals | Terminal Nonterminal | Both Nonterminals | |
|---|---|---|---|
| Addition | new terminal | Add value into 's ("const" branch) | Decompose around top variable , combine |
| Multiplication | new terminal | Multiply 's by recursively | Decompose, cross-product four terms |
Boolean bitwise ops are encoded as follows over :
Bitwise shifts correspond to scalar multiplication or division by powers of two, modulo .
3. Construction from Arithmetic or RTL Descriptions
An M-HED is constructed from single-assignment statements produced via symbolic simulation of either high-level C/SystemC or behavioral-synthesized RTL. The standard construction proceeds as follows:
- Initialization: Set up a hash table ("nodeCache") for memoization.
- Traversal: For each assignment :
- Recursively traverse .
- Map leaf variables/0s to terminals.
- For operators (+, –, ·, , , , , ), invoke the appropriate three-way case logic, record and reduce via Rules 1–2, and cache.
- The traversal yields an M-HED root node for each output variable.
- Efficiency: Shared subgraphs represent common subexpressions, minimizing redundancy.
- Edge Weights: All operations are over ; reductions through vanishing polynomials ensure weights .
As a result, every datapath expression, regardless of complexity, is mapped to a unique, minimized M-HED in .
4. Segment-Based Equivalence Checking with M-HED
Equivalence checking leverages M-HED by partitioning designs into segments based on dynamic cut-points, thus maintaining resource scalability. The approach involves:
- Symbolic simulation produces flattened assignment lists for the high-level reference (LAASC) and pipelined RTL (LAPRTL).
- Each iteration extracts segments of lines and maps them to M-HEDs.
- Equivalence checking between M-HEDs of the current segments proceeds via pointer equality of their root nodes—indicative of exact polynomial equivalence modulo .
- Matching outputs are removed along with all purely local nodes feeding them, replaced by "trusted" primary inputs. Remaining segments are updated accordingly.
- If equivalence is blocked, "internal equivalence" is tested by making internal nodes output roots and matching again.
- Iteration continues until all outputs are matched or a non-equivalence is established.
This iterative reduction ensures that at every stage, only a midsize M-HED need be maintained. Equivalence is reduced to trivial pointer comparisons, circumventing combinatorial explosion typical in nested, pipelined loop verification.
5. Illustrative Example
Consider an unrolled loop body in C:
1 2 3 |
tmp1 = A[i] – B[i]; tmp2 = A[i] + B[i]; out[i] = tmp1 * tmp2; |
Symbolic unrolling for yields assignments:
1 2 3 |
t1 := A0 - B0 t2 := A0 + B0 y := t1 * t2 |
Under :
- : node with , , .
- : node with , , .
- : is recursively combined and reduced, representing modulo .
The root nodes of M-HEDs for two equivalent segments from different descriptions (e.g., C and RTL) will be pointer-identical if and only if the functions are equivalent modulo , including any vanishing polynomial factors.
6. Properties, Advantages, and Scalability
- M-HED extends HEDs with modular arithmetic, ensuring that expressions differing only by a multiple of reduce to the same canonical graph in .
- Shared subgraphs enable compact encoding of very large expressions.
- Segment-based reduction and the iterative scheme allow verification to scale to complex, pipelined, and nested loops.
- Empirical results show an average of memory reduction and runtime improvement compared to SMT- and SAT-based equivalence checking in large synthesized designs.
- Equivalence checking is reduced to a pointer equality test, in contrast to symbolic simulation or SAT-solving, which typically scale poorly.
- This methodology accommodates the verification of behaviorally synthesized designs, avoiding the state-space blow-up that can result from direct input/output symbolic comparison.
This suggests that M-HED-based equivalence checking enables formal methods to scale in application areas that are otherwise intractable for classical combinational equivalence or bit-level model checking approaches.
Sponsored by Paperpile, the PDF & BibTeX manager trusted by top AI labs.
Get 30 days free