Skip to content
VLSI

How to Debug Formal Equivalence (LEC) Failures in RTL-to-Gate Flows

  • 10 min read

RTL-to-gate equivalence checking is an important verification step in the ASIC design flow. RTL describes the intended hardware behavior, while synthesis converts that description into a gate-level netlist through logic optimization, technology mapping and other transformations.

Although synthesis tools are designed to preserve functionality, the resulting netlist must be checked against the reference RTL before it proceeds further in the implementation flow.

This is where Logic Equivalence Checking (LEC) is used.

LEC compares two design representations and determines whether they produce equivalent behavior under the specified assumptions and constraints. However, an equivalence run does not always complete successfully. Engineers may encounter setup errors, unmatched compare points, failed partitions or counterexamples showing different outputs.

A failed LEC result does not automatically mean that synthesis has introduced a functional bug. The cause could be an incorrect constraint, missing design input, inconsistent parameter configuration, unsupported modeling assumption or an actual RTL-to-netlist mismatch.

This article explains how to identify these problems systematically and debug LEC failures in a typical RTL-to-gate flow.

What Is Formal Equivalence Checking?

Formal equivalence checking is a mathematical method used to determine whether two hardware representations behave equivalently under defined conditions.

In an RTL-to-gate flow, the two main representations are:

  • Reference design: The RTL source code used as the functional reference.
  • Implementation design: The synthesized gate-level netlist generated from the RTL.

The LEC tool analyzes the two designs and attempts to prove that their corresponding outputs and internal comparison points behave consistently.

For example, consider the following RTL:

module simple_logic (

    input  logic a,

    input  logic b,

    output logic y

);

    assign y = a & b;

endmodule

The synthesis tool may implement this logic using an AND gate.

The RTL expression and the mapped gate implementation are structurally different, but their Boolean behavior is identical:

[
y = a \land b
]

LEC verifies this equivalence without relying on a limited set of simulation test vectors.

For larger designs, equivalence checking may use internal compare points and partitioning to divide the overall proof into manageable sections.

Understanding Different Types of LEC Failures

Before debugging a failure, identify which stage of the equivalence flow reported it.

A. Setup or Elaboration Failure

The tool may fail before formal comparison begins.

Common causes include:

  • Missing RTL or netlist files.
  • Incorrect top-module selection.
  • Missing standard-cell libraries.
  • Undefined parameters or macros.
  • Incorrect module paths.
  • Unsupported or inconsistent language settings.

Example: The reference RTL is elaborated with DATA_WIDTH=32, but the implementation netlist was generated using DATA_WIDTH=16.

The two designs may have different port widths and internal structures. This is a configuration mismatch, not necessarily a synthesis defect.

Debugging approach: Compare the elaboration logs, parameter values, macro definitions and file lists used by the reference and implementation setups.

B. Unmatched Compare Points

LEC tools may use internal registers, signals or other corresponding logic points to establish comparisons between the two designs.

A compare point may remain unmatched if:

  • A register was renamed or optimized away.
  • Logic was restructured during synthesis.
  • A memory was converted into a different implementation.
  • The reference and implementation contain different hierarchy.
  • Matching or mapping settings are incorrect.

An unmatched point does not automatically indicate functional inequivalence. It means the tool could not establish the expected correspondence using its current matching strategy.

Debugging approach: Inspect the unmatched-point report, identify the affected hierarchy and determine whether the structural difference is expected. Check whether the tool can prove equivalence using alternative matching or partitioning strategies.

C. Functional Mismatch

A functional mismatch occurs when the tool finds a condition under which the reference and implementation produce different behavior.

This is one of the most important failure categories because it may indicate an actual design problem.

The next step is to inspect the counterexample or failing trace and identify the earliest point where the two designs diverge.

Common Causes of RTL-to-Gate LEC Failures

Incomplete or Incorrect Constraints

LEC analysis depends on the assumptions and constraints supplied to the tool.

If the reference and implementation are analyzed under inconsistent conditions, the tool may report differences that do not represent the intended operating environment.

For example, consider an input that is assumed to remain constant during normal operation. If that assumption is missing or applied differently between the two configurations, the formal engine may explore input combinations that the design specification does not permit.

How to debug:

  • Review primary input constraints.
  • Check reset and initialization assumptions.
  • Verify clock and operating-mode definitions.
  • Confirm that equivalent assumptions are applied consistently.
  • Avoid adding constraints simply to suppress a failure.

