Formal Verification Tutorial Breaking Through the Knowledge Barrier - - PowerPoint PPT Presentation

formal verification tutorial
SMART_READER_LITE
LIVE PREVIEW

Formal Verification Tutorial Breaking Through the Knowledge Barrier - - PowerPoint PPT Presentation

Formal Verification Tutorial Breaking Through the Knowledge Barrier Sean Safarpour - Synopsys, Inc. Iain Singleton - Synopsys, Inc. Shaun Feng - Samsung Austin R&D Center Syed Suhaib - Nvidia Corp. Mandar Munishwar - Qualcomm, Inc.


slide-1
SLIDE 1

Formal Verification Tutorial – Breaking Through the Knowledge Barrier

Sean Safarpour - Synopsys, Inc. Iain Singleton - Synopsys, Inc. Shaun Feng - Samsung Austin R&D Center Syed Suhaib - Nvidia Corp. Mandar Munishwar - Qualcomm, Inc.

slide-2
SLIDE 2

Agenda

  • Introduction

: Sean Safarpour (20 min)

  • Induction & Invariants – Steps to Convergence

: Iain Singleton (45 min)

  • Efficient Formal Modeling Techniques

: Shaun Feng (45 min) Break (10 min)

  • Architectural Formal Verification for Coherency

: Syed Suhaib (45 min)

  • Formal Sign-off

: Mandar Munishwar (45 min)

2

slide-3
SLIDE 3

In Introduction

Sean Safarpour, Synopsys Email: seans@synopsys.com

slide-4
SLIDE 4

Formal Key Enabler for “Shift Left”

Project Time Bugs Found per Week

Find Bugs, Debug and Fix Automate & Customize Verification Reuse & VIP Debug Automation Tapeout Setup Tests Earlier Emulation FPGA Prototyping, Bring-up & SW Debug Faster Simulation

The Verification Questions Remain:

  • How can we reduce our overall verification time?
  • How can we improve efficiency?
  • How can we find the late bugs earlier?
  • How can we prevent bugs slipping into Silicon?

Prevent Bugs Static & Formal

4 Sean Safarpour - Synopsys, Inc.

slide-5
SLIDE 5

How to Improve Verification Confidence

  • Simulation cycles aren’t scaling

– Need to look at each problem differently

  • Let’s break down the verification problem

– Verification plan consists of individual tasks – Some well suited for simulation – Some well suited for emulation – Some well suited for static/formal verification – Use the right task for the right problem

  • Why consider multiple tools in the verification flow?

– Not all problems can be solved by the same approach – Use the right tool for the right problem

  • Find bugs, saves time and $$$

Simulation Emulation Static Formal

5 Sean Safarpour - Synopsys, Inc.

slide-6
SLIDE 6

Complementing Simulation with Formal

  • Formal explores design state space exhaustively
  • Simulation is not exhaustive but explores deep sequential behavior

Cycles Start State State Space

6 Sean Safarpour - Synopsys, Inc.

slide-7
SLIDE 7

Stairway to Formal

  • Formal Applications (Apps) solve specific problems very well
  • Easy to setup & use & debug
  • No need to know or write SVA/assertions,
  • No need for formal background/expertise
  • Users can gradually tackle more advanced formal problems

Sequential Equivalence Checking Property Verification Formal Signoff Connectivity Checking Code Coverage Analysis Automatic Properties

7 Sean Safarpour - Synopsys, Inc.

slide-8
SLIDE 8

Property Verification

  • Formal Property Verification

– Very powerful – Very flexible: can be deployed on many problems – Size limited: block/IP level – Limited to Control Paths – Exponential problem: no conclusive answer

8 Sean Safarpour - Synopsys, Inc.

slide-9
SLIDE 9

Nature of the Problem

  • Formal Verification problem is exponential in nature
  • For hard problems, at some point progress stop

State Space Explored Time Spent

9 Sean Safarpour - Synopsys, Inc.

slide-10
SLIDE 10

Nature of the Problem

  • Plateau graph:

– When looking at a large number of properties over time …progress appears to stops

Stage 1: Significant progress is made quickly Stage 2: the “knee” of the curve progress is slowing down Stage 3: Very few properties can converge with additional time or resources # of properties converged

Time spent

10 Sean Safarpour - Synopsys, Inc.

slide-11
SLIDE 11

Property Verification

  • Formal Property Verification

– Very powerful – Very flexible: can be deployed on many problems – Size limited: block/IP level – Limited to Control Paths – Exponential problem: no conclusive answer

  • But in the hands of an expert…

– Size limit can be worked around – Datapath can be handled – Exponential effects can be managed

11 Sean Safarpour - Synopsys, Inc.

slide-12
SLIDE 12

Nature of the Problem

  • With some “tricks” / know-how we can jump to another curve
  • Might be good enough to solve our problem

State Space Explored Time Spent

12 Sean Safarpour - Synopsys, Inc.

slide-13
SLIDE 13

Nature of the Problem

  • Plateau graph

– More properties will converge for the same amount of time

# of properties converged

Time spent

13 Sean Safarpour - Synopsys, Inc.

slide-14
SLIDE 14

Secrets Disclosed

  • Through Years of experience and countless projects…
  • Formal expert have discovered and mastered techniques to go beyond

limitations

  • Presenters will disclose some of their secrets…

– Abstraction techniques – Symbolic Variables – Invariants and Induction – Architectural level checks – Signing off with formal

14 Sean Safarpour - Synopsys, Inc.

slide-15
SLIDE 15

Q&A

slide-16
SLIDE 16

Agenda

  • Introduction

: Sean Safarpour (20 min)

  • Induction & Invariants – Steps to Convergence

: Iain Singleton (45 min)

  • Efficient Formal Modeling Techniques

: Shaun Feng (45 min) Break (10 min)

  • Architectural Formal Verification for Coherency

: Syed Suhaib (45 min)

  • Formal Sign-off

: Mandar Munishwar (45 min)

16

slide-17
SLIDE 17

Induction & Invariants – Key Steps to Convergence

Iain Singleton - Synopsys, Inc. Email: isingle@synopsys.com

slide-18
SLIDE 18

The Formal Convergence Problem

  • The Satisfiability (SAT) problem:

