|
Design Tools
Applying verification coverage to HDL-based hardware design is a relatively new concept that's rapidly gaining popularity. Verification coverage can help designers using HDL-based designs improve design quality and reduce time to market by providing a quantitative measure of simulation completeness. By monitoring the execution of the HDL code during simulation, verification coverage can ensure that the entire design has been simulated. To do that, however, coverage tools must address two problems. The first is highlighting the parts of the design that haven't been simulated. The second is showing that the design has been completely verified, so that the designer can move on to other tasks. There are a number of different types of verification coverage, each of which contributes to solving the verification problem. Generally, designers use multiple coverage techniques to obtain a complete picture of the thoroughness of the simulation.
A new concept
Several commercial tools for Verilog and VHDL code coverage are now available. The value of code coverage to the hardware community is generally higher than to the software community because of the high cost of "respinning" a chip in terms of both NRE costs and time to market. As chip complexity increases, design verification at the RT level becomes a primary bottleneck. Verification coverage analysis is used primarily during RTL simulations, where the design is typically verified for functionality. The RTL simulations are often the "golden simulations"--simulations at other levels of abstraction must agree with them. Portions of the HDL code that aren't verified at the RT level may remain unverified as the design proceeds towards fabrication. Verification coverage can be used to measure how much simulation is needed before committing a design to synthesis or fabrication. It answers an important question that designers and verification engineers ask during simulation: Are we done yet? In a typical design environment, the verification task is completed when the engineers think they've done a thorough simulation. This typically subjective measurement of verification completeness is based on the designer's understanding of the design. Verification coverage provides a method for designers to perform a quantitative analysis of simulation completeness before committing the design. They can determine what areas haven't yet been tested, so that they can focus their efforts on these areas. In addition, some cases may not be exercised during actual product testing, because it's difficult and costly to create the circumstances. Verification coverage can guarantee these cases are exercised during simulation. As a result, designers can obtain 100 percent coverage, increasing their confidence that their design is correct. Furthermore, verification coverage can eliminate redundant simulations. As simulation proceeds, tests written for one purpose will often test other functions. Verification coverage information identifies these overlaps automatically.
Black box and white box testing
Black box testing can ensure that the design functions as expected for the given input stimulus, but it doesn't ensure that that the input stimulus fully exercises the code. Using a black box strategy, the designer measures verification completeness by assessing the number of tests successfully run, the number of cycles successfully run, or the completion of certain milestones (for example, booting the operating system). White box testing, sometimes called "structural testing," is different from black box testing, because it provides visibility into internal data and structures. Verification coverage generally consists of measurements based on several white box techniques to ensure that the code is fully exercised. However, it is not structural testing. That is, it doesn't verify correctness; it only verifies that the design is thoroughly exercised. A complete test system verifies that the design is thoroughly exercised and that it functions properly.
Designers have been applying white box techniques for a long time. Verilog or VHDL "checkers" are often inserted into a simulation to monitor internal signals or states and verify that errors haven't occurred. Designers will often enter test code into the design, using their knowledge of the design to insert the tests. All of these methods are in effect "white box" methods. Although they are useful to ensure that the simulation is operating properly, they still don't provide a quantitative measurement of simulation completeness. Using a more systematic white box strategy, verification coverage tools provide better metrics to determine the completeness of verification and to target the verification efforts.
Limitations
Verification coverage is an extension of code coverage with improved metrics that selectively filter the raw data to increase the probability that verification has been performed. To prove that a design has been fully verified, even structurally, is difficult. However, it's possible to enhance code coverage technology significantly such that the likelihood of obtaining verification coverage is higher. Techniques focused on finite state machine (FSM) coverage, which typically verify both state visitation and state transitions, are more likely to have a correlation with verification coverage. Sometimes simple code coverage will report that a statement has been executed or "covered." Closer analysis of the expression coverage results, though, may show that the code was only executed during reset, when all of the variables were unknown ("X"). Therefore it was "covered" but not verified.
Types of Coverage
Statement execution coverage
Statement execution coverage can treat conditional statements as separate statements or as a single statement. The way the statements are treated has a great impact on the usefulness of statement execution coverage. For example, the Verilog code fragment:
always @ (a or b) begin
contains either two or three "countable" statements. The statement r = 0 is clearly one countable statement. The if statement, however, can be viewed as either one or two countable statements. If this line is treated as a single statement, it would be considered covered, even if the r = 1 code section is never executed. It's much more thorough to treat the line if (a == 0) r = 1; as two statements and report coverage of the r = 1 segment independently. In this scenario, there will be three independent statements. Some coverage systems that provide statement execution coverage will incorrectly claim to provide decision coverage, because they've verified that all pieces of the code were executed. To truly obtain decision coverage, it's necessary to verify that the a = 0 case and the a = 1 case were both exercised. Statement execution coverage will report 100 percent coverage, even if a never equals zero. To obtain a more complete solution, statement coverage must be combined with decision coverage or expression coverage to verify that the a (does not equal) 0 case is checked. Although statement execution coverage is usually specified as a percentage, the figure can be misleading. The number of executable statements in a Verilog module can vary widely. Therefore, when statement execution coverage is less than 100 percent, the absolute number of statements covered versus the total number of statements is also important. Consider two modules, one with one line covered out of two, or 50 percent coverage, and the other with 75 lines covered out of 100, or 75 percent coverage. Clearly, the larger module is further from completion, although the percentage is higher. The verification coverage analyzer window shown (see Figure 2) lists both the percentage coverage for each module (the "S%" column) and the number of statements not yet covered (the "s#" column). The total number of "countable" statements in the module is also listed. (The "S%C" and "S#C" columns provide similar information for the module and its submodules.) The source code window highlights areas that haven't been thoroughly exercised in the simulation (see Figure 3). Statements highlighted in red haven't been executed, whereas red expression coverage percentages indicate expressions that haven't been completely exercised.
Basic block coverage
Decision coverage
if (a == 0) begin This example contains a branch that could be exercised in one of two ways. Decision coverage will report whether the if statement was evaluated as both true and false during simulation. Note that decision coverage still applies if the else statement doesn't exist, as in the following example: if (a == 0) begin The if statement can still be evaluated as both true and false; decision coverage will still verify that both the explicit branch (a = 0) and the implicit branch (a = 1) are executed. This is sometimes referred to as an implied else statement. Decision coverage also applies to case statements: case (a) In this example, decision coverage will verify that each of the three branches of the case statement is taken. In this particular example, however, the same information could be obtained from statement execution coverage, since each leg of the case statement is a separate statement. However, in the example: case (a) statement execution coverage will consider the line 1,2: q = 7; covered if a is 1 or 2 . Decision coverage analysis is needed to verify that a has been both 1 and 2 during simulation.
Expression coverage
assign a = b || c ; it's useful to examine each element and verify that its impact has been measured on the design. At a minimum, the following cases should be verified: b = 0, c = 0; b = 0, c = 1; b = 1, c = 0 . In addition, some may wish to verify the case where both b and c are 1 . In a more complex expression, such as: assign d = (e == 4) || (f == 7) & g; it's important to verify that e = 4 and e (does not equal) 4, f = 7 and f (does not equal) 7 , and g has been both 0 and 1. In another complex expression: assign a = ( b || c ) && (d || f ) && g it's important to examine the Boolean base elements and verify that each variable in the expression has had an impact on the output. The expanded expression coverage results indicate what combinations of variables haven't been exercised (see Figure 4).
State machine coverage
When using state machine coverage, designers must verify that every legal state of the state machine has been visited and that every legal transition in the state machine has been exercised. Verification can be accomplished by analyzing the changes of the state variable in conjunction with the state machine's clocking mechanism. State machines can be very complex. Not every state (especially not every state transition) is legal or needs to be tested. During simulation, it's reasonable to expect each state to be visited, but it's unlikely that every transition between states will be covered. Manually indicating which state transitions should and shouldn't be checked can be exceedingly cumbersome. Fortunately, verification coverage tools can extract the legal state transitions automatically from the code.
Path coverage
if (a) begin there are four paths through the code fragment that correspond to the possible combinations of a and b . It's possible to obtain complete statement execution coverage and complete decision coverage and still not have complete path coverage. Executing this sequence of code with a = 0 and b = 0 and then with a = 1 and b = 1 will obtain full statement execution coverage and decision coverage. Path coverage will report only 50 percent coverage, since the two cases in which a (does not equal) b haven't been covered.
Path coverage is considered by some to be too cumbersome in practice. There are a very large number of possible paths through a design, making 100 percent path coverage impractical or impossible. Consider the following code fragment: if (a) begin Standard path analysis will require four paths to be exercised in this example. If a doesn't change in the code, however, only two real paths exist. Locating and justifying all of the spurious errors in path coverage data can require significant effort.
Event coverage
A typical example of event coverage in Verilog is the always @ statement--for example: always @ (a or b or c) begin Data can be recorded to verify that the code segment in the always @ statement has been "fired" for each of the variables it has been sensitized to. The precise usefulness of this method depends on the application. It isn't commonly used to verify sequential designs.
Toggle coverage
Toggle coverage can be used as a crude method of verification coverage as well. If a bit doesn't toggle from 0 to 1 or from 1 to 0 , it probably hasn't been adequately tested. Toggle coverage is well suited to gate-level designs. It serves little purpose to perform statement execution coverage on a gate-level representation, since there are no real "statements." At the gate level, toggle coverage provides more information regarding the thoroughness of the simulations.
Variable coverage
Dean Drako cofounded San Josebased Design Acceleration, Inc. in 1992. From 1993 through 1995, he was vice president of business development and engineering at 3DO. In December 1995, he rejoined DAI, where he is president and CEO. Paul B. Cohen handles application engineering and product marketing for DAI Coverscan. Before joining DAI in 1996, he was a senior design engineer at Integrated Device Technology's Atlanta Design Center, where he was also involved in EDA tool definition and support. To voice an opinion on this or any Integrated System Design article, please email your message to miker@isdmag.com. integrated system design June 1998[ Articles from Integrated System Design Magazine ] [ ICs and uPs ] [ Custom ICs and Programmable Logic ] [ Vendor Guide ] [ Design and Development Tools ] [ Home ] For more information about isdmag.com email webmaster@isdmag.com For advertising information email amstjohn@mfi.com Comments on our editorial are welcome. Copyright © 2000 Integrated System Design
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
Home | About | Editorial Calendar | Feedback | Subscriptions | Newsletter | Media Kit | Contact | Reprints| RSS|
Digital| Mobile |
| Network Websites |
|
International |
|
Network Features |
|
|
|
All materials on this site Copyright © 2009 TechInsights, a Division of United Business Media LLC All rights reserved. Privacy Statement | Terms of Service | About |