Constraints must reflect the actual design specification. Over-constraining a design can hide real functional problems.

Incorrect Handling of Black Boxes

Large SoCs may contain memories, analog IPs, encrypted blocks or third-party modules that are not available as complete RTL models.

These blocks may be represented as black boxes during equivalence analysis.

If the reference and implementation use inconsistent black-box definitions, port mappings or abstraction models, the tool may report unmatched points or mismatches.

Example: A memory macro has a read-data output in the reference model, but the implementation model uses a different port mapping or an inconsistent behavioral abstraction.

How to debug:

  • Confirm that the correct black-box modules are loaded.
  • Compare module names and port declarations.
  • Review the black-box configuration.
  • Verify that the abstraction preserves the required functional behavior.
  • Check whether the tool is comparing the intended boundary signals.
RTL and Synthesis Configuration Differences

Preprocessor macros, parameters and conditional compilation can change the implemented logic.

Consider this example:

module feature_block #(

    parameter WIDTH = 8

) (

    input  logic [WIDTH-1:0] data_in,

    output logic [WIDTH-1:0] data_out

);

`ifdef ENABLE_FEATURE

    assign data_out = data_in << 1;

`else

    assign data_out = data_in;

`endif

endmodule

If the reference is elaborated with ENABLE_FEATURE defined while the synthesized netlist was generated without it, the two designs implement different functions.

How to debug:

  • Compare macro definitions.
  • Verify parameter overrides.
  • Check synthesis configuration files.
  • Confirm the selected top module and hierarchy.
  • Review elaboration logs for both designs.

The reference configuration should represent the exact RTL version and options used to generate the implementation.

Synthesis Optimization and Logic Restructuring

Synthesis tools optimize logic to improve area, performance and power. They may simplify Boolean expressions, remove redundant logic, merge equivalent registers or restructure combinational paths.

These transformations can make the gate-level structure look very different from the RTL.

Consider:

assign y = (a & b) | (a & c);

Synthesis may factor the expression as:

assign y = a & (b | c);

The two expressions are logically equivalent:

[
(a \land b) \lor (a \land c)
= a \land (b \lor c)
]

A structural difference alone is not a reason to modify the RTL. The LEC tool must prove that the transformed logic preserves the required behavior.

How to debug: Inspect the failing partition, compare its input conditions and outputs, and determine whether the difference is structural or functional. Avoid forcing structural matching when the optimization is valid.

Incomplete Case Statements and X-State Behavior

Four-state RTL simulation uses 0, 1, X and Z, while formal engines and equivalence tools may use different modeling and interpretation strategies depending on their settings.

Consider:

always_comb begin

    case (sel)

        2'b00: y = a;

        2'b01: y = b;

        2'b10: y = c;

        default: y = 1'b0;

    endcase

end

The default branch defines behavior for the remaining selector combination. Removing or changing this branch can affect the logic implemented by synthesis.

Similarly, assumptions about unknown values, uninitialized registers and don't-care conditions can influence equivalence results.

How to debug:

  • Review the exact RTL and synthesis interpretation.
  • Check initialization and reset behavior.
  • Inspect X-state and don't-care modeling options.
  • Verify that the implementation does not rely on behavior excluded by the specification.
  • Do not treat every X-related failure as harmless.
Sequential Logic, Reset and Register Optimization

Sequential equivalence failures can be more difficult to debug because they involve state transitions over time.

Common causes include:

  • Different reset values.
  • Inconsistent reset polarity.
  • Missing reset assumptions.
  • Incorrect enable conditions.
  • Register merging or removal.
  • Retiming or sequential optimization.
  • Differences in initialization behavior.

For example, suppose the reference RTL initializes a register to zero during reset:

always_ff @(posedge clk or negedge rst_n) begin

    if (!rst_n)

        count <= 8'b0;

    else if (enable)

        count <= count + 1'b1;

end

If the implementation does not preserve the intended reset behavior, the two designs may diverge after reset.

How to debug: Inspect the failing register, reset conditions, clock behavior and state-transition sequence. Check whether the synthesis flow applied sequential optimizations and whether the LEC configuration accounts for them correctly.

Step-by-Step Method to Debug an LEC Failure

A structured approach is more effective than repeatedly changing RTL or modifying constraints.

Step 1: Identify the failure stage

Determine whether the run failed during setup, elaboration, matching, partitioning or formal comparison.

Step 2: Read the summary report

Identify the number of passing, failing and unmatched compare points. Record the affected hierarchy and partition names.

Step 3: Check the detailed logs

Review compile and elaboration messages, warnings, black-box information, library loading and constraint processing. In tools such as Formality and FormalPro, detailed reports and debug views help narrow down the issue.

Step 4: Open the failing partition

Inspect the reference and implementation logic around the failed compare point. Identify the relevant registers, combinational cones and input signals.

Step 5: Analyze the counterexample

If the tool produces a counterexample, trace the input sequence and state transitions. Find the first cycle where the reference and implementation outputs differ.

Step 6: Identify the root cause

Classify the issue as a setup mismatch, incorrect constraint, modeling problem, mapping issue or genuine functional bug.

Step 7: Fix and rerun

Correct the source of the problem, regenerate the required implementation files if necessary, and rerun equivalence. Preserve the reports and configuration used for the final passing run.

Practical Example: Debugging a Counter Mismatch

Consider a reference counter:

always_ff @(posedge clk or negedge rst_n) begin

    if (!rst_n)

        count <= 4'b0000;

    else if (enable)

        count <= count + 1'b1;

end

Suppose the implementation contains a counter with a different reset value:

always_ff @(posedge clk or negedge rst_n) begin

    if (!rst_n)

        count <= 4'b0001;

    else if (enable)

        count <= count + 1'b1;

end

The two designs behave differently immediately after reset.

If reset is active, the reference produces 0000, while the implementation produces 0001. A formal equivalence tool can identify this difference and report a failed comparison.

Debugging process:

  1. Identify the failing counter compare point.
  2. Open the corresponding reference and implementation logic.
  3. Inspect the reset values and reset polarity.
  4. Review the counterexample around reset assertion and release.
  5. Confirm the intended reset value from the design specification.
  6. Correct the RTL or implementation flow, depending on where the discrepancy originated.
  7. Regenerate the netlist and rerun LEC.

This example illustrates a genuine functional mismatch. In an actual project, engineers should trace the failing point to its source rather than assume that every counter failure has the same cause.

Best Practices to Reduce LEC Debugging Time

  • Maintain consistent RTL, synthesis and LEC configurations.
  • Use version-controlled file lists and constraint files.
  • Review synthesis warnings before generating the final netlist.
  • Maintain accurate black-box and library models.
  • Check parameters and preprocessor definitions.
  • Understand the difference between unmatched points and failed proofs.
  • Preserve counterexamples and detailed comparison reports.
  • Document justified waivers and review them before signoff.
  • Run equivalence after relevant RTL or synthesis-flow changes.
  • Avoid changing constraints merely to obtain a passing result.

A repeatable debug process improves confidence in the final netlist and reduces unnecessary iterations during implementation.

Tools and Skills Used in LEC Debugging

Formal equivalence engineers commonly work with tools such as Synopsys Formality and Siemens Questa FormalPro. The exact commands, report formats and debug interfaces vary by tool and version.

An engineer should understand reference and implementation setup, design elaboration, compare-point mapping, partition analysis, constraint handling and counterexample debugging.

The InSkill LEC Formal Verification training covers combinational and sequential equivalence, Formality and FormalPro, setup and mapping stages, comparison reports, compile details and hands-on failure debugging.

For engineers interested in the broader RTL-to-gate implementation process, the InSkill RTL Design and Integration course connects LEC with RTL integration, synthesis and other front-end design activities.

The VLSIGuru LEC Formal Verification course also covers equivalence checking, project setup and practical debugging using industry-standard formal tools. Engineers looking to understand the synthesis side can explore Synthesis and STA training at VLSIGuru.

Conclusion

Formal equivalence checking is essential for verifying that synthesis preserves the intended functionality of RTL designs. However, LEC failures can originate from several different sources, including setup inconsistencies, unmatched compare points, incorrect constraints, black-box modeling, synthesis optimizations and genuine sequential or combinational mismatches.

The most effective debugging method is to identify the failure stage, inspect the detailed reports, analyze the failing partition and trace the counterexample to its earliest divergence. Engineers should then correct the actual root cause and rerun equivalence using a controlled, reproducible configuration.

Developing these skills helps RTL designers and verification engineers understand how RTL transformations affect hardware behavior and improves confidence in the synthesized netlist before implementation signoff.

Share LinkedIn X WhatsApp