– Given a Boolean expression is there a set of values which will evaluate the expression to true – For each variable, n, there are 2n possible values which must be tested – This creates an exponential NP-complete problem

18

Depth Time

Iain Singleton - Synopsys, Inc

slide-19
SLIDE 19

End state Initial state

State Space Exploration

19 Iain Singleton - Synopsys, Inc

slide-20
SLIDE 20

Initial state End state

State Space Exploration

20 Iain Singleton - Synopsys, Inc

slide-21
SLIDE 21

Initial state End state

State Space Exploration

21 Iain Singleton - Synopsys, Inc

slide-22
SLIDE 22

Improving Convergence

  • Not all problems are created equal

– Complexity is impacted by a number of factors

  • Overcoming complexity is one of formals biggest challenges

– Abstractions – Property Decomposition – Divide and Conquer – Case Splitting – Invariants – Induction

22 Iain Singleton - Synopsys, Inc

slide-23
SLIDE 23

Invariants

  • What is an invariant?

A function, quantity or property which remains unchanged when a specific transformation is applied

  • All assertions can be invariants
  • Some invariants can improve convergence

23 Iain Singleton - Synopsys, Inc

slide-24
SLIDE 24

A

Asserts on outputs Constraints on inputs

B Top

Assume Guarantee

  • Assume guarantee is used to guarantee constraints by proving them on

the driving logic

  • Used as a complement to divide and conquer methodology
  • …but can also be used without splitting the design

24 Iain Singleton - Synopsys, Inc

slide-25
SLIDE 25

Invariants as Helper Properties

  • Invariant properties can be used as constraints

– Helps restrict state space

  • Safe to assume a proven assertion
  • State space reduction can help improve convergence time

25 Iain Singleton - Synopsys, Inc

slide-26
SLIDE 26

Initial state End state

State Space Exploration

26 Iain Singleton - Synopsys, Inc

slide-27
SLIDE 27

Initial state End state

Invariant proven!

State Space Exploration

27 Iain Singleton - Synopsys, Inc

slide-28
SLIDE 28

Level 0

Invariants as Helper Properties

Level 0 Prove

  • Sometimes an invariant property will be

almost as difficult to prove as the main property

  • It may be necessary to chain invariants

together in a prove-assume-prove flow

  • Prove the easiest properties first, then

slightly harder, then harder etc…

28 Iain Singleton - Synopsys, Inc

slide-29
SLIDE 29

Level 0 Level 1

Invariants as Helper Properties

  • Sometimes an invariant property will be

almost as difficult to prove as the main property

  • It may be necessary to chain invariants

together in a prove-assume-prove flow

  • Prove the easiest properties first, then

slightly harder, then harder etc…

Level 0 Assume Level 1 Prove

29 Iain Singleton - Synopsys, Inc

slide-30
SLIDE 30

Level 0 Level 1

Invariants as Helper Properties

Level 0 Level 1 Assume Assume Target Goal Target Goal Prove

  • Sometimes an invariant property will be

almost as difficult to prove as the main property

  • It may be necessary to chain invariants

together in a prove-assume-prove flow

  • Prove the easiest properties first, then

slightly harder, then harder etc…

30 Iain Singleton - Synopsys, Inc

slide-31
SLIDE 31

Invariants as Helper Properties – Example (DAC 2014)

Target Property: sampled_in && !sampled_out && count==1 && pop |=> data_o == symb_data L2: sampled_in && !sampled_out |=> data[ptr_locn] == symb_data L1: sampled_in && !sampled_out |=> count <= (wptr – rptr) L1: !sampled_in |=> count == (wptr – rptr) L0: sampled_in && sampled_out|=> count == 0 L0: !sampled_in |-> !sampled_out

31 Iain Singleton - Synopsys, Inc

slide-32
SLIDE 32

Invariants as Helper Properties – Example (DAC 2014)

32 Iain Singleton - Synopsys, Inc

slide-33
SLIDE 33

Helper Properties – More than Proofs

33

  • Using invariants as helper properties can help prove difficult properties
  • Helper properties can also exist in the form of covers
  • Deep state space bug hunting utilizes helper covers to guide the search

– Simulate to interesting state in cover and run formal from there

Iain Singleton - Synopsys, Inc

slide-34
SLIDE 34

Deep State Space Bug Hunting

34

Initial state End state

Iain Singleton - Synopsys, Inc

slide-35
SLIDE 35

What Makes a Good Helper Property?

  • Invariants for proofs

– Describing relation between signals in design and formal testbench – Proving simpler properties on the relationship inside COI of target property – Properties related to the main property (for all DAC invariants antecedents were a subset of expression in main property)

  • Covers for bug hunting

– Hit deep extremes in the design (counters full, credit empty etc.) – Cover interesting corner cases (long gaps between input/output toggling etc.)

35 Iain Singleton - Synopsys, Inc

slide-36
SLIDE 36

Induction

  • Induction is another powerful technique which can help with difficult

properties

  • An inductive property says that if something is true now, it must be true

in the future a==b |=> a==b

36 Iain Singleton - Synopsys, Inc

slide-37
SLIDE 37

Induction and Initial State Abstraction

  • Combining induction with initial state abstraction enhances its power

– Antecedent relies on consequent currently being true – Stops many spurious failures

  • Sequential depth problem hugely reduced
  • Counterexamples can be reached very quickly

37 Iain Singleton - Synopsys, Inc

slide-38
SLIDE 38

Induction and Initial State Abstraction

as_state_equal: assert property (design_state == tb_state); Lots of sequential depth to bug

STOP INIT RUN timer = 8192 count = 4096 STOP INIT RUN timer = 8192 count = 4095

Example – Small State Machine

mismatch

38 Iain Singleton - Synopsys, Inc

slide-39
SLIDE 39

STOP INIT RUN timer = 8192 count = 4096 STOP INIT RUN timer = 8192 count = 4095 mismatch

as_ind_state_equal: assert property (design_state == tb_state |=> design_state == tb_state); No reset to design Depth 1 constraints that design and tb counter and timer are equal in initial state Instant 2 cycle CEX

Example – Small State Machine

Induction and Initial State Abstraction

39 Iain Singleton - Synopsys, Inc

slide-40
SLIDE 40

Initial state End state

State Space Exploration

