Part II Concepts.

Slides:



Advertisements
Similar presentations
Simplifications of Context-Free Grammars
Advertisements

Variations of the Turing Machine
PDAs Accept Context-Free Languages
ALAK ROY. Assistant Professor Dept. of CSE NIT Agartala
Adders Used to perform addition, subtraction, multiplication, and division (sometimes) Half-adder adds rightmost (least significant) bit Full-adder.
1 Minimalist proof assistants Interactions of technology and methodology in formal system level verification Ken McMillan Cadence Berkeley Labs.
Process Description and Control
AP STUDY SESSION 2.
1
Compositional Methods and Symbolic Model Checking
Introduction to Model Checking
Copyright 2000 Cadence Design Systems. Permission is granted to reproduce without modification. Introduction An overview of formal methods for hardware.
1 Verification of Infinite State Systems by Compositional Model Checking Ken McMillan Cadence Berkeley Labs.
1 Copyright © 2013 Elsevier Inc. All rights reserved. Chapter 4 Computing Platforms.
Sequential Logic Design
Processes and Operating Systems
Copyright © 2013 Elsevier Inc. All rights reserved.
Copyright © 2013 Elsevier Inc. All rights reserved.
David Burdett May 11, 2004 Package Binding for WS CDL.
CALENDAR.
Chapter 5 Input/Output 5.1 Principles of I/O hardware
Programming Language Concepts
Break Time Remaining 10:00.
Figure 12–1 Basic computer block diagram.
Turing Machines.
Table 12.1: Cash Flows to a Cash and Carry Trading Strategy.
PP Test Review Sections 6-1 to 6-6
Chapter 10: Applications of Arrays and the class vector
Briana B. Morrison Adapted from William Collins
Chapter 3 Logic Gates.
Chapter 10: Virtual Memory
Outline Minimum Spanning Tree Maximal Flow Algorithm LP formulation 1.
Regression with Panel Data
Operating Systems Operating Systems - Winter 2010 Chapter 3 – Input/Output Vrije Universiteit Amsterdam.
Lexical Analysis Arial Font Family.
Chapter 6 File Systems 6.1 Files 6.2 Directories
Copyright © 2012, Elsevier Inc. All rights Reserved. 1 Chapter 7 Modeling Structure with Blocks.
Adding Up In Chunks.
MaK_Full ahead loaded 1 Alarm Page Directory (F11)
1 Processes and Threads Chapter Processes 2.2 Threads 2.3 Interprocess communication 2.4 Classical IPC problems 2.5 Scheduling.
1 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt Synthetic.
Artificial Intelligence
1 Using Bayesian Network for combining classifiers Leonardo Nogueira Matos Departamento de Computação Universidade Federal de Sergipe.
Karnaugh Maps ECEn/CS 224.
: 3 00.
5 minutes.
1 Non Deterministic Automata. 2 Alphabet = Nondeterministic Finite Accepter (NFA)
1 hi at no doifpi me be go we of at be do go hi if me no of pi we Inorder Traversal Inorder traversal. n Visit the left subtree. n Visit the node. n Visit.
1 Let’s Recapitulate. 2 Regular Languages DFAs NFAs Regular Expressions Regular Grammars.
Converting a Fraction to %
Clock will move after 1 minute
Physics for Scientists & Engineers, 3rd Edition
Select a time to count down from the clock above
9. Two Functions of Two Random Variables
1 Dr. Scott Schaefer Least Squares Curves, Rational Representations, Splines and Continuity.
1 Decidability continued…. 2 Theorem: For a recursively enumerable language it is undecidable to determine whether is finite Proof: We will reduce the.
1 Non Deterministic Automata. 2 Alphabet = Nondeterministic Finite Accepter (NFA)
Distributed Computing 5. Snapshot Shmuel Zaks ©
The Pumping Lemma for CFL’s
Princess Sumaya University
1 Model checking. 2 And now... the system How do we model a reactive system with an automaton ? It is convenient to model systems with Transition systems.
Automatic Verification Book: Chapter 6. What is verification? Traditionally, verification means proof of correctness automatic: model checking deductive:
ECE Synthesis & Verification - L271 ECE 697B (667) Spring 2006 Synthesis and Verification of Digital Systems Model Checking basics.
Model Checking Inputs: A design (in some HDL) and a property (in some temporal logic) Outputs: Decision about whether or not the property always holds.
Review of the automata-theoretic approach to model-checking.
1 Introduction to SMV and Model Checking Mostly by: Ken McMillan Cadence Berkeley Labs Small parts by: Brandon Eames ISIS/Vanderbilt.
A brief history of model checking Ken McMillan Cadence Berkeley Labs
1 Example: traffic light controller Guarantee no collisions Guarantee eventual service E S N.
Verification & Validation By: Amir Masoud Gharehbaghi
Presentation transcript:

