IP and SoC Verification 1665907688
IP and SoC Verification 1665907688
IP Verification
Tian-Sheuan Chang
Outline
• Verification challenges
• Verification process
• Verification tools
• RTL logic simulation
IP Verification
• Testbench design
• SOC verification
verification tools
160
IP Verification
140
120
Gates Per Day
100
80
Tian-Sheuan Chang
60
40
20
0
80
82
84
86
88
90
92
94
96
98
19
19
19
19
19
19
19
19
19
19
Year
Yield 23%
Mixed-Signal Interface 21%
IR Drops 20%
Race Condition 17%
Tian-Sheuan Chang
Power 17%
Firmware 13%
Other 4%
Physical Design
6,000
Verification
IP Verification
$4.7M
4,000 Design Planning
Spec
0
Original Re-spin
• Testbench design
• SOC verification
Simulation
Test Bench with Assertion
Checking
Tian-Sheuan Chang
Functional Coverage
Code Coverage
design cycle
– Prototyping
• Real prototype runs real application software
• Method: emulator, FPGA, ASIC test chip
• Bottom up approaches
– Locality
– Easier and faster to catch bugs at the lower level
15 Copyright ©2003 All rights reserved
Types of Verification Tests
• Compliance testing
– For standard based design
• Corner case testing
• Random verification
– Inputs are subjected to valid individual operations
– Prediction of the expected outputs is more complicated
IP Verification
• No input vectors
– Model checking • 100% guarantee
– Semi-/dynamic formal • No simulation required
• Simulation based • Fastest approach
• Check assertions during • Sometimes pessimistic due to
incorrect timing exceptions
simulations
Functional
Specs. …
Tian-Sheuan Chang
Synthesis
Efficient and Effective Verification
RTL or Netlist RTL or Netlist
Equivalence
Checking
19 Copyright ©2003 All rights reserved
Outline
• Verification challenges
• Verification process
• Verification tools
• RTL logic simulation
IP Verification
• Testbench design
• SOC verification
• Emulation
• Prototyping
– FPGA
– ASIC test chip
22 Copyright ©2003 All rights reserved
Inspection as Verification
• Fastest, cheapest and most effective to detect
and remove bugs
• How
– Design (specification, architecture) review
– Code (implementation) review
IP Verification
• Line-by-line fashion
• At the subblock level
• Reviewer should fully understand the implementation
Tian-Sheuan Chang
– Line coverage
– Branch coverage
– Path coverage
Tian-Sheuan Chang
– Expression Coverage
– Toggle Coverage
• Functional coverage
27 Copyright ©2003 All rights reserved
Coverage (1/2)
• Hardware code coverage
– Statement, branch, condition, path, toggle, triggering, FSM
– Recommended 100% statement, branch and condition
– 100% code coverage does not mean 100% functional coverage
– Optimize regression suite runs
• Redundancy removal
IP Verification
• Functional coverage
– A user-defined metric that reflects the degree to which functional
features have been exercised during the verification process.
Simulation engine
Tian-Sheuan Chang
RTL Code
No
Tian-Sheuan Chang
Yes
Propagation
Controllability
IP Verification
Justification X vs.
Enumeration
Observability
Tian-Sheuan Chang
constraints
Assertion-based Verification
Simulation hang 6%
Other 8%
Simulation hang 6%
Other 8%
PC Miscompare 14%
Memory State Miscompare 8%
Manual Inspection 6%
Tian-Sheuan Chang
Self-Checking Test 5%
Cache Coherency Check 3%
SAVES Check 2%
– assert_eventually(...)
IP Verification
P P P P P P P P
• Other
Event 1 Event 2
– assert_one_hot(...)
Tian-Sheuan Chang
– event_monitor(...) P
0 Liveness time
assert_always assert_odd_parity
assert_change assert_one_hot
IP Verification
assert_decrement assert_proposition
assert_delta assert_range
assert_even_parity assert_time
assert_increment assert_transition
Tian-Sheuan Chang
assert_handshake assert_unchange
assert_never assert_win_change
assert_no_overflow assert_win_unchange
assert_no_transition assert_window
assert_no_underflow assert_zero_one_hot
• Approaches
– Library based
• Open verification library. www.verificationlib.org
– Language based
Tian-Sheuan Chang
transition
• IP / Design Reuse
– Assertions validate correct stimulation of IP within
system
Tian-Sheuan Chang
• Travel with IP
• Provide immediate feedback to IP users
• Reduce support calls to IP vendors
• Document behavior and expectations
41 Copyright ©2003 All rights reserved
Benefits of Assertion-Based
Verification
• Reduces debugging time
– Assertions can continuously monitor internal signals in
the design, catching violations early in the design
process
• Documents design
IP Verification
• Testbench design
• SOC verification
• Performance profiling
– To accelerate the simulation
•Log files over networking, large log files
•Bad memory allocated policy
Tian-Sheuan Chang
• Regression
– Efficiency is the king
•Cycle-based, 2-state simulation
• Recreating hardware problems
– Simulation debug & regression
45 Copyright ©2003 All rights reserved
Choosing Simulation Tools
Debugging Regression
Phase Phase
Verilog Std Vendor Cycle-based
Compilation Model Model
Signal Full Limited
IP Verification
Accessibility
Waveform Frequent Seldom
Viewing
Logging Full Limited
Tian-Sheuan Chang
Output
PLI Debug Debug
C/C++ mode ON mode OFF
2-state values
• 2-state simulates faster than 4 state
• Testbench design
• SOC verification
Cutpoints
Tian-Sheuan Chang
// Better Cutpoints
mult_16x15 mult1 (coord_x, coord_y, mult_prod);
assign c_indx = ((mult1_prod & indx_mask) + indx_offset);
IP Verification
// Not so good
case ((a & b | c ^ d) || mem[idx])
4'b0100: c_nxt_st = r_nxt_st << 1;
4'b1000: c_nxt_st = r_nxt_st >> 1;
default: c_nxt_st = r_nxt_st;
endcase;
IP Verification
//Good
c_nxt_st_test = (a & b | c ^ d) || mem[idx];
Tian-Sheuan Chang
case (c_nxt_st_test)
4'b0100: c_nxt_st = r_nxt_st << 1;
4'b1000: c_nxt_st = r_nxt_st >> 1;
default: c_nxt_st = r_nxt_st;
endcase;
• Testbench design
• SOC verification
endcase
default branch!
• Alternate branches never test during startup!
case (d)
2'b00 : e = 2'b01;
2'b0X : e = 2'bX1;
2'b01 : e = 2'b11;
IP Verification
2’bX0 : e = 2’bXX;
2'bX1 : e = 2'bXX;
2'b11 : e = 2'b00;
Tian-Sheuan Chang
2'b1X : e = 2'bX0;
2'b10 : e = 2'b10;
2'bXX : e = 2'bXX;
endcase
begin
case (s)//synopsys full_case
b
2’b11: q = 1'bz;
2’b01: q = a;
Tian-Sheuan Chang
2’b10: q = b; s[0]
endcase
end If s[1] = 0 and s[2] = 0
endmodule we might be SMOKING!
Semantic Mismatch
61 Copyright ©2003 All rights reserved
How Slow Can Your Simulation Go?
hit = pd[cell];
* a*b multiply
/ a/b divide
=== a===b equality (0/1/X/Z)
Tian-Sheuan Chang
Asynchronous Principle
A design project must minimize and isolate resynchronization
Tian-Sheuan Chang
y
wire s, a, b;
wire y, z;
assign y = s ? a : z;
assign z = s ? y : b;
Tian-Sheuan Chang
z endmodule
b
begin
begin b = a; assign c = b;
b = a; c = b; Endmodule
d = c; d = c; //order
end end //independent
Tian-Sheuan Chang
assign c = b; endmodule
endmodule //order dependent Fix 2
Fix 1
• Testbench design
• SOC verification
b = 16’b0000000000000000;
c = 16’b000000000000X000;
a = b + c;
Tian-Sheuan Chang
$display(" a = %b",a);
end
a = 16’bXXXXXXXXXXXXXXXX
default : e = 2’b00;
endcase
$display(" e = %b",e);
end
Tian-Sheuan Chang
• Completeness
• Synthesis
Tian-Sheuan Chang
gate-level simulation.
Tian-Sheuan Chang
else
encoder = indata;
End
reg [‘N-1:0] b;
always @ (a) begin
for (i=0; i<=‘N-1; i=i+1)
b[i] = ~a[i];
GOOD: Parallel
value evaluation
Tian-Sheuan Chang
end
BAD: Better:
For-loop Concatenation
input [15:0] a;
IP Verification
input [15:0] a;
output [15:0] b; output [0:15] b;
integer i; assign b = { a[0], a[1],
reg [15:0] b; a[2], a[3], a[4], a[5],
always @ (a) begin a[6], a[7], a[8], a[9],
Tian-Sheuan Chang
end end
//file b.v //file b.v
always @(posedge ck) always @(posedge ck)
Tian-Sheuan Chang
begin begin
c = b; c <= b;
end end
timing
Tian-Sheuan Chang
Just say no
Tian-Sheuan Chang
• Testbench design
• SOC verification
• Subblock testbench
Output Interface
Input Interface
Tian-Sheuan Chang
Input Output
Transaction Transaction
Generator Checker
Automatic
stimulus response
checking
Referene model
(C/C++,HDL/HVL,
Hardware modeler)
Drivers
HW/SW cosim
Environment
IP Verification
Translator
Tian-Sheuan Chang
Application
PCI Bus
Bus
Monitor
Monitor
– code coverage
– random testing
Tian-Sheuan Chang
• Error transactions
– An error detected during simulation is recorded.
• Concurrency
Tian-Sheuan Chang
customer
– Faster to write, debug, simulate and time-to-market
• Cost
– Require additional resource to write the behavior model
Tian-Sheuan Chang
– Avoid re-invent-the-wheel
– Accelerate the verification
Tian-Sheuan Chang
APB Slave 1
AHB Master AHB Master
Protocol Checker Protocol Checker
AHB Master AHB Master APB Slave
Coverage Mointor Coverage Mointor Coverage Mointor
Bridge
IP Verification
hclk
htrans NSEQ SEQ SEQ SEQ
haddr A A+4 A+8 A+8 AHB Master Protocol Transfer Response Summary
hwrite -------------------------------------
hwdata DA DA+4 DA+4 DA+8
violation: Response Type | Count
hresp OKAY OKAY OKAY OKAY Address was changed -------------------------------------
hready
while in transfer OKAY | 104
ERROR | 0
extension (hready low). RETRY | 5
Ref. Spec. section 3.4 SPLIT | 13
-------------------------------------
110 Copyright ©2003 All rights reserved
Verification Support
• Protocol Checker
– Monitor the transactions on an interface and check for
any invalid operation
• Embedded in the test bench
• Embedded in the design
– Error and/or warning messing of bus protocol
IP Verification
• Regression Management
– Simulation never terminate
– Put a time bomb in all simulations to prevent simulation
Tian-Sheuan Chang
running forever
– Success or failure of each testcase should be checked
after regression test
• Testbench design
• IP Modeling
• SOC verification
114 Copyright ©2003 All rights reserved
The Intent of Different Level of IP Model
• Design exploration at higher level
– Import of top-level constraint and block architecture
– Hierarchical, complete system refinement
– Less time for validating system requirement
– More design space of algorithm and system
architecture
IP Verification
Interface
– Abstract behavioral model out=AxB
M-Bus
IP Verification
CS
W_En
Interface
Interface
Interface
Interface
B B 20
S
out=AxB out=AxB Data_Bus
B B 16
Addr_Bus
Clock
Detailed
Interface Behavioral Structural
Behavioral
Model Model Model
Model
116 Copyright ©2003 All rights reserved
Issues of IP Modeling
• Attributes
– What is the sufficient set of model attributes?
– How are these model attributes validated?
– How is the proper application of an abstract model
specified?
IP Verification
Hierarchy Hierarchy
Refinemenet Validaton
Customer Product
Needs System Vaildation "Pattern" Deliver
System Function System Function
IP Verification
Architecture Architecture
Verification
Behavioral Behavioral
RTL Test
Tian-Sheuan Chang
Patern
Logical Netlist Logical Device
Layout
Wafer
Abstract Mask Real
Fab
F4 F5 F6 F1 F2 F3
F4 F5 F6
F1 F2 F3
In 1 In 2 Out 1
F4 F5 F6
Tian-Sheuan Chang
In 1 In 2 Out 1
Integration Test
Circuit-Level Model
Precision Axis
Temporal Precision Axis
Data Precision Axis
Functional Precision Axis
Structural Precision Axis
Software Programming Precision Axis
121 Copyright ©2003 All rights reserved
CPU Model
• CPU model enable
– Estimate software performance
– Analyze system trade offs
• CPU model
– Bus functional model
IP Verification
I/O Bus
Compile to transactions Bus functional Events Hardware
Application code
host processor model simulator
• Instruction accurate
• Cycle accurate
– Virtual processor model (Cadence VCC technology)
Behavioral/RTL model
Design signoff models
Hardware modeling
Tian-Sheuan Chang
simulator
– CoWare N2C Design
System, Synopsys Eaglei, to
name a few.
(SDF)
IP Verification
– Single model
• Easily verifiable
– Exported State
Tian-Sheuan Chang
– Programmer model
• Nine-value Logic/Full
– Supports checkpointing
129 Copyright
VMC: Verilog Model Compiler, ©2003
VhMC: VHDL All Compiler
Model rights reserved
Behavioral Model for A/MS
• Describes the functionality and performance of a VC block
without providing actual detailed implementation.
• Needed for system designers to determine the possibility
of implementing the system architecture
• It is a kind of abstract behavioral model
IP Verification
Frequency Frequency
Behavioral Model Block Detail Model
130 Copyright ©2003 All rights reserved
Functional/Timing Digital Simulation
Model
• Used to tie in functional verification and timing simulation
with other parts of the system
• Describes the functionality and timing behavior of the
entire A/MS VC between its input and output pins.
• Pin accurate not meant to be synthesizable
IP Verification
VC
Tian-Sheuan Chang
Block
VC Internal VC
Model
Peripheral Peripheral
Interconnection Interconnection
nodes
– Modes of operations
– Environmental conditions such as supply voltage and
external capacitive or resistive loading.
Tian-Sheuan Chang
– Abstract model
• Contains enough information to enable floorplanning, placement, and
routing of the system level chip
– Footprint
– Interface pin/port list, shape(s), and usage
Tian-Sheuan Chang
• Testbench design
• SOC verification
testbenches used
– Quality and performance of the verification tools
– Robustness of the individual predesigned blocks
Tian-Sheuan Chang
Circuit-Level Model
Precision Axis
Temporal Precision Axis
Data Precision Axis
Functional Precision Axis
Structural Precision Axis
Software Programming Precision Axis
139 Copyright ©2003 All rights reserved
SOC Verification
• System
– Validate through
• Prototype, real chip or FPGA
– Methodology
• High level model execution
• Hardware/software co-simulation
IP Verification
Simple
Transaction
Checking
Interface Interface
Bus
Tian-Sheuan Chang
(BFMs)
Memory
Processor Memory
IP Verification
Controller
System Bus
Tian-Sheuan Chang
Peripheral
(RTL)
Tian-Sheuan Chang
147
Application-Based Verification
• Run actual applications on the system (a full
functional model).
– Major Challenge
• RTL Simulation is the bottleneck.
– Two approaches to address this problem
IP Verification
• Different Approaches
– Formal Verification
– Static Timing Analysis
– Some Gate-level Simulation
– Full Scan plus BIST
150 Copyright ©2003 All rights reserved
Rapid Prototyping
• FPGA prototyping
– Aptix (FPGAs + programmable routing chips
• Emulation-based testing
– FPGA-based or processor-based
– QuickTurn and Mentor Graphics
IP Verification
– Emulation Systems
• Non-synthesizable code, especially testbenches, must run the
host machine.
Tian-Sheuan Chang