Knowledge Center
Knowledge Center

Code Coverage

Metrics related to about of code executed in functional verification


Code coverage is a completion metric that indicates how much of the code of the Design Under Test (DUT) has been exercised. It does not indicate that the code is correct or even that all necessary code is present. Code coverage can never be used to indicate the quality of the product, but can be useful to identify holes in the verification that has been performed. As such, it is often used to gate completion of verification process but never as a way to indicate sufficiency of verification.
There are several types of code coverage:
Line coverage: Have all lines of code been executed
Statement coverage: Have all statements been executed
Branch coverage: Have all branches in the code been taken
Expression coverage: Have all expressions that could affect a branch been executed
State / Transition coverage: Have all states of a state machine been active and have all transitions between states been traversed
Toggle coverage: Have all variables or all bits of all variables changed state and or been through all transitions