Part II Concepts

The structure of a design proof A proof is a pyramid “Bricks” are assertions, models, etc… Each assertion rests on lower-level assertions So what happens if we remove some bricks? Specification Abstract models and properties Gates, transistors, etc...

Local property verification Verify properties of small parts of design, e.g… Bus protocol conformance No pipeline hazards Like type checking, rules out certain localized errors Although this leaves a rather large gap... Specification GAP Properties verified (or RTL equivalence) Gates, transistors, etc...

Abstract models Make an ad-hoc abstraction of the design Verify that it satisfies specification Separate, e.g., protocol and implementation correctness But how do we know we have implemented this abstraction? Specification verified Abstract model GAP Properties verified Gates, transistors, etc...

Partial refinement verification Verify that key RTL components implement abstraction Abstract model provides environment for RTL verification Make interface assumptions explicit Can transfer interface assumptions to simulation We can rule out errors in certain RTL components, assuming our interface constraints are met. Specification verified Abstract model GAP GAP RTL level models Gates, transistors, etc...

Overview Property specification and verification Abstraction temporal logic model checking finite automata and language containment symbolic trajectory evaluation Abstraction system-level finite-state abstractions abstraction with uninterpreted function symbols Refinement verification refinement maps cache coherence example

Model Checking (Clarke and Emerson) G(p -> F q) yes MC output yes no + counterexample input: temporal logic spec finite-state model (look ma, no vectors!) no p p q q

Linear temporal logic (LTL) A logical notation that allows to: specify relations in time conveniently express finite control properties Temporal operators G p “henceforth p” F p “eventually p” X p “p at the next time” p W q “p unless q”

Types of temporal properties Safety (nothing bad happens) G ~(ack1 & ack2) “mutual exclusion” G (req -> (req W ack)) “req must hold until ack” Liveness (something good happens) G (req -> F ack) “if req, eventually ack” Fairness GF req -> GF ack “if infinitely often req, infinitely often ack”

Example: traffic light controller S E N Guarantee no collisions Guarantee eventual service

Controller program module main(N_SENSE,S_SENSE,E_SENSE,N_GO,S_GO,E_GO); input N_SENSE, S_SENSE, E_SENSE; output N_GO, S_GO, E_GO; reg NS_LOCK, EW_LOCK, N_REQ, S_REQ, E_REQ; /* set request bits when sense is high */ always begin if (!N_REQ & N_SENSE) N_REQ = 1; end always begin if (!S_REQ & S_SENSE) S_REQ = 1; end always begin if (!E_REQ & E_SENSE) E_REQ = 1; end

Example continued... /* controller for North light */ always begin if (N_REQ) begin wait (!EW_LOCK); NS_LOCK = 1; N_GO = 1; wait (!N_SENSE); if (!S_GO) NS_LOCK = 0; N_GO = 0; N_REQ = 0; end /* South light is similar . . . */

Example code, cont… always begin /* Controller for East light */ if (E_REQ) begin EW_LOCK = 1; wait (!NS_LOCK); E_GO = 1; wait (!E_SENSE); EW_LOCK = 0; E_GO = 0; E_REQ = 0; end

Specifications in temporal logic Safety (no collisions) G ~(E_Go & (N_Go | S_Go)); Liveness G (~N_Go & N_Sense -> F N_Go); G (~S_Go & S_Sense -> F S_Go); G (~E_Go & E_Sense -> F E_Go); Fairness constraints GF ~(N_Go & N_Sense); GF ~(S_Go & S_Sense); GF ~(E_Go & E_Sense); /* assume each sensor off infinitely often */

Counterexample East and North lights on at same time... E_Go E_Req N light goes on at same time S light goes off. S takes priority and resets NS_Lock E_Sense NS_Lock N_Go N_Req N_Sense S_Go S_Req S_Sense

