# Focused Expression Coverage (FEC)

by on January 26, 2009

In step one of FPGA Simulation we discussed code coverage and, more specifically, condition coverage and expression coverage.  Condition Coverage and Expression Coverage tell us whether we’ve fully tested a condition in a branch, or an expression in a continuous assignment or concurrent assignment.  In this article, we’ll talk about a new approach to expression/condition coverage that gives us more insight into our designs.  Let’s examine the following equation:

`(A || B)`

This is a simple OR-gate.  If we wanted to make sure we tested this OR-gate we could look at its inputs in one of two ways.

The traditional approach to covering the OR-gate inputs would be to find all the inputs that create a unique output.  There are three of these:

This table says that there are three row to fully cover an OR-gate.  There is the case where A is 1, so we don’t worry about B.  There is the case where B is 1 so we don’t worry about A, and there is the case where both are zero.

But does this really cover an OR-gate?  Focused Expression Coverage says: No.

### Focused Expression Coverage

Focused Expression Coverages (also called Modified Condition/Decision Coverage in DO-254 circles) takes a different route to deciding if everything has been covered.  Instead of just looking at the unique input combinations that can create an output, FEC asks a different question.  It looks for the number of ways that each input could vary the output, and then it checks to see if all these have been tested.  So our OR-gate gets four rows of inputs:

FEC Coverage Says Four Rows

FEC coverage tells us that first we need to hold the B input to zero and try both different values for A.  Then it says we need to hold A to zero and try both inputs of B.  If we haven’t given A and B an opportunity to  change the output, then how do we know what they would do?  FEC coverage would say that there are four different inputs necessary to test the OR-gate

### Summary

Traditional expression coverage and FEC coverage are two different ways of measuring condition and expression coverage.  They give different, and non-overlapping, results.  They will give you new insights into how your design works and whether you’ve fully tested it.

Be Sociable, Share!

Comments on this entry are closed.

Previous post:

Next post: