+ All Categories
Home > Documents > ECE/CS 5780/6780: Embedded System Design

ECE/CS 5780/6780: Embedded System Design

Date post: 06-Apr-2022
Category:
Upload: others
View: 6 times
Download: 0 times
Share this document with a friend
21
ECE/CS 5780/6780: Embedded System Design Scott R. Little Lecture 18: Introduction to Hardware Verification Scott R. Little (Lecture 18: HW Verification) ECE/CS 5780/6780 1 / 42 Administrivia Lab 8 status report. Set SCIBD = 52; (The Mclk rate is 16 MHz.) Scott R. Little (Lecture 18: HW Verification) ECE/CS 5780/6780 2 / 42
Transcript
Page 1: ECE/CS 5780/6780: Embedded System Design

ECE/CS 5780/6780: Embedded System Design

Scott R. Little

Lecture 18: Introduction to Hardware Verification

Scott R. Little (Lecture 18: HW Verification) ECE/CS 5780/6780 1 / 42

Administrivia

Lab 8 status report.Set SCIBD = 52; (The Mclk rate is 16 MHz.)

Scott R. Little (Lecture 18: HW Verification) ECE/CS 5780/6780 2 / 42

Page 2: ECE/CS 5780/6780: Embedded System Design

Acknowledgements

These slides were created with aid from several sources includingbut not limited to the following:

http://www.cse.psu.edu/˜vijay/verify/protected/Lectures.htmlCoverage Metrics for Functional Validation of Hardware Designsby Serdar Tasiran and Kurt KeutzerI’m Done Simulating; Now What? Verification CoverageAnalysis and Correctness Checking of the DECchip 21164 Alphamicroprocessor by Michael Kantrowitz and Lisa M. Noack

Scott R. Little (Lecture 18: HW Verification) ECE/CS 5780/6780 3 / 42

What is verification?

Verification: a process that determines if the design conforms tothe specification.

It answers the question, ”Does the design do what is intended?”

It is more than a testbench.

This lecture will concentrate on pre-silicon verification.

Often post-silicon verification is called testing.

Scott R. Little (Lecture 18: HW Verification) ECE/CS 5780/6780 4 / 42

Page 3: ECE/CS 5780/6780: Embedded System Design

Why do pre-silicon verification?

Bugs found at the block-level) have little cost.

Bugs found at the system-level may effect the time-to-market.

Bugs found after fabrication require an expensive respin.

Bugs found by customers can result in potentially companycrushing recalls and a bad reputation.

Scott R. Little (Lecture 18: HW Verification) ECE/CS 5780/6780 5 / 42

Who does verification?

Designers may begin the process.

Verification engineers manage and complete the process.

Verification engineers may outnumber designers 2-1!

Is that good or bad?

Scott R. Little (Lecture 18: HW Verification) ECE/CS 5780/6780 6 / 42

Page 4: ECE/CS 5780/6780: Embedded System Design

Verification

”Validation is so complex that even though it consumes the mostcomputational resources and time it is still the weakest link in thedesign process. Ensuring functional correctness is the most difficultpart of designing a hardware system.”–Serdar Tasiran and Kurt Keutzer

Scott R. Little (Lecture 18: HW Verification) ECE/CS 5780/6780 7 / 42

Why is verification hard?

It is an NP-complete problem.

How do you know when you are done?

How do you know that your specification is complete?

How do you verify the verifier?

Can only show the presence of errors, not the absence of them.

Scott R. Little (Lecture 18: HW Verification) ECE/CS 5780/6780 8 / 42

Page 5: ECE/CS 5780/6780: Embedded System Design

Common types of verification

Functional verification.Simulation.

Directed tests.Constrained pseudorandom tests.

Formal methods.Model checking.Equivalence checking.Automated theorem proving.

Timing verification.

Performance verification.

Scott R. Little (Lecture 18: HW Verification) ECE/CS 5780/6780 9 / 42

Functional Verification Approaches