Fixing the error Don’t allow N light to go on while south light is going off. always begin if (N_REQ) begin wait (!EW_LOCK & !(S_GO & !S_SENSE)); NS_LOCK = 1; N_GO = 1; wait (!N_SENSE); if (!S_GO) NS_LOCK = 0; N_GO = 0; N_REQ = 0; end

Another counterexample North traffic is never served... E_Go E_Req N and S lights go off at same time Neither resets lock Last state repeats forever E_Sense NS_Lock N_Go N_Req N_Sense S_Go S_Req S_Sense

Fixing the liveness error When N light goes off, test whether S light is also going off, and if so reset lock. always begin if (N_REQ) begin wait (!EW_LOCK & !(S_GO & !S_SENSE)); NS_LOCK = 1; N_GO = 1; wait (!N_SENSE); if (!S_GO | !S_SENSE) NS_LOCK = 0; N_GO = 0; N_REQ = 0; end

All properties verified Guarantee no collisions Guarantee service assuming fairness Computational resources used: 57 states searched 0.1 CPU seconds

Computation tree logic (CTL) Branching time model Path quantifiers A = “for all future paths” E = “for some future path” Example: AF p = “inevitably p” p p AF p p Every operator has a path quantifier AG AF p instead of GF p 7

Difference between CTL and LTL Think of CTL formulas as approximations to LTL AG EF p is weaker than G F p Good for finding bugs... p AF AG p is stronger than F G p Good for verifying... p p CTL formulas easier to verify So, use CTL when it applies... 8

CTL model checking algorithm Example: AF p = “inevitably p” p Complexity linear in size of model (FSM) linear in size of specification formula Note: general LTL problem is exponential in formula size

Specifying using w-automata An automaton accepting infinite sequences G (p -> F q) p ~q ~p q Finite set of states (with initial state) Transitions labeled with Boolean conditions Set of accepting states Interpretation: A run is accepting if it visits an accepting state infinitely often Language = set of sequences with accepting runs

Verifying using w-automata Construct parallel product of model and automaton Search for “bad cycles” Very similar algorithm to temporal logic model checking Complexity (deterministic automaton) Linear in model size Linear in number of automaton states Complexity in number of acceptance conditions varies

Comparing automata and temporal logic Tableau procedure LTL formulas can be translated into equivalent automata Translation is exponential w-automata are strictly more expressive than LTL p “p at even times” Example: T LTL with “auxiliary” variables = w-automata Example: G (even -> p) where: init(even) := 1; next(even) := ~even;

State explosion problem What if the state space is too large? too much parallelism data in model Approaches “Symbolic” methods (BDD’s) Abstraction/refinement Exploit symmetry Exploit independence of actions

Binary Decision Diagrams (Bryant) Ordered decision tree for f = ab + cd a 1 b b 1 1 c c c c 1 1 1 1 d d d d d d d d 1 1 1 1

OBDD reduction Reduced (OBDD) form: a 1 b 1 c 1 1 d 1 Key idea: combine equivalent sub-cases

OBDD properties Canonical form (for fixed order) Efficient algorithms direct comparison Efficient algorithms build BDD’s for large circuits f fg g O(|f| |g|) Variable order strongly affects size

Symbolic Model Checking Represent sets and relations with Boolean functions R(a,b,a’,b’) a,b a’,b’ Breadth-first search using BDD’s Sw ... S1 S0 = p Si+1 = Si \/ EX Si Enables search of larger state spaces Handle more complex control Can in some cases extend to data path specifications

Example: buffer allocation controller busy data 1 Controller busy counter alloc free free_addr alloc_addr nack

Verilog description assign nack = alloc & (count == `SIZE); assign count = count + (alloc & ~nack) - free; always begin if(free) busy[free_addr] = 0; if(alloc & ~nack) busy[alloc_addr] = 1; end for(i = (`SIZE - 1); i >= 0; i = i - 1) if (~busy[i]) alloc_addr = i;