40 Iain Singleton - Synopsys, Inc

slide-41
SLIDE 41

Induction and Invariants – Combining the Power

  • Finding invariants that will help with convergence is a challenge
  • Inductive invariants can be very powerful tools for improving

convergence

  • Tool capabilities can be used to help with this

– Find a CEX from a non-reset state – Construct an inductive invariant property to prove this CEX cannot happen – Add this CEX as helper property and step forward for new CEX

41 Iain Singleton - Synopsys, Inc

slide-42
SLIDE 42

Summary

  • Formal is being used on bigger and more complex designs
  • For successful formal application on such designs advanced

techniques are required

  • Induction and invariants are two powerful formal techniques which can

enhance convergence

  • Finding helpful invariants can be challenging
  • Advanced tool features can be used to help develop inductive

invariants from non-reset design states

  • When all else fails – deep state space bug hunting can find difficult

corner cases using formal

42 Iain Singleton - Synopsys, Inc

slide-43
SLIDE 43

Q&A

slide-44
SLIDE 44

Agenda

  • Introduction

: Sean Safarpour (20 min)

  • Induction & Invariants – Steps to Convergence

: Iain Singleton (45 min)

  • Efficient Formal Modeling Techniques

: Shaun Feng (45 min) Break (10 min)

  • Architectural Formal Verification for Coherency

: Syed Suhaib (45 min)

  • Formal Sign-off

: Mandar Munishwar (45 min)

44

slide-45
SLIDE 45

Efficient Formal Modeling Techniques

Xiushan “Shaun” Feng Samsung Austin R&D Center Email: s.feng@samsung.com

slide-46
SLIDE 46

Agenda

  • Formal verification basics
  • Abstractions
  • Symbolic constants with examples
  • Conclusion

46 Shaun Feng - Samsung

slide-47
SLIDE 47

Formal Verification Basics

Yes RTL TL Mod Model For

  • rmal Verification Too
  • ol

As Assertions + + Mod Modeling

Pas ass

No Debug

47 Shaun Feng - Samsung

slide-48
SLIDE 48

Formal Modeling Goals

  • Goals:

– Reduce state space – abstraction – Cut down the number of assertions – Allow formal to quickly find bugs if there is any

  • Approaches:

– Cutpoints/blackboxes/shrinking – Assume-guarantee (or divide-conquer) – Symbolic constants – etc.

48 Shaun Feng - Samsung

slide-49
SLIDE 49

Agenda

  • Formal verification basics
  • Abstractions
  • Symbolic constants with examples
  • Conclusion

49 Shaun Feng - Samsung

slide-50
SLIDE 50

Cutpoints and Blackboxes

  • Can apply to

– Counters – RAMs/ROMs – Large arrays – Math functions – Unnecessary logic

  • Conservative

– No false proven – Deep proof bounds

  • Side effect

– False failings – May need constraints

Cutpoint Applied

… X …

RTL Model

Blackbox Applied

… … …

RTL Model … … 50 Shaun Feng - Samsung

slide-51
SLIDE 51

Shrunk Design

  • Address space

– Cache coherence needs only one address

  • Data size

– 1 bit may be enough for data integrity check

module FOO #(parameter bit_iwdth = 10) (

  • utput reg[bit_width-1:0] AllocPrt,
  • utput reg[127:0] DeAllocData,

input Alloc, input [127:0] Data, input DeAlloc, input DeAllocPtr, … ) local param addr_size = 2^bit_width reg [127:0] MEM[addr_size]; … assign DeAllocData = MEM[DeAllocPtr]; …. endmodule module FOO #(parameter bit_width = 1) (

  • utput reg[bit_width-1:0] AllocPrt,
  • utput reg[127:0] DeAllocData,

