Conditional Coverage in Formal Verification
Conditional Coverage in Formal Verification
Coverage
(Invited Tutorial)
Prashant Aggarwal Darrow Chu Vijay Kadamby Vigyan Singhal
Oski Technology Cadence Design Systems Cisco Oski Technology
Gurgaon, India San Jose, CA, USA San Jose, CA, USA Mountain View, CA, USA
prashant@[Link] darrow@[Link] vkadamby@[Link] vigyan@[Link]
Abstract—Model checking tools are gaining traction as a tional complexity problem. Most tools deploy sophisticated
practical formal verification solution for industrial designs. abstraction-refinement algorithms under the hood [5], [19].
However, the use of abstraction models is key to overcoming On top of that, formal users can deploy manually crafted
complexity barriers in applying these tools. Coverage has been a
useful metric to determine when simulation-based verification abstractions [4], [6], [7], [11], [13] to further reduce the
is complete. In this paper, we show how similar coverage complexity of the proofs. In this paper, we will take a complex
metrics can be used to determine the completeness of a formal design with a large state space, and show how the use of
verification setup. We also show how coverage can be used to abstraction models can help achieve end-to-end formal for this
determine effectiveness of different abstraction models are. This design.
methodology can be used to set formal verification goals, and
to measure the progress of the work, thereby placing formal
verification in a chip design schedule. We use a real-world
design with a large state space, and present quantitative coverage Coverage metrics are widely used in simulation-based veri-
metrics to illustrate the methodology, and its benefits for faster fication to improve the quality of the test suite and estimate the
run-time, faster discovery of bugs, and higher coverage. progress of the verification task [9], [18]. Coverage can help
identify important gaps in the stimuli provided to the design-
I. I NTRODUCTION
under-test, although it has a known limitation that coverage
During the last decade, formal verification tools have been does not evaluate the quality of the simulation checkers. The
increasingly more popular for the pre- and post-silicon verifi- same coverage metrics can be deployed for formal verification
cation of a diverse class of IC designs, varying from custom with the same limitation [16]. Besides identifying uninten-
processor designs to general-purpose ASICs. While multiple tional over-constraints in a formal environment, formal cover-
formal verification technologies are used in the industry (e.g. age can estimate the effectiveness of the abstraction techniques
model checking, theorem proving, C-vs-RTL sequential equiv- being deployed – for example, a set of abstraction techniques
alence checking), model checking tools account for most of the is useful, if it enables many more lines or expressions of code
usage, judging from the number of available commercial tools to be reachable in the same amount of CPU time.
as well as verification users in place. Furthermore, major EDA
vendors (Cadence, Mentor Graphics and Synopsys) as well as
a few startups (Averant, Jasper, OneSpin and Real Intent) offer In this paper, we use formal coverage metrics to quanti-
competitive solutions. In this paper, we will use the term model tatively demonstrate that suitable abstraction models achieve
checking synonymously with formal verification. convergence. We begin by introducing end-to-end formal
The extent to which an ASIC design tapeout schedule verification in Section II, and the components required to
depends on formal verification is greatly contingent upon the build such an environment. We mention the role of abstraction
scope of verification addressed by formal. Most often, formal techniques to solve end-to-end formal in Section III. Next,
is used as a supplement to simulation, to prove some specific in Section IV we discuss how coverage is used for formal
difficult-to-verify behavior, local embedded RTL assertions, verification, and introduce a coverage-driven flow for formal
or interface protocol checks between blocks. Less often is verification. In Section V, we introduce the design we have.
formal used for end-to-end verification to replace simulation, This design has a state space that is fairly large for a typical
so that formal verifies most or all functionality of a design model checker to handle, more than 1 million flops. The
and simulation is used only for higher chip-level or system- design is an integral part of a large real-world ASIC switch.
level verification. End-to-end formal usually requires almost Section VI describes some of the constraints and checkers
the entire logic in the design to be analyzed by the formal needed for formal verification, including the most important
tool, and poses significant complexity barriers. end-to-end data checker. In Section VII, we describe the
Formal verification tool developers as well as users have abstraction models deployed to overcome complexity barriers.
long used abstraction techniques to overcome the computa- We present the coverage results in Section VIII.
of the cone-of-influence of the checks and constraints. For
end-to-end formal verification, the model checking engine
which is often the most effective is Bounded Model Checking
(BMC) [1]. Although BMC can only find counterexamples,
and not establish the full proof of any checks, the bounded
proofs are good enough if the bounds are greater than the
interesting corner-case behavior of the design, as judged by
the verification or the design engineer.
Two complexity problems can interfere with BMC reaching
Fig. 1. End-to-end verification setup
acceptable proof bounds:
• the size of the logic in the cone-of-influence, including
II. E ND - TO -E ND F ORMAL the number of flops as well as the combinational logic;
and
A. Checkers and Constraints
• the state space diameter of the design, especially in
Besides reading the design-under-test (DUT), a model presence of large counters, or sequentially deep logic.
checker requires a set of checkers and constraints as inputs. The use of abstraction techniques, discussed in the next
The checkers and constraints can be written as properties in section, is the best strategy to overcome these complexity
SystemVerilog Assertion language (SVA) [8]. However, often problems.
these checkers and constraints require supporting modeling
code written in synthesizable SystemVerilog. III. A BSTRACTION T ECHNIQUES
Checkers can vary widely in scope:
Abstraction techniques [3] are used to reduce the state space
• Local checkers, also known as assertions. These checkers
of the design, so that formal verification tools can solve a
verify local properties of the design, and belong to one computationally easier problem. An abstraction is considered
of the following: sound if does not reduce any design behavior, even if it adds to
– Embedded RTL assertions. These assertions are local the design behaviors. We will only consider sound abstractions
properties about the implementation details in the in this paper. Such abstractions can find proofs or failures
DUT, such as a state machine always stays one-hot faster. Every proof is guaranteed to be a proof on the original
encoded, or that a full FIFO is never written to. These design. Each failure can be debugged to determine if it is a true
assertions are typically written by the RTL designer, counterexample due to an RTL bug, or a false counterexample
and embedded in the RTL code [21]. due to an over-abstraction.
– Interface assertions. These assertions encode the Examples of various abstraction techniques include:
handshake protocol requirements for any of the in-
1) Cut-points. Any internal logic in the design can be
terfaces of a design. These requirements can vary
replaced by a cut-point, allowing that net to freely take
from a simple request-acknowledgement protocol to
a random value at any time [6], [12]. If a checker proves
a more complex ARM AMBA AXI [15] or DDR2
with such an abstraction, we can achieve significant
protocol [6].
reductions in run-time (of course, it also implies the
• End-to-end checkers (Fig. 1). These checkers primarily need for additional checkers, since the proven checker
use a significant modeling code to encode a reference is clearly independent of the excised logic).
model for the required behavior of the design, by relating 2) Counter abstraction. Many designs have deep counters,
the correctness of the output data path of a design, given for example, the initialization phase for DDR2 memory
the transactions on the input datapath. controllers last for hundreds of milliseconds, consuming
Bugs found through any of these checkers are useful. However, millions of clock cycles. Many useful checks can be
if formal is to be relied upon as a primary verification proved by abstracting the 2n -state graph of an n-bit
methodology for a design, simply verifying local checkers counter to a few states, e.g. 0, 1, at-least-one, at-least-
is not enough – a significant number of end-to-end checkers zero [14].
must be used to achieve adequate verification. Not surprisingly, 3) Symmetric datatypes. Certain systems [7], [13] allow
proving the end-to-end checkers is usually computationally the users to specify that certain data types in the design
much more complex than local checkers, although there may are symmetric, and the values of these types are used
be exceptions to this, and some local checkers may be difficult only in certain symmetric ways (e.g. only compared for
to prove too. equality, or used as indices for arrays). This allows the
system to reduce multiple symmetric proofs into a single
B. Complexity one.
The largest barrier to formal verification achieving the 4) Data independence. When data moves across a design,
desired results is the complexity barrier faced by the tools. and the design does not use the data contents for control-
All known algorithms are worst-case exponential in the size ling the movement of the data, a few finite instantiations
of data values are sufficient to establish the correctness
of any checkers [20]. This technique has been used to
prove data correctness for many data transport hardware
designs [11], [17].
5) Tagging. Often systems deal with a finite but large set of
distinct data values [13]. Portions of such systems can
be abstracted by simplifying the structure with respect
to a specific or a symbolic tag.
Often, using an abstraction technique requires cut-pointing a
section of the design, and adding constraints on the cut-points.
The abstraction can be used to prove the desired checks. To
complete the compositional proof [13] however, a second step
is required – the constraints need to be converted into checks,
and proven on the previously excised logic.
Fig. 2. Formal verification coverage flow
IV. C OVERAGE
A. Coverage in Simulation
In simulation-based verification, coverage metrics are used ((a && b) || c), in line 2, is reachable in n cycles, this
heavily to determine when simulation is complete. The most line would be reported as covered, and otherwise, not. Thus,
common coverage metric is code coverage, including line, line coverage numbers would mean the same in simulation –
expression, FSM and toggle coverage. Line coverage, for whether a certain coverage target is exercised or not. And
example, computes what percentage of RTL statements in the for formal, this would measure the quality of constraints (i.e.
DUT were exercised by a given set of tests. For example, absence of over-constraints), as well as the BMC proof depths.
consider: Abstraction techniques, described in Section III, can help in
achieving higher proof depths, improving the coverage results
1: always @(posedge clk) begin and thereby increasing the value of formal verification. Com-
2: if ((a && b) || c) mercial formal tools are beginning to support the measurement
3: e <= d1; of formal coverage.
4: else
5: e <= d2; C. Formal Coverage Flow
6: end Refer to Fig. 2 for the flow we use for a coverage-
This example results in two line coverage targets, corre- driven formal verification deployment. Like simulation, code
sponding to lines 3 and 5. If a test causes c to be 1, the line coverage results are used to identify missing gaps in the
3 will be marked as covered. If no test in a test suite covers formal verification implementation. Abstraction models are
line 5, line coverage for the suite will be reported at 50%. used heavily to increase the coverage to acceptable levels on
100% judged line coverage (given, say 99% automated cov- complex designs where formal would otherwise be infeasible.
erage) is frequently a requirement for an ASIC tapeout – each Since we are using the same coverage metrics, we can
line that is not automatically reported as covered in simulation, even merge coverage results. It is often the case that one
must be manually judged to be either redundant, or legacy block is verified end-to-end with formal, and a larger block
code, or symmetric to another tested line. Tapeout would be containing this block is verified with simulation. Even if the
delayed until more tests are written to cover the remaining line coverage with formal is not 100% for the block, as long
lines. 100% line coverage does not imply an absence of bug. as the unified simulation and formal line coverage is 100%,
Still, line coverage helps measure the continuous progress of verification is considered complete from the perspective of
verification completeness in a dynamic chip design schedule, line coverage goals. This of course relies on an important
and often points to important coverage holes. assumption – that the set of formal checkers is as complete as
the set of simulation checkers. Although formal coverage helps
B. Formal Coverage Metrics determine the quality of constraints as well as sequential depth
The same coverage metrics used in simulation can be reached, like simulation, coverage does not imply anything
applied to answer the question of whether the planned formal about the completeness of checkers. This has to be evaluated
verification tasks are complete, or how much the formal independently.
verification tasks complement the simulation effort [16].
Simulation-based line (or expression) coverage metrics can V. C ELL R EFORMATTER D ESIGN
be used to mean exactly the same in formal – given the The Packet Rewrite Module (PRM) design modifies in-
constraints used and the proof depths reached in BMC (say, n coming packets from multiple ports and reformats these
cycles), report what percentage of line (or expression) targets packets before passing them on. Fig. 3 shows the sequence
are reachable in n cycles. For the example in Section IV-A, if of operations on a packet when it passes through various
Fig. 4. Toplevel of CellReformatter
Parameters Values
Inputs 4,425
Outputs 3,488
Total flops 1,048,481
C. Challenges to Formal
The major challenges to achieving convergence with formal
are:
1) Large number of flops. Greater than 1 million storage
elements (Table I) is enough to create a state space
search problem that cannot be solved without the use
of abstraction models. This large count is dominated by
the number of flops needed for dataFifo: due to number
of ports (56), number of per-port cells stored (16) and
the size of each cell (128 bytes).
2) High sequential depth due to latency. No input port
at input is allowed to appear more than once in 4
consecutive clock cycles. This constraint, along with
the latency of CellReformatter and the FIFOs depths,
implies that a high sequential depth is required for
Fig. 5. Banked architecture of dataFifo proofs.