Professional Documents
Culture Documents
Subhasish Mitra & Ofer Shacham Computer Systems Laboratory Stanford University
subh@stanford.edu shacham@stanford.edu
Copyright 2008 by Subhasish Mitra & Ofer Shacham
SM EE271 1
SM
SM
EE271
SM
EE271
SM
EE271
Typical Issues
In-correct or ambiguous specification Bad algorithm, wrong implementation, logic errors, connectivity mismatch, typos, Logic equivalence to RTL
RTL
Synthesis
Gate Netlist
Place and Route
PNR Netlist
Fabrication
Logic equivalence to gate netlist, setup/hold violations Shorts, breaks, noise, power
Chip
SM
EE271
Typical Issues
In-correct or ambiguous specification Bad algorithm, wrong implementation, logic errors, connectivity mismatch, typos, Logic equivalence to RTL The focus of next lecture The focus of this lecture
RTL
Synthesis
Gate Netlist
Place and Route
PNR Netlist
Fabrication
Logic equivalence to gate netlist, setup/hold violations Shorts, breaks, noise, power
Chip
SM
EE271
Finding a bug should be a cause for celebration. Each discovery is a small victory; each marks an incremental improvement in the design.
D. Clark, Research Technology Management, May 1990.
SM
EE271
Specification Bugs
Chip Design Process Specification
Architecture, micro-arch, design
RTL
Synthesis
Gate Netlist
Place and Route
PNR Netlist
Fabrication
Logic equivalence to gate netlist, setup/hold violations Shorts, breaks, noise, power
Chip
SM
EE271
Transistors
(Hspice)
Gates
(SUE, Structural Verilog)
Verilog VHDL
SM
EE271
10
Logic Bugs
Chip Design Process
Specification
Architecture, micro-arch, design
Typical Issues
In-correct or ambiguous specification
RTL
Synthesis
Gate Netlist
Place and Route
PNR Netlist
Fabrication
Logic equivalence to gate netlist, setup/hold violations Shorts, breaks, noise, power
Chip
SM
EE271
11
Simulation
Apply a LOT of input sequences & compare against expected outputs
Emulation
Map design into FPGAs and plug into actual system setup Much like simulation only 1000x faster
Formal verification
Prove that design really implements the specification
SM
EE271
12
RTL Simulation
SM
EE271
13
Testbench
back d e e F
USB-out
DUT
VGA
SM
EE271
15
USB-out
DUT
VGA
SM
EE271
16
Testbench
Verification is all about the interactions (of state-machines) When tests pass in isolation Stress multiple interfaces concurrently
USB-out
DUT
VGA
EE271
17
Issue: What about important yet improbable scenarios Those are the interesting cases E.g., suppose 100 signals must line up in a particular way? Requires a VERY LONG sequence if at all E.g., exception conditions such as overflow situations
SM
EE271
18
Legacy tests Tests that are known to hit interesting cases / bugs Inputs captured from actual systems
SM EE271 19
Sequence Generator can be decoupled from the testbench On-the-fly: The input is generated as the simulation executes The input at time T2 depends on some previous state at T1
E.g., Processors Memory interface: The input data to the processor depends on the address provided at the previous cycle, and the data saved at the memory some time before
How do we know that we covered all the interesting cases? E.g., we cant ever cover all cases for a 64bit multiplier Well talk more later
SM EE271 21
Typical Input:
Flit 0: Header (packet length and address) Flit 1: Data 1 Flit N-1: Data N-1
SM
EE271
22
SM
EE271
24
Testbench
USB-out
DUT
VGA
EE271
25
Testbench
back d e e F
USB-out
DUT
VGA
EE271
26
USB-out
DUT
VGA
EE271
27
output Monitor
test-gen
SM
28
USB-out
DUT
VGA
29
Simple examples: A FIFO must never raise full and empty at the same cycle In a state machine, if state!=IDLE, then within 10 cycles, state must be IDLE again
SM
EE271
30
Why Assertions?
Assertions concisely describe complicated temporal scenarios Formed as a mathematically phrased sentence (rule or property)
IEEE P1850 Property Specification Language (PSL) standard IEEE P1800 System Verilog Assertion standard
Act as traps for bad or misbehaving scenarios Enables the designer to set verification hedging in places where manual reasoning is difficult
SM
EE271
31
Assertions Structure
General structure: assert (property) [$display ("Pass...");] else $error ("Fail..."); Immediate assertions: Detects a behavior at (every) time instance E.g., Intersection: If GreenLight_EW then !GreenLight_NS Concurrent assertions: Detects a behavior over a period of time Given that sequence1 happened, sequence2 must happen E.g., if (request at this cycle) then (ack in one-three cycles)
SM
EE271
32
State Machine:
Grant=1
Pass
Req=0 Init
Req=1 Req
Grant=0 No Grnt1
Grant=0
Busy=0
SM EE271
Fail
33
Pas s
Busy=0
Fail
|=>
(busy)))
Time of evaluation
SM EE271 35
SM
EE271
36
SM
EE271
37
The simulation engine must generate multiple instances of the state machine The longer the pattern the more concurrent copies Some rules might be a compute burden if not careful!
SM EE271 38
Assertions
Vs.
Scoreboard
Global, end to end checker Complicated to develop Can be as complicated as the DUT it self Takes a lot of time to tune Ref. model essentially this is a program which is as good as the engineer who wrote it Verifies every output (but only as good as the input given)
Local scope Simple to develop Designers can embed with in the verilog/vhdl code Described in a formal or mathematical language Only capture a very small set of scenarios. Most assertions would pass trivially most of the time Stimulating more scenarios leads to better verification
SM
EE271
Garbage In
USB Driver Eth Driver Audio Driver USB-in Eth Audio
Model
Garbage Out
USB-out VGA output Monitor
DUT
VGA
EE271
40
Garbage In
Garbage Out
SM
EE271
41
Coverage
We discussed the need of extensive RTL testing, and even symbolic simulation to improve the number of events we can cover per simulation. But when do we finish?
SM
EE271
42
SM
EE271
44
Types Of Coverage
Toggle coverage Simplest case: Interesting signals must have 0 and 1 Good measure for signal connectivity High toggle coverage doesnt mean good verification quality
E.g., 32bit AND-tree: in=32h0 and in=32ffff_ffff would translate to 100% toggle coverage on all input & output & internal signals
Statement Coverage High statement coverage is a MUST Again, high coverage doesnt mean good verification quality Consider statement: if (x > y) then z = 1 else z = 0;
What if is x bigger then y for all stimuli?
SM
EE271
45
SM
EE271
46
Red_EW Car_NS
Green_ EW
SM
EE271
47
Green_ EW
Red_NS Red_EW
Green_NS Red_EW
EE271
48
Red_EW Car_NS
Green_ EW
Red_NS Red_EW
No_car_EW, All traffic Car_NS will be stuck No_car_EW, No_car_NS Green_NS Green_EW
Green_NS Red_EW
Unsafe!
EE271
49
This seems like a trivial property. Can we mathematically prove/disprove that this assertion never fires and be done with it?
SM
EE271
51
This seems like a trivial In some cases the answer is property. Can we mathematically YES! prove/disprove that this assertion never fires Well see more details in and be done with it? Formal Verification
SM
EE271
52
SM
EE271
53
Some of the content on this topic is based on the following presentation: http://www.aceverification.com/LeadershipSeminar/Hardware%20Accelerators% 20-%20Rotem%20Alvarion.ppt
EE271 54
SM
er t s a F
Emulation Hardware accelerated simulation Simulation Formal methods
Prototyping
Bett er
Formal methods
SM
55
Hardware-Accelerated Simulation
Simulation performance is improved by moving the timeconsuming part of the design to hardware Specialized logic processors with custom instruction sets Design mapped into Programmable logic (e.g., FPGAs)
Hardware Accelerator
Simulation environment
Testbench
Module 0
Module 1
Module 2
DUT
SM
EE271
56
Hardware-Accelerated Simulation
Pros Fast (10x-100x faster then simulation) Cheaper than hardware emulation Debugging is easier as the circuit structure is unchanged Cons Set-up time overhead to map RTL design into the hardware can be substantial SW-HW communication speed can hurt performance Low visibility to signals within the hardware
SM
EE271
57
Emulation
Imitating the function of another system (Simulation = software emulation) Usually, the emulation hardware is an array of FPGAs (or special-type processors) and interconnection scheme The emulation board has external interconnection hardware that resembles the pins of final chip Each logic function is mapped to an emulation native cell (next slide)
SM
EE271
58
FPGA = Field Programmable Gate Array Capable of implementing any function of 6 inputs and numerous combinations of one or two smaller functions
SM EE271 59
Emulation
Pros Fast (~10x-100x faster then acceleration or 1000x then simulation) Enables verification on real target system Cons Setup time overhead to map RTL design into hardware is very high (weeks to set the working environment, hours for every mapping) Visibility to internal signals significantly reduced Many FPGAs high cost Mapping/Capacity issues
SM
EE271
60
Prototyping
Special (more dedicated and customized) hardware architecture made to fit a specific application. Pros Higher (than emulation) clock rate Small form factor (can bring along for a demo in the office ) Cons Huge overhead in developing the prototype Not flexible for design change
SM
EE271
61
Formal Verification
SM
EE271
62
SM
EE271
63
SM
EE271
64
SM
EE271
65
Computation Tree Logic (You wont be asked questions on this in the exam)
B1 Time D2 C2 C3 C4 D4 D4 D3 C4
C D3 D4
SM
EE271
66
Property Examples in CTL (You wont be asked questions on this in the exam)
Property p must hold globally (for all states): Gp (Safety property) e.g, traffic light must not be green on 2 conflicting directions Property p must hold for at least some future state: Fp (Liveness property) e.g., traffic light must become green eventually For all paths starting from now property p is true at some future time: AFp e.g., If state != IDLE, it will eventually go back to IDLE There exists a path for which property p is true at some future time: EFp E.g., if state != IDLE, there is a possible path for which it goes to IDLE
SM
EE271
67
Summary
Thorough Design Verification is a MUST Verification is more than 50% of the chip design efforts Current verification methodology Simulation with property checking for RTL
Major design verification technique If you didnt check it its broken
Backup Slides
SM
EE271
69
CTL Properties
Temporal operators are used to reason about events that take place along some time interval. Properties can have one of two forms The assertion holds in all paths beginning in the current state (Noted as Always) The assertion holds in at least one path beginning in the current state (Noted as Exists) Assertions check for one of four criteria: The assertion holds from now on (Globally) The assertion holds now or will hold in the future (Future) The assertion will hold in the next point of time (neXt) f2 holds now or f1 will hold until (but not necessary including) f2 holds (f1 Until f2)
SM EE271 70
SM
EE271
71