Functional verification is primarily done via simulation.Black-box.White-box.Gray-box.

Scott R. Little (Lecture 18: HW Verification) ECE/CS 5780/6780 10 / 42

Page 6: ECE/CS 5780/6780: Embedded System Design

Black-box Verification

The verifier has access to input, outputs, and device function.

Given a set of inputs the verifier checks for correct outputs.

To fully verify a black-box you must show that function iscorrect for all combinations of inputs.

Full verification via black-box testing is impractical for any realdesign.

Scott R. Little (Lecture 18: HW Verification) ECE/CS 5780/6780 11 / 42

White-box Verification

The verifier has access to (and uses) internal signals duringverification.

This is common during block-level verification.

Scott R. Little (Lecture 18: HW Verification) ECE/CS 5780/6780 12 / 42

Page 7: ECE/CS 5780/6780: Embedded System Design

Gray-box Verification

The verifier has access to (and uses) a limited number ofinternal signals during verification.

This is the reality for most verification.

Predicting the correct output value without viewing an internalsignal is often difficult.

Knowing the architecture of the DUT enables you to writebetter tests.

Scott R. Little (Lecture 18: HW Verification) ECE/CS 5780/6780 13 / 42

The Heart of Verification

Does the verification cover all possible inputs?

How can the verifier detect a failure?

Scott R. Little (Lecture 18: HW Verification) ECE/CS 5780/6780 14 / 42

Page 8: ECE/CS 5780/6780: Embedded System Design

Three Commandments of Simulation

Thou shalt stress thine logic harder than it will ever be stressedagain.

Thou shalt place checking upon all things.

Thou shalt not move onto a higher platform until the bug ratehas dropped off.

Scott R. Little (Lecture 18: HW Verification) ECE/CS 5780/6780 15 / 42

Independent Verification is Key

The verification engineer should not participate in the logicdesign of the DUT.

Designers may not think of all failing scenarios.

Verification engineers have a different perspective on the design.

Verification engineers must understand the function, but not theimplementation.

Scott R. Little (Lecture 18: HW Verification) ECE/CS 5780/6780 16 / 42

Page 9: ECE/CS 5780/6780: Embedded System Design

Verification Do’s

Talk to the designer to understand the function of the design.

Think of situations the designer neglected to consider.

Focus on the corner cases or exotic scenarios.

Focus on concurrent events.

Try everything that isn’t explicitly forbidden.

Think about the all the pieces of the design you need to verify.

Talk to designers regarding the interface to your DUT.

Scott R. Little (Lecture 18: HW Verification) ECE/CS 5780/6780 17 / 42

Verification Don’ts

Don’t take the designer’s word for anything.

Don’t weaken your test plan in order to meet a time schedule.

Scott R. Little (Lecture 18: HW Verification) ECE/CS 5780/6780 18 / 42

Page 10: ECE/CS 5780/6780: Embedded System Design

A Typical Verification Flow

Devise a potential bug.

Write a test bench to expose the bug.

Run the simulator with the test bench.

Check the simulation result.

If the test has uncovered a bug:Verify the bug.Work with the designer to fix the bug.

Scott R. Little (Lecture 18: HW Verification) ECE/CS 5780/6780 19 / 42

Automating the Flow

To be practical this flow needs to be automated.

Devising spots for potential bugs is best not automated.

Determining which parts of the design have been explored canbe automated...we will get to that later.

Writing test benches to expose bugs can be automated viaconstrained pseudorandom testing.

Scott R. Little (Lecture 18: HW Verification) ECE/CS 5780/6780 20 / 42

Page 11: ECE/CS 5780/6780: Embedded System Design

Constrained Pseudorandom Testing

Produces test cases that would be difficult to generate by hand.

Facilitates the generation of combinations of concurrent eventsthat would be difficult to explicitly devise.

Often done using a specialized language like Specman’s e.

Good verification engineers are still needed to efficiently drivethe constraints and develop the tests.

How do you check the correctness of an pseudorandom test?Reference models.Assertions.

Scott R. Little (Lecture 18: HW Verification) ECE/CS 5780/6780 21 / 42

Reference Models

An abstraction of the design implementation.

Should be fast, correct, and represent all the design details.

In practice, reference models are fast and correct yet lack detail.

The simulator and the reference model use the same stimulus.

The final result of each is compared.

It can be useful to do intermediate comparisons for long tests.

Scott R. Little (Lecture 18: HW Verification) ECE/CS 5780/6780 22 / 42

Page 12: ECE/CS 5780/6780: Embedded System Design

Assertions

Two types:Built-in checkers.Post-processing checkers.

Built-in checkers are always running during every simulation.

Anyone can add them and everyone reaps the benefits.

Built-in checkers can increase simulation time.

Complex checkers (computationally intensive) can be moved topost-processing checkers and only run on selected tests.

Scott R. Little (Lecture 18: HW Verification) ECE/CS 5780/6780 23 / 42

Coverage Analysis

Constrained pseudorandom tests cover many cases.

Which cases do they cover?

How many more vectors should I run?

Coverage analysis provides metrics to answer these questions.

Scott R. Little (Lecture 18: HW Verification) ECE/CS 5780/6780 24 / 42

Page 13: ECE/CS 5780/6780: Embedded System Design

Coverage Metrics

Serve two main purposes:Act as heuristic measures that quantify verificationcompleteness.Identify inadequately exercised design aspects and guide futureinput stimulus generation.

Scott R. Little (Lecture 18: HW Verification) ECE/CS 5780/6780 25 / 42

Theory vs. Reality

Theory: Increasing the coverage increases confidence in thedesign’s correctness.

Reality: At best, there is an intuitive connection betweencoverage metrics and bugs.

In post-silicon testing, experience has shown that stuck-at faultsare a good proxy for common manufacturing defects.

Design errors are more difficult to characterize.

A formal error model for design bugs hasn’t been found.

Scott R. Little (Lecture 18: HW Verification) ECE/CS 5780/6780 26 / 42

Page 14: ECE/CS 5780/6780: Embedded System Design

Utility

Inputs guided by coverage information commonly detect morebugs than conventional methods.

Coverage metrics provide a better measure of verificationadequacy than bug statistics alone.

Scott R. Little (Lecture 18: HW Verification) ECE/CS 5780/6780 27 / 42

Requirements

Measuring a coverage metric must be efficient.

Generating inputs that improve coverage should not require anunreasonable effort.

Measuring coverage should not require large changes in toolsand methodology.

Scott R. Little (Lecture 18: HW Verification) ECE/CS 5780/6780 28 / 42

Page 15: ECE/CS 5780/6780: Embedded System Design

Code Coverage Metrics

Line: Is every line of code executed?

Branch: Is the positive and negative of every branch taken?

Expression: Are all legal expression values executed?

Path: Are all paths in the CFG executed?

Scott R. Little (Lecture 18: HW Verification) ECE/CS 5780/6780 29 / 42

Code Coverage Example

always @(oneHot or a or b or c)begin case (oneHot)3’b001: z <= a;3’b010: z <= b;3’b100: z <= c;default: z <= 1’bx;

endcaseif (a | b)d = d1 + d2;

elsed = d1 - d2;

endend

Scott R. Little (Lecture 18: HW Verification) ECE/CS 5780/6780 30 / 42

Page 16: ECE/CS 5780/6780: Embedded System Design

Code Coverage Utility

Measurement is low overhead.

Achieving full code coverage for HDLs is a minimumrequirement.

Hardware is highly concurrent.

Code coverage doesn’t address the concurrency aspect.

Scott R. Little (Lecture 18: HW Verification) ECE/CS 5780/6780 31 / 42

Circuit Structure Metrics

Toggle coverage: How many bits toggle (0→1 and 1→0)?

More sophisticated structure metrics involve the division of datapath and control.

Many more sophisticated method are structure specific.