input Alloc, input [127:0] Data, input DeAlloc, input DeAllocPtr, … ) local param addr_size = 2^bit_width reg MEM[addr_size]; … assign DeAllocData = {127{1’b0},MEM[DeAllocPtr]; …. endmodule

  • FIFO

– Depth of FIFO can be reduced – IO flopped delay can be removed

  • Other symmetric structures

51 Shaun Feng - Samsung

slide-52
SLIDE 52

Assertion/Design Partition

  • Assertion partition

– Grouping assertions with same COI – Using proven assertions as assumptions

  • Design partition

– Using assertion groups to partition design – One formal test for each partition

RTL Model

Assertions

Partition

Assertions

Logic cone 1 Logic cone 2 RTL Model 1

Assertions

Logic cone 1 RTL Model 2

Assertions

Logic cone 2 52 Shaun Feng - Samsung

slide-53
SLIDE 53

Preloading

  • Instead of starting formal at initial state, we can start at a valid pre-

defined state

– Configuration registers – Counters – FSM – Cache/memory – A witness trace of a cover property

53 Shaun Feng - Samsung

slide-54
SLIDE 54

Preloading MESI State

CPU 1 MEMORY S CPU 2 I

X

CPU 3 S

state address value address value

wr add0 1

54 Shaun Feng - Samsung

slide-55
SLIDE 55

Counter Abstraction

  • Not all values of a counter are valid.

– 32bit counter has 2^32 possible values – Abstract away the counter and assume possible values.

  • Initial values of counters

– Usually, counters are initialized to predefined values (e.g, 0) – Counter-example can happen with a large counter value – a long trace to hit – Counter initial value abstraction helps to shorten the trace

55 Shaun Feng - Samsung

slide-56
SLIDE 56

Counter Abstraction Example

reg [bit_width-1:0] counter; always_ff @(posedge clock) begin if (reset) `ifdef FORMAL_ON `else counter <= ‘b0; `endif else if (…) counter <= counter + 1’b1; end Initial Value Abstraction TCL control file: cutpoint DUT.counter assume {condition |-> DUT.counter inside {0, 1, 2, 4}} Counter Value Abstraction

56 Shaun Feng - Samsung

slide-57
SLIDE 57

Assume-Guarantee

  • General approach:

– Break down a big problem into a few sub-problems – Assume sub-problems – Prove big problem with added assumptions – Prove sub-problems

  • Techniques can be used:

– Design partition – Blackboxes – Cutpoints – Assertion re-writing

57 Shaun Feng - Samsung

slide-58
SLIDE 58

Over Constraints Used as Abstraction

  • Over constraints are not always bad

– Smaller state space – Finer-grain control of inputs

  • formal test bench can have both over and under constraints

valid design space formal space 2^n exponential state space

58 Shaun Feng - Samsung

slide-59
SLIDE 59

Agenda

  • Formal verification basics
  • Abstractions
  • Symbolic constants
  • Conclusion

59 Shaun Feng - Samsung

slide-60
SLIDE 60

Symbolic Constants

  • A random value after reset
  • Will hold its value throughout the whole formal proof

Time 0

(@ posedge clk) ##1 $stable(SymC[31:0])

clk Sym Constant A random number [0..2^32) … …

60 Shaun Feng - Samsung

slide-61
SLIDE 61

Symbolic Constant Examples

  • Priority Arbiter
  • Round Robin Arbiter
  • In order transport example

61 Shaun Feng - Samsung

slide-62
SLIDE 62

Priority Arbiter

Priority Arbiter

Req[0] Req[1] Gnt[0] Gnt[1] Req[N-1] Gnt[N]

. . . .

High Low // if m<n, Req[m] has higher prority than Req[n] // if there is a Req[m], Req[n] cannot be granted // without grant m first

property priority_pair (m,n); @(posedge clk) disable iff (~reset_n) not ( ((m < n) && req[m] & !gnt[m]) throughout (gnt[n])[->1])); endproperty generate for (genvar m = 0; m<=N; m++) begin for (genvar n = 0; n<=N; n++) begin assert property (priority_pair(m,n)); end end endgenerate

62 Shaun Feng - Samsung

slide-63
SLIDE 63

Use Symbolic Constants

  • M, N are random values at reset, but will hold the values after reset.

localparam WIDTH = $clog2(N); logic [WIDTH-1:0] m, n; ASM_SYM_CONST_m_n: assume property (@(posedge n_clock) disable iff (!n_resetb) ##1 $stable(m) && $stable(n) && m < N && n < N); AST_PRI_ARB: assert property (@(posedge n_clock) disable iff (!n_resetb) not (strong(((m < n) && req[m] & !gnt[m]) throughout (gnt[n])[- >1]))); );

63 Shaun Feng - Samsung

slide-64
SLIDE 64

Round Robin Arbiter

  • Strong fairness
  • Severed request gets the lowest priority
  • Rotated priority

N-1 … …

Round Robin Arbiter

  • Fairness
  • One hotness
  • Round robin (rotated priority)

requests grant Assertion Checks

64 Shaun Feng - Samsung

slide-65
SLIDE 65

Cases

65

Case 1 N-1

10….

Y X Y > X, i (X, Y), req[i] ==0 Req X is just served, expect to serve Y later Case 2 N-1

00000000……………………………………………...000000

X Y X > Y, Y==0, i (X, N-1], req[i] ==0 Case 3 N-1

10……..............0

X Y X > Y, X==N-1, i [0, Y), req[i] ==0 Case 4 N-1

10…..…….......0

X Y N>X > Y>0, i (X, N-1] [0, Y), req[i] ==0

0………........0

1 Shaun Feng - Samsung

slide-66
SLIDE 66

localparam WIDTH = $clog2(N); logic [WIDTH-1:0] X, Y; ASM_SYM_CONST_X_Y: assume property (@(posedge n_clock) disable iff (!n_resetb) ##1 $stable(X) && $stable(Y) && X < N && Y < N); generate for (genvar i = 0; i < N; i++) begin : location_asm ASM_CASE1: assume property (@(posedge n_clock) disable iff (!n_resetb) Y > X && Y>i && i>X |-> Req[i]==0); ASM_CASE2: assume property (@(posedge n_clock) disable iff (!n_resetb) X > Y && Y ==0 && i > X |-> Req[i]==0); ASM_CASE3: assume property (@(posedge n_clock) disable iff (!n_resetb) X > Y && X==N-1 && i < Y |-> Req[i]==0); ASM_CASE4: assume property (@(posedge n_clock) disable iff (!n_resetb) X > Y && (i > X | i < Y) |-> Req[i]==0); end endgenerate AST_RR_ARB: assert property (@(posedge n_clock) disable iff (!n_resetb) ##1 $past(Req[X] && Gnt[X]) && Req[Y] && Y !=X |-> $onehot(Gnt) && Gnt[Y] ); AST_RR_ONEHOT: assert property (@(posedge n_clock) disable iff (!n_resetb) $onehot0(Req) |-> Gnt == Req ); AST_RR_FAIR: assert property (@(posedge n_clock) disable iff (!n_resetb) not((Req[X] &&~Gnt[X])[*N]) );

Assertions

66 Shaun Feng - Samsung

slide-67
SLIDE 67

Zoom in Fairness Assertion

  • What happened if N is very big.

AST_RR_FAIR: assert property (@(posedge n_clock) disable iff (!n_resetb) not((Req[X]&& ~Gnt[X])[*N])); AST_RR_FAIR: assert property (@(posedge n_clock) disable iff (!n_resetb) X!=Y |-> not(Req[X] throughout Gnt[Y][->2]) );

67 Shaun Feng - Samsung

slide-68
SLIDE 68

In Order Transport

  • Data comes out in order
  • No drop of data
  • No spurious data comes out
  • No duplication of data

DUT

… B A !B A Inputs Bad outputs B !A C A A

68 Shaun Feng - Samsung

slide-69
SLIDE 69

Modeling

  • A standard FIFO is used

– With full/empty state

  • Input/output FSMs
  • 3-state FSM

– SA: seen A – SAB: seen A, B – INIT: initial state

INIT SA SAB A B A/push SA A/push SAB !A/push SAB !A&!B/push SA Input monitor state machine assume property (##1 $stable(A) && $stable(B) && A!= B);

69 Shaun Feng - Samsung

slide-70
SLIDE 70

Modeling – Cont.

INIT SA SAB A B A/pop A/pop !A/pop !A&!B/pop Output monitor state machine

ASM_EOC_COND: assume property ( fifo.full || rand_stop |-> in != A && in!= B && in_vld && completed ); ASM_EOC: assume property ( completed |=> completed && !in_vld );

Flow control

70 Shaun Feng - Samsung

slide-71
SLIDE 71

Implementation

DUT

INIT

SA SAB

A B

INIT

SA SAB

A B

FIFO push pop

pop |-> fifo.out == output_monitor.state

Input monitor Output monitor Checker:

71 Shaun Feng - Samsung

slide-72
SLIDE 72

Symbolic Constant in Simulation

  • Symbolic constants can not be used directly for simulation.

– $stable()can be replaced by a random number.

localparam WIDTH = $clog2(N); logic [WIDTH-1:0] m; `ifdef FORMAL ASM_SYM_CONST_m: assume property (@(posedge n_clock) disable iff (!n_resetb) ##1 $stable(m) && m< N ); `else initial begin assert(std::randomize(m)); end `endif AST_PRI_ARB: assert property (@(posedge n_clock) disable iff (!n_resetb) not ((req[m] & !gnt[m])[*N]) );

72 Shaun Feng - Samsung

slide-73
SLIDE 73

Conclusion

  • Efficient formal verification modeling techniques are crucial to formal

verification

– Simplify formal modeling code – Improve runtime

  • Abstraction is the key

– Abstractions with cost (false counter examples) – Understand designs and find the right balance

73 Shaun Feng - Samsung

slide-74
SLIDE 74

Q&A

slide-75
SLIDE 75

Agenda

  • Introduction

: Sean Safarpour (20 min)

  • Induction & Invariants – Steps to Convergence

: Iain Singleton (45 min)

  • Efficient Formal Modeling Techniques

: Shaun Feng (45 min) Break (10 min)

  • Architectural Formal Verification for Coherency

: Syed Suhaib (45 min)

  • Formal Sign-off

: Mandar Munishwar (45 min)

75

slide-76
SLIDE 76

Architectural Formal Verification of Coherency Manager

Syed Suhaib - Nvidia Corp. Email: ssuhaib@nvidia.com

slide-77
SLIDE 77

Agenda

  • Coherency Manager
  • Verification Methodology
  • Coherency Manager’s Architectural Model
  • Results

Syed Suhaib - Nvidia

slide-78
SLIDE 78

Coherency Manager

Cluster1 Cluster2 Coherency Manager (CM) Main Memory DMA Agents

Cache Cache

Coherency Manager (CM)

Agent2 Agent1

Fill Read Snoop WrAck SnpRsp/ WriteBack

Syed Suhaib - Nvidia

slide-79
SLIDE 79

Verification Challenges

Syed Suhaib - Nvidia 79

Cluster1 Cluster2 Coherency Manager (CM) Main Memory DMA Agents

Cache Cache

  • High Complexity
  • Large DUT
  • Traditional Simulation Doesn’t Work Well!

– Slow – Coverage Challenges – Stub models for multiple Clusters

  • Tricky
slide-80
SLIDE 80

Verification Challenges

  • Formal Verification (FV)

– Impractical to apply FV on entire system

  • State space

– May create a custom setup

  • Black-box sub-units and add assumptions
  • Onion-peeling effort

– Getting rid of non-relevant micro-arch details

Syed Suhaib - Nvidia

Cluster1 Cluster2 Coherency Manager (CM) Main Memory DMA Agents

Cache Cache

slide-81
SLIDE 81

Steps of Architectural Verification

  • 1. Code Architectural models of Coherency Manager components affecting

coherency

  • 2. Prove Coherence on interconnection of Architectural models (FPV)
  • 3. Prove Architectural models against Coherency Manager RTL subunits (FPV)

Relevant to Coherency Irrelevant to Coherency Relevant to Coherency Irrelevant to Coherency

Arch Model No Model Arch Model No Model Prove Coherence CM RTL CM Arch Model Prove Arch Model Prove Arch Model

Syed Suhaib - Nvidia

slide-82
SLIDE 82

Coherency Manager Block Diagram

Interface Model

DMA Agents

Cluster1 I/F (C1I) Cluster2 I/F (C2I) DMA I/F Client Interconnect (CIC) Coherency Engine (CE) Memory Interconnect (MIC) Bridge1 Bridge2

MC SYSRAM IO Fabric

Architectural Model No Model

Cluster1 Cluster2

Syed Suhaib - Nvidia Coherency Model

slide-83
SLIDE 83

Cluster1 vs. Cluster2 Interface Model

Syed Suhaib - Nvidia

Cluster1 Cluster2 Interface ACE Proprietary Coherency Protocol MOESI MESI Cache-line Model Oski ACE VIP Coded in- house

M O E S I

Valid Invalid Unique Shared Dirty Clean Cluster1

CM

AR R AW W B AC CR CD

Cluster2

CM

reqrsp data reqrsp data wrack

slide-84
SLIDE 84

Cluster1 Interface (C1I) Model

Syed Suhaib - Nvidia 84

DMA Agents

Cluster2 I/F (C2I) DMA I/F Client Interconnect (CIC) Coherency Engine (CE) Memory Interconnect (MIC)

Cluster1 Cluster2

Coherency Model

Cluster1 I/F (C1I)

slide-85
SLIDE 85
  • Tracks progress of requests for a particular

cache-line

  • Read Tracker
  • Write Tracker
  • Snoop Tracker
  • Trackers can be replicated for multiple cache-

lines

Syed Suhaib - Nvidia

Cluster1 Interface (C1I) Model

XBAR->C1I

Clus luste ter1 I/F /F (C1I) Clien lient t Interconnect t (CIC)

C1I->Cluster1 Cluster1>C1I

Clus luste ter1

C1I->CIC

Cohe

  • herency

En Engin gine e (CE)

CE->CIC CIC->CE CIC->C1I

slide-86
SLIDE 86

Snoop Tracker

Syed Suhaib - Nvidia 86

XBAR->C1I

Clus luste ter1 I/F /F (C1I) Clien lient t Interconnect t (CIC)

C1I->Cluster1 Cluster1>C1I

Clus luste ter1

C1I->CIC

Cohe

  • herency

En Engin gine e (CE)

CE->CIC CIC->CE CIC->C1I

WAIT_FOR_ CIC_REQ

CIC->C1I

Reset

slide-87
SLIDE 87

Snoop Tracker

Syed Suhaib - Nvidia 87

XBAR->C1I

Clus luste ter1 I/F /F (C1I) Clien lient t Interconnect t (CIC)

C1I->Cluster1 Cluster1>C1I

Clus luste ter1

C1I->CIC

Cohe

  • herency

En Engin gine e (CE)

CE->CIC CIC->CE CIC->C1I

WAIT_FOR_ CIC_REQ WAIT_FOR_ C1I_REQ

MY CIC SNP REQ, No FillOwn Pending

CIC->C1I C1I->Cluster1

Reset

slide-88
SLIDE 88

Snoop Tracker

Syed Suhaib - Nvidia 88

XBAR->C1I

Clus luste ter1 I/F /F (C1I) Clien lient t Interconnect t (CIC)

C1I->Cluster1 Cluster1>C1I

Clus luste ter1

C1I->CIC

Cohe

  • herency

En Engin gine e (CE)

CE->CIC CIC->CE CIC->C1I

WAIT_FOR_ CIC_REQ BLOCK_SNP_ TO_C1I WAIT_FOR_ C1I_REQ

MY CIC SNP REQ, No FillOwn Pending MY CIC SNP REQ, but Old FillOwn pending

CIC->C1I C1I->Cluster1

Reset

slide-89
SLIDE 89

Snoop Tracker

Syed Suhaib - Nvidia 89

XBAR->C1I

Clus luste ter1 I/F /F (C1I) Clien lient t Interconnect t (CIC)

C1I->Cluster1 Cluster1>C1I

Clus luste ter1

C1I->CIC

Cohe

  • herency

En Engin gine e (CE)

CE->CIC CIC->CE CIC->C1I

WAIT_FOR_ CIC_REQ BLOCK_SNP_ TO_C1I WAIT_FOR_ C1I_REQ

FillOwn Complete MY CIC SNP REQ, No FillOwn Pending MY CIC SNP REQ, but Old FillOwn pending

CIC->C1I C1I->Cluster1

Reset

slide-90
SLIDE 90

Snoop Tracker

Syed Suhaib - Nvidia 90

XBAR->C1I

Clus luste ter1 I/F /F (C1I) Clien lient t Interconnect t (CIC)

C1I->Cluster1 Cluster1>C1I

Clus luste ter1

C1I->CIC

Cohe

  • herency

En Engin gine e (CE)

CE->CIC CIC->CE CIC->C1I

WAIT_FOR_ CIC_REQ BLOCK_SNP_ TO_C1I WAIT_FOR_ C1I_REQ

FillOwn Complete

WAIT_FOR_ C1I_RSP

MY CIC SNP REQ, No FillOwn Pending My Snoop Req sent? MY CIC SNP REQ, but Old FillOwn pending

CIC->C1I C1I->Cluster1 Cluster1->C1I

Reset

slide-91
SLIDE 91

Snoop Tracker

Syed Suhaib - Nvidia 91

XBAR->C1I

Clus luste ter1 I/F /F (C1I) Clien lient t Interconnect t (CIC)

C1I->Cluster1 Cluster1>C1I

Clus luste ter1

C1I->CIC

Cohe

  • herency

En Engin gine e (CE)

CE->CIC CIC->CE CIC->C1I

WAIT_FOR_ CIC_REQ BLOCK_SNP_ TO_C1I WAIT_FOR_ C1I_REQ

FillOwn Complete

WAIT_FOR_ C1I_RSP WAIT_FOR_ CIC_RSP

My Snoop Rsp rcvd? MY CIC SNP REQ, No FillOwn Pending My Snoop Req sent? MY CIC SNP REQ, but Old FillOwn pending

CIC->C1I C1I->Cluster1 Cluster1->C1I C1I->CIC

Reset

slide-92
SLIDE 92

Snoop Tracker

Syed Suhaib - Nvidia 92

XBAR->C1I

Clus luste ter1 I/F /F (C1I) Clien lient t Interconnect t (CIC)

C1I->Cluster1 Cluster1>C1I

Clus luste ter1

C1I->CIC

Cohe

  • herency

En Engin gine e (CE)

CE->CIC CIC->CE CIC->C1I

WAIT_FOR_ CIC_REQ BLOCK_SNP_ TO_C1I WAIT_FOR_ C1I_REQ

FillOwn Complete

WAIT_FOR_ C1I_RSP WAIT_FOR_ CIC_RSP

My Snoop Rsp rcvd? MY CIC SNP REQ, No FillOwn Pending My Snoop Req sent? MY CIC SNP REQ, but Old FillOwn pending MY CIC SNP RSP

CIC->C1I C1I->Cluster1 Cluster1->C1I C1I->CIC

Reset

slide-93
SLIDE 93

Snoop Tracker

Syed Suhaib - Nvidia 93

XBAR->C1I

Clus luste ter1 I/F /F (C1I) Clien lient t Interconnect t (CIC)

C1I->Cluster1 Cluster1>C1I

Clus luste ter1

C1I->CIC

Cohe

  • herency

En Engin gine e (CE)

CE->CIC CIC->CE CIC->C1I

WAIT_FOR_ CIC_REQ BLOCK_SNP_ TO_C1I WAIT_FOR_ C1I_REQ

FillOwn Complete

WAIT_FOR_ C1I_RSP WAIT_FOR_ CIC_RSP

My Snoop Rsp rcvd? MY CIC SNP REQ, No FillOwn Pending My Snoop Req sent? MY CIC SNP REQ, but Old FillOwn pending MY CIC SNP RSP

CIC->C1I C1I->Cluster1 Cluster1->C1I C1I->CIC

Reset

➢ Properties: ➢ Final Snoop response must be as per original snoop request. ➢ Snoop should push Fillown.

slide-94
SLIDE 94

Read Tracker

Syed Suhaib - Nvidia 94

XBAR->C1I

Clus luste ter1 I/F /F (C1I) Clien lient t Interconnect t (CIC)

C1I->Cluster1 Cluster1>C1I

Clus luste ter1

C1I->CIC

Cohe

  • herency

En Engin gine e (CE)

CE->CIC CIC->CE CIC->C1I

➢ Properties: ➢ Read Request Consistency ➢ Read Re-order buffer entry reuse ➢ FIFO ordering rules on RRESP (on per ARID basis) ➢ SoDev Ordering properties

WAIT_FOR_ ACE_REQ WAIT_FOR_ CIC_REQ WAIT_FOR_ CIC_RSP WAIT_FOR_ ACE_RSP WAIT_FOR_ ACE_ACK

MY FillOwn RSP MY ACE RACK MY ACE RRSP with RLAST MY ACE RD REQ MY CIC RD REQ

slide-95
SLIDE 95

C1I Properties

  • Only 1 outstanding coherent request allowed for a

cache-line

  • If cache-line is not Unique, there should not be a dirty

write back

Syed Suhaib - Nvidia

XBAR->C1I

Clus luste ter1 I/F /F (C1I 1I) Clien lient t Interconnect t (CIC)

C1I->Cluster1 Cluster1>C1I

Clus luste ter1

C1I->CIC

Cohe

  • herency

En Engin gine e (CE)

CE->CIC CIC->CE CIC->C1I

slide-96
SLIDE 96

Coherency Engine Architectural Model

  • Snoop Filter
  • Generates Proper FillOwn/WriteAck for each

Read/Write request

  • Models Full-Address Chain & Hazards
  • Doesn’t Model: Data Values

Syed Suhaib - Nvidia

Cl Clie ient Interco connect ct (CIC CIC) Co Coherency Eng Engine (CE CE) Me Memory Int nterco connect (MI MIC) Clu Cluster1 Clu Cluster2 DMA

slide-97
SLIDE 97

Components of CE Architectural Model

  • 1. Read Request FIFO

– Serialize read requests. – CE processes 1 read / address at a time.

  • 2. Top-Of-FIFO State Machine

– Models actions executed by CE to process a single read request / cacheline.

  • 3. Snoop State Machine

– Track outstanding snoops for tracked cacheline address.

  • 4. Write Tracker: Tracks outstanding writebacks from agents.

Syed Suhaib - Nvidia

slide-98
SLIDE 98

Top-of-FIFO State Machine

Syed Suhaib - Nvidia

IDLE

Tracked Req

WAIT_ SNOOPS

Snoop Needed Read Needed, but older dirty WB waiting for MIC ack Read needed && No Write Ack pending from MIC

WAIT_ WR_ACK ISSUE_RD WAIT_ENTRY_ DEALLOC

Got MIC Ack Snoops done Snoop returned dirty data Read Needed Read Not Needed

  • riginally, or now

Read Still Needed Read Issued Else Done with Req

slide-99
SLIDE 99

CM Architectural Model

Syed Suhaib - Nvidia

Cluster1 Cluster2 Cluster1 I/F (C1I) Cluster2 I/F (C2I)

Client Interconnect (CIC)

Coherency Engine (CE)

AR/R AW/B AC/CR

reqrsp reqrsp wrack reqrsp reqrsp wrack reqrsp reqrsp wrack req rsp snoop rdrsp wrack

Memory Interconnect (MIC)

rdreq/wrreq rddata/wrrsp

Interface Model Architectural Model DMA I/F

snpreq snprsp

DMA Agents

ACE

  • wnreq
  • wngnt
slide-100
SLIDE 100

Results

  • Coherency Verification

$onehot0({ (cl_state_cluster1==Unique), (cl_state_cluster2==Unique), (cl_state_dma==Unique) })

  • Protocol Compliance

Syed Suhaib - Nvidia

slide-101
SLIDE 101

Bugs

  • C1I re-orders Read requests with same AXI-ID from cluster1 to

coherency engine (CE).

  • C1I sends IsShared=1 for Failed STREX

Syed Suhaib - Nvidia

Cluster1 I/F (C1I) Coherency Engine (CE)

#2,#1 #1,#2 #2 #2 #1

Deadlock

#3

Cluster2 I/F (C2I)

#3 #3

Cluster1 Cluster2

#Snp_2

#1 #3 #2

slide-102
SLIDE 102

Key Takeaways

  • Architectural Formal Verification:

– System level checking. – FV Applied at various abstraction levels.

  • Reduce Complexity

– Prove local properties against RTL – Example use cases

  • Cache Coherency
  • Forward progression of retiring instructions

2/21/2018 Syed Suhaib - Nvidia 102

slide-103
SLIDE 103

Acronyms

  • CM: Coherency Manager
  • AFV: Architectural Formal Verification
  • C1I: Cluster1 Interface
  • C2I: Cluster2 Interface
  • DMA I/F: DMA Interface
  • CIC: Client Interconnect
  • MIC: Memory Interconnect
  • CE: Coherency Engine

103 Syed Suhaib - Nvidia

slide-104
SLIDE 104

Q&A

slide-105
SLIDE 105

Agenda

  • Introduction

: Sean Safarpour (20 min)

  • Induction & Invariants – Steps to Convergence

: Iain Singleton (45 min)

  • Efficient Formal Modeling Techniques

: Shaun Feng (45 min) Break (10 min)

  • Architectural Formal Verification for Coherency

: Syed Suhaib (45 min)

  • Formal Sign-off

: Mandar Munishwar (45 min)

105

slide-106
SLIDE 106

Formal Sign-Off

What And How?

Mandar Munishwar

  • Sr. Staff Engineer, Qualcomm

Email: mmunishw@qti.qualcomm.com

slide-107
SLIDE 107

Outline

  • Introduction
  • What is Formal Sign-off
  • Steps for Formal Sign-off

– Plan – Execute – Measure

  • Conclusion

107 Mandar Munishwar - Qualcomm

slide-108
SLIDE 108

Silicon Bugs …

OCT 1994 APR 2017

JAN 2018 Why these escaped verification ? Traditional Verification dependent on vectors/stimulus

108 Mandar Munishwar - Qualcomm

slide-109
SLIDE 109

Impact of Silicon Bugs

1994

2018

109 Mandar Munishwar - Qualcomm

slide-110
SLIDE 110

What is Formal Sign-Off

  • Can my formal setup catch all the design bugs?

110 Mandar Munishwar - Qualcomm

slide-111
SLIDE 111

What is Formal Sign-Off

  • Have I written all the checks
  • What is quality of checks?
  • Is there any Over constraints?

111 Mandar Munishwar - Qualcomm

slide-112
SLIDE 112

Front-loading vs. Back-loading

Formal Verification Process

  • Identify design blocks
  • Functionality to be verified
  • 7 step Process

PLAN

  • Write checkers/covers
  • Debug CEX
  • Write Constraints
  • Run with updated RTL

EXECUTE

  • Have I written enough

checkers?

  • What is the quality of my

checker

  • Are my bounds enough deep?
  • Is my setup over constrained?

MEASURE

Mandar Munishwar - Qualcomm

slide-113
SLIDE 113

PLAN

  • 1. Identify blocks suitable for Formal Sign-off
  • 2. Capture Functional behavior
  • 3. Define Formal Specification Interface
  • 4. Create Requirements Checklist in Natural Language
  • 5. Formalize Natural Language Requirements Checklist

113 Mandar Munishwar - Qualcomm

slide-114
SLIDE 114

Capture Functional Behavior (step 2)

  • Shape of the signal
  • Interface relationship
  • Causality
  • Forward Progress
  • Signal Integrity (transport)

114 Mandar Munishwar - Qualcomm

slide-115
SLIDE 115

Example of Formal Specification Interface (step 3)

115 Mandar Munishwar - Qualcomm

slide-116
SLIDE 116

Example of step 4, 5

Interface Name Outputs Desc SVA STATUS Note SCHD2BMMU bmmu_gnt signal is a pulse bmmu2schd_bmmu_gnt_is_pulse_a bmmu2schd_bmmu_no_gnt_if_no_req_a for each req, bmmu should provide gnt within N cycles bmmu2schd_bmmu_rst_gnt_forward_progress_chk_a bmmu2schd_bmmu_ini_gnt_forward_progress_chk_a bmmu2schd_bmmu_pop_gnt_fwd_progress_chk20_a bmmu2schd_bmmu_dlt_gnt_forward_progress_chk_a bmmu2schd_bmmu_pwrdn_gnt_forward_progress_chk_a

Interface name signals Constraints SVA deint interface x 4 llr_dat llr_valid no valid for 15 cycles after last init gnted by bmmu deint2bmmu_no_data_for_15cyc_after_last_init_gnted_c llr_usr UID never out of range (less than 20 per bank) deint2bmmu_no_uid_oor_c forbid invalid uid (uid that is not initialized) deint2bmmu_forbid_invalid_deint_llr_usr_c same uid cannot be on multiple channels in a given cycle (per uid) deint2bmmu_no_duplicate_uid_across_chnl_c

Checkers Constraints

116 Mandar Munishwar - Qualcomm

slide-117
SLIDE 117

Checks for common design components

  • FIFOs
  • Counters
  • Arbiters

117 Mandar Munishwar - Qualcomm

slide-118
SLIDE 118

EXECUTE

118 Mandar Munishwar - Qualcomm

slide-119
SLIDE 119

MEASURE

Is my setup over constrained?

  • Code Coverage

Without Constraints With Constraints Unreachable 5 12 Reached 95 88 95 88 5 12 82% 84% 86% 88% 90% 92% 94% 96% 98% 100% Reached Unreachable

Indicates Over Constraint Indicates dead code

119 Mandar Munishwar - Qualcomm

slide-120
SLIDE 120

MEASURE

Have I written enough checkers?

  • COI Coverage
  • < 100% COI Coverage indicates missing checkers

120 Mandar Munishwar - Qualcomm

slide-121
SLIDE 121

MEASURE

Quality of checkers

  • Subjective
  • A good job at planning phase will ensure quality
  • Diversified checkers
  • Technical review with team

121 Mandar Munishwar - Qualcomm

slide-122
SLIDE 122

MEASURE

Quantifying the Quality of checkers

  • Formal Core

122 Mandar Munishwar - Qualcomm

slide-123
SLIDE 123

Formal-core Coverage

Mandar Munishwar - Qualcomm

slide-124
SLIDE 124

100% Formal-core Coverage

  • Can we sign-off ?
  • Will this setup catch a bug if it is there?

Mandar Munishwar - Qualcomm

slide-125
SLIDE 125

Let’s introduce one …

  • My checkers are still passing

Mandar Munishwar - Qualcomm

slide-126
SLIDE 126

Formal-core Coverage

  • As with any other structural coverage, 100 % formal-core coverage

does not mean much

  • What are the options?

WELCOME to MUTATION

Mandar Munishwar - Qualcomm

slide-127
SLIDE 127

What is Mutation?

  • Modifying the DUT in small ways
  • Can this modification be detected by checkers?

Original Mutant

Mandar Munishwar - Qualcomm

slide-128
SLIDE 128

Applying Mutation – 1st Iteration

Mandar Munishwar - Qualcomm

slide-129
SLIDE 129

Applying Mutation – 2nd Iteration

Mandar Munishwar - Qualcomm

slide-130
SLIDE 130

What Are The Ways To Mutate?

Mandar Munishwar - Qualcomm

slide-131
SLIDE 131

Mutant Classification

  • Top Outputs Connectivity
  • Reset Condition True
  • Internal Connectivity
  • Synchronous Flow Control
  • Synchronous Dead Assign
  • Combo Logic Control Flow

Mandar Munishwar - Qualcomm

slide-132
SLIDE 132

Example of TopOutput Connectivity Faults

  • module topMod (output out1…);
  • assign out1 = (opsa0en == 1'b1) ? ('0) : // OutputPortStuckAt0
  • (opsa1en == 1'b1) ? ('1) : // OutputPortStuckAt1
  • (opnegen == 1'b1) ? (~orig_out1) : // OutputPortNegated
  • rig_out1 ;
  • endmodule

Mandar Munishwar - Qualcomm

slide-133
SLIDE 133

Example of ResetCondition True Fault

always @(posedge clk or negedge rstn) begin if (!rstn) begin …. end else … …. always @(posedge clk or negedge rstn) begin if (1’b1) begin …. end else … ….

Original Mutated

Mandar Munishwar - Qualcomm

slide-134
SLIDE 134

Summary

  • A well executed and measured plan can take us to the goal of

Formal sign-off

  • Plan

– Well Defined process with diversified checkers identified

  • Execution

– All checkers passing or acceptable bounded depth

  • Measurement

– No over constraint – 100% Formal Core – Extra confidence with Mutation analysis

Mandar Munishwar - Qualcomm

slide-135
SLIDE 135

Thank You

135