LTL specifications Alloc’d buffer may not be realloc’d until freed allocd[i] = alloc & ~nack & alloc_addr = i; freed[i] = free & free_addr = i; G (allocd[i] -> (~allocd[i] W freed[i]); Must assume the following always holds: G (free -> busy[free_addr]);

Verification results SIZE = 32 buffers: Time 68 s BDD nodes used transition relation ~7000 reached state set ~600 total ~60000 Total number of states 4G

Why are BDD’s effective? Combining equivalent subcases: busy[0] 1 All cases where sum of busy = x are equivalent busy[1] 1 1 busy[2] 1 1 1 count[0] 1 1 count[1] 1 1 1 1 1 1

Symbolic simulation Simulate with Boolean functions instead of logic values a b ab + cd c d Use BDD’s to represent functions

Example: sequential parity circuit b a clk Specification Initial state Input sequence Final state Symbolic simulation = unfolding b0 = q a0 = r, a1 = s, a2 = t b3 = q + r + s + t q q + r + s + t r s t

Pipeline verification unpipelined step commutative diagram flush flush pipeline step pipelined R

Property verification Specification GAP Properties verified (or RTL equivalence) Gates, transistors, etc... Like type checking… Rules out certain localized errors Static -- requires no vectors Does not guarantee correct interaction of components

Abstraction Reduces state space by hiding some information Introduces non-determinism Abstract states Concrete states Allows verification at system level

Example: “Gigamax” cache protocol global bus . . . UIC UIC UIC cluster bus . . . . . . . . . M P P M P P Bus snooping maintains local consistency Message passing protocol for global consistency

Protocol example Cluster B read --> cluster A global bus . . . UIC A B C UIC UIC cluster bus . . . . . . . . . M P P M P P owned copy read miss Cluster B read --> cluster A Cluster A response --> B and main memory Clusters A and B end shared

Protocol correctness issues Protocol issues deadlock unexpected messages liveness Coherence each address is sequentially consistent store ordering (system dependent) Abstraction is relative to properties specified

One-address abstraction Cache replacement is non-deterministic Message queue latency is arbitrary IN OUT ? A ? ? ? output of A may or may not occur at any given time

{ Specifications Absence of deadlock Coherence SPEC AG (EF p.readable & EF p.writable); Coherence SPEC AG((p.readable & bit -> ~EF(p.readable & ~bit)); Abstraction: { 0 if data < n 1 otherwise bit =

Counterexample: deadlock in 13 steps global bus . . . UIC A B C UIC UIC cluster bus . . . . . . . . . M P P M P P owned copy from cluster A Cluster A read --> global (waits, takes lock) Cluster C read --> cluster B Cluster B response --> C and main memory Cluster C read --> cluster A (takes lock)

Abstract modeling Model entire system as finite state machine Specification verified Abstract model GAP Properties verified Gates, transistors, etc... Model entire system as finite state machine Verify system-level properties Separate protocol/implementation issues Can precede actual implementation Doesn’t guarantee implementation correctness

Refinement maps Maps translate abstract events to implementation level Abstract model -- protocol -- architecture, etc... Implementation Component Refinement Maps Maps translate abstract events to implementation level Allows verification of component in context of abstract model

Auxiliary signals Imaginary signals: to relate high/low level Abstract model -- protocol -- architecture, etc... Refinement Maps Aux functions Imaginary signals: identifying tags future values to relate high/low level Implementation Component

Example -- pipelines ISA Fully executed instructions Bypass path Register file

Decomposition Verify bypass for register 0 Infer others by symmetry ISA Fully executed instructions ? Bypass path Register file

Out of order processors ISA inst1 Fully executed instructions issue retire inst2 inst3 inst4 tags

Refinement of cache protocol Non-deterministic abstract model Atomic actions Single address abstraction Verified coherence, etc... INTF P M IO to net S/F network protocol host Distributed cache coherence

Mapping protocol to RTL host other hosts Abstract model S/F network refinement maps TAGS ~30K lines of Verilog CAM TABLES

Local refinement verification Specification verified Abstract model GAP GAP RTL level models Gates, transistors, etc... Specifying refinement maps allows use of abstract model as verification context explicit interface definitions (can transfer to simulation) formal verification of RTL units, without vectors System correctness at RTL level not guaranteed And note, this is not a highly automated process...

Summary Basic specification and verification techniques Temporal logic model checking Finite automata Symbolic simulation Application at different levels Local property verification Abstract model verification Local refinement verification Benefits Find design errors (negative results) Make assumptions explicit Systematically rule out classes of design errors