Registers should test initialization, loads, and reads.

Counters should be tested for their min and max values.

Scott R. Little (Lecture 18: HW Verification) ECE/CS 5780/6780 32 / 42

Page 17: ECE/CS 5780/6780: Embedded System Design

FSM Structure Metrics I

FSMs for the design are obtained in two ways:Hand written at a high level of abstraction.Auto-extracted from the design description.

Given an FSM some coverage metrics are:State.Transition.Path.

FSMs for the entire design are prohibitively large, so onlyportions of the design space are covered using FSM metrics.

Scott R. Little (Lecture 18: HW Verification) ECE/CS 5780/6780 33 / 42

FSM Structure Metrics II

Maintaining FSM accuracy during design evolution is difficult.

Writing coverage-directed tests for FSMs is very difficult.

FSM state variable may be deep within the design making itnonobvious how to toggle them.

Scott R. Little (Lecture 18: HW Verification) ECE/CS 5780/6780 34 / 42

Page 18: ECE/CS 5780/6780: Embedded System Design

Functional Coverage I

Typically consist of design-specific classes of errors.Bus protocols → Exercise specific transactions.Pipelines → Check hazard logic.

Monitors are often used to check for specific functional bugs.

Commercial test suites are available for functional verification ofindustry standard protocols.

Scott R. Little (Lecture 18: HW Verification) ECE/CS 5780/6780 35 / 42

Observability

Observed variables: variables used in checking correctness.

Ignoring observability can result in artificially high coverage.

i = j + k;x = c * i;if (a > 0)o = x;elseo = 0;

Scott R. Little (Lecture 18: HW Verification) ECE/CS 5780/6780 36 / 42

Page 19: ECE/CS 5780/6780: Embedded System Design

Formal Methods

Mathematically-based techniques use to prove that the designconforms to a given specification.

Powerful results.

Computationally intensive.

In practice, often not used to prove systems correct but to find”deep” or difficult bugs.

Scott R. Little (Lecture 18: HW Verification) ECE/CS 5780/6780 37 / 42

Model Checking I

Exhaustively explores the state space of the design to prove thatthe system model conforms to the given specification.

State space exploration is an exponential problem.

Many techniques have been developed to help combat the statespace explosion problem.

Bounded model checking.Partial order reduction.Counter-Example Guided Abstraction Refinement (CEGAR).

Scott R. Little (Lecture 18: HW Verification) ECE/CS 5780/6780 38 / 42

Page 20: ECE/CS 5780/6780: Embedded System Design

Model Checking II

Different state space representation methods also attempt tocombat the state space explosion problem.

Explicit state.BDDs.SAT.etc.

Writing a complete and correct specification is key.

Scott R. Little (Lecture 18: HW Verification) ECE/CS 5780/6780 39 / 42

Formal Specification Languages

Historically, have been based on temporal logics (LTL, CTL).

Temporal logics are notoriously difficult to use efficiently.

Industry standard property specification languages have beendeveloped that are easier to use.

PSL/Sugar.SVA.

PSL Examples:assert always CONDITION;assert always a;b |− > c;d;

Scott R. Little (Lecture 18: HW Verification) ECE/CS 5780/6780 40 / 42

Page 21: ECE/CS 5780/6780: Embedded System Design

Equivalence Checking

Proves that two different representations of the circuit haveexactly the same behavior.

Traditionally done between RTL and the netlist.

RTL is considered to be the golden or reference model.

Equivalence checking ensures that the synthesis and other DFMrelated changes don’t introduce any errors to the circuit.

Scott R. Little (Lecture 18: HW Verification) ECE/CS 5780/6780 41 / 42

Automated Theorem Proving

Proving mathematical theories with the help of a computer.

Automated theorem provers are notoriously difficult to use.

Expert users can provide very strong results using these tools.

Results are often at very high levels of abstraction.

Scott R. Little (Lecture 18: HW Verification) ECE/CS 5780/6780 42 / 42


Recommended