Connecting High Level Models and RTL: an Ongoing Battle Jesse Bingham Intel Feb 25 2009.

Slides:



Advertisements
Similar presentations
Copyright 2000 Cadence Design Systems. Permission is granted to reproduce without modification. Introduction An overview of formal methods for hardware.
Advertisements

Automated Theorem Proving Lecture 1. Program verification is undecidable! Given program P and specification S, does P satisfy S?
How to use TinyOS Jason Hill Rob Szewczyk Alec Woo David Culler An event based execution environment for Networked Sensors.
Tintu David Joy. Agenda Motivation Better Verification Through Symmetry-basic idea Structural Symmetry and Multiprocessor Systems Mur ϕ verification system.
Semantics Static semantics Dynamic semantics attribute grammars
CS 267: Automated Verification Lecture 8: Automata Theoretic Model Checking Instructor: Tevfik Bultan.
Introducing Formal Methods, Module 1, Version 1.1, Oct., Formal Specification and Analytical Verification L 5.
Automatic Verification Book: Chapter 6. What is verification? Traditionally, verification means proof of correctness automatic: model checking deductive:
Using Formal Specifications to Monitor and Guide Simulation: Verifying the Cache Coherence Engine of the Alpha Microprocessor Serdar Tasiran Systems.
D u k e S y s t e m s Time, clocks, and consistency and the JMM Jeff Chase Duke University.
Hybrid Systems Presented by: Arnab De Anand S. An Intuitive Introduction to Hybrid Systems Discrete program with an analog environment. What does it mean?
Timed Automata.
Transaction Based Modeling and Verification of Hardware Protocols Xiaofang Chen, Steven M. German and Ganesh Gopalakrishnan Supported in part by SRC Contract.
Transaction Based Modeling and Verification of Hardware Protocols Xiaofang Chen, Steven M. German and Ganesh Gopalakrishnan Supported in part by Intel.
Annoucements  Next labs 9 and 10 are paired for everyone. So don’t miss the lab.  There is a review session for the quiz on Monday, November 4, at 8:00.
ECE Synthesis & Verification 1 ECE 667 Synthesis and Verification of Digital Systems Formal Verification Combinational Equivalence Checking.
6/14/991 Symbolic verification of systems with state machines David L. Dill Jeffrey Su Jens Skakkebaek Computer System Laboratory Stanford University.
Background information Formal verification methods based on theorem proving techniques and model­checking –to prove the absence of errors (in the formal.
Presenter: PCLee – This paper outlines the MBAC tool for the generation of assertion checkers in hardware. We begin with a high-level presentation.
CS 355 – Programming Languages
1 Formal Methods in SE Qaisar Javaid Assistant Professor Lecture 05.
Using a Formal Specification and a Model Checker to Monitor and Guide Simulation Verifying the Multiprocessing Hardware of the Alpha Microprocessor.
The Design and Implementation of a Certifying Compiler [Necula, Lee] A Certifying Compiler for Java [Necula, Lee et al] David W. Hill CSCI
1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli.
Ordering and Consistent Cuts Presented By Biswanath Panda.
Model Checking. Used in studying behaviors of reactive systems Typically involves three steps: Create a finite state model (FSM) of the system design.
1 Carnegie Mellon UniversitySPINFlavio Lerda SPIN An explicit state model checker.
ECE Synthesis & Verification1 ECE 667 Spring 2011 Synthesis and Verification of Digital Systems Verification Introduction.
Verification of Hierarchical Cache Coherence Protocols for Future Processors Student: Xiaofang Chen Advisor: Ganesh Gopalakrishnan.
Temporal Logic of Actions (TLA) Leslie Lamport
Programming Language Semantics Denotational Semantics Chapter 5 Part III Based on a lecture by Martin Abadi.
Transaction Based Modeling and Verification of Hardware Protocols Xiaofang Chen, Steven M. German and Ganesh Gopalakrishnan Supported in part by SRC Contract.
Formal verification Marco A. Peña Universitat Politècnica de Catalunya.
Formal Verification of SpecC Programs using Predicate Abstraction Himanshu Jain Daniel Kroening Edmund Clarke Carnegie Mellon University.
Principle of Functional Verification Chapter 1~3 Presenter : Fu-Ching Yang.
272: Software Engineering Fall 2012 Instructor: Tevfik Bultan Lecture 4: SMT-based Bounded Model Checking of Concurrent Software.
Cheng/Dillon-Software Engineering: Formal Methods Model Checking.
ECE 720T5 Winter 2014 Cyber-Physical Systems Rodolfo Pellizzoni.
1 Automatic Non-interference Lemmas for Parameterized Model Checking Jesse Bingham, Intel DEG FMCAD 2008.
Proof Carrying Code Zhiwei Lin. Outline Proof-Carrying Code The Design and Implementation of a Certifying Compiler A Proof – Carrying Code Architecture.
CS6133 Software Specification and Verification
Modern VLSI Design 4e: Chapter 8 Copyright  2008 Wayne Wolf Topics Basics of register-transfer design: –data paths and controllers; –ASM charts. Pipelining.
1 How will execution time grow with SIZE? int array[SIZE]; int sum = 0; for (int i = 0 ; i < ; ++ i) { for (int j = 0 ; j < SIZE ; ++ j) { sum +=
Programming Languages and Design Lecture 3 Semantic Specifications of Programming Languages Instructor: Li Ma Department of Computer Science Texas Southern.
An Overview of Hardware Design Methodology Ian Mitchelle De Vera.
An Undergraduate Course on Software Bug Detection Tools and Techniques Eric Larson Seattle University March 3, 2006.
ECE-C662 Lecture 2 Prawat Nagvajara
- 1 -  P. Marwedel, Univ. Dortmund, Informatik 12, 05/06 Universität Dortmund Validation - Formal verification -
Lecture 5 1 CSP tools for verification of Sec Prot Overview of the lecture The Casper interface Refinement checking and FDR Model checking Theorem proving.
Verification & Validation By: Amir Masoud Gharehbaghi
CSCI1600: Embedded and Real Time Software Lecture 11: Modeling IV: Concurrency Steven Reiss, Fall 2015.
Concurrency Properties. Correctness In sequential programs, rerunning a program with the same input will always give the same result, so it makes sense.
Multilevel Caches Microprocessors are getting faster and including a small high speed cache on the same chip.
CSCI-365 Computer Organization Lecture Note: Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson.
04/26/20031 ECE 551: Digital System Design & Synthesis Lecture Set : Introduction to VHDL 12.2: VHDL versus Verilog (Separate File)
Formal Verification. Background Information Formal verification methods based on theorem proving techniques and model­checking –To prove the absence of.
CSCI 156: Lab 11 Paging. Our Simple Architecture Logical memory space for a process consists of 16 pages of 4k bytes each. Your program thinks it has.
Program Correctness. The designer of a distributed system has the responsibility of certifying the correctness of the system before users start using.
Presented by: Belgi Amir Seminar in Distributed Algorithms Designing correct concurrent algorithms Spring 2013.
Compositional Verification for System-on-Chip Designs SRC Student Symposium Paper 16.5 Nishant Sinha Edmund Clarke Carnegie Mellon University.
Agenda  Quick Review  Finish Introduction  Java Threads.
CS5270 Lecture 41 Timed Automata I CS 5270 Lecture 4.
ASIC Design Methodology
Opeoluwa Matthews, Jesse Bingham, Daniel Sorin
Processor (I).
Lecture 5 Floyd-Hoare Style Verification
ECE-C662 Introduction to Behavioral Synthesis Knapp Text Ch
Over-Approximating Boolean Programs with Unbounded Thread Creation
An explicit state model checker
ECE 352 Digital System Fundamentals
Presentation transcript:

Connecting High Level Models and RTL: an Ongoing Battle Jesse Bingham Intel Feb

Big Picture Architecture RTL Netlists Layout/Backend FPV FEV CDC, TOV Diagram unapologetically stolen from Erik This red arrow is the problem de jour

Formal Verification (ideal case): full coverage of design space Simulation: spot coverage of design space Motivation for Formal Verification Formal Verification (real life): full coverage in some areas Also stolen from Erik

Another Dimension … State/behavior coverage Property coverage FEV Arithmetic Traditional Simulation-based Testing Bounded Model Checking Protocol Model checking Type-checking Formal specification Theorem proving Today’s Topic (formal) Today’s Topic (checker)

Overview Protocols naturally & succinctly specified by high level models (HLM) –In a sense, all RTL safety properties are captures by the HLM Actual HW design (RTL) is hand-written by engineers How do we establish that RTL adheres to its HLM? –What does adherence even mean mathematically? Two approaches –Checker: HDL code that “watches” the design during simulation, raises alarms if it detects non-adherence Most of this talk is about checkers –Formal Proof: prove that checker can never ever ring alarm having the checker is obviously a prerequisite for formal proof Notoriously hard problem in FV –but getting more and more important in HW design

HW Protocols Distributed components exchanging messages Control Oriented Cannot be specified by input/output relations State is king Typically message latency insensitive (though message ordering often matters) Naturally specified at high level using guarded command languages (Murphi, TLA, Unity, etc) –we’ll call this the high level model (HLM) –we use Murphi, but this work is independent of the particular modeling language

HLM: Guarded Commands [Dijkstra 1975] Guard: predicate on states Command: function mapping states to states Guarded Command (GC): a guard & a command –Command is only allowed to fire if guard is true Called rules or rulesets in Murphi… Rule “go to park” NOT raining ==> location := nearest_park(); end Ruleset food : FOOD “have picnic” hungry AND NOT raining ==> location := nearest_park(); eat(food); end

… initial state enabled GC fires HLM Behaviors & Properties State invariants: all reachable states are “okay” –Cache always has at most one entry for each address More general safety properties –Cache returns most recently written data to a read request Liveness (typically assuming fairness) –If you send a read request, cache will eventually return data

Register Transfer Level (RTL) Clock/state accurate (or at least close) Pipelines Schedulers Special logic –Design-for-test –Clock gating –Reset Written in hardware description language like System Verilog or VHDL (we use SV) Can be formalizes as finite state automata or Kripke structures; we won’t do that today FV methods and CAD tools below RTL have advanced to the point where one can (if they choose to) safely think of RTL as the real Silicon

Refinement Map A function RM taking RTL states to HLM states is called a refinement map –Intuitively, RM(r) is the HLM state that summarizes RTL state r –Many-to-one in general –Human writes this in our methodology Generalization: RM depend on RTL signals at fixed offsets from current cycle –Useful for dealing with RTL pipelines

HLM Behavior RTL Behavior … one RTL clock cyle … reset state initial state Refinement map a guarded command fires Behavioral Refinement Each RTL clock cycle corresponds to zero or more guarded commands firing

HLM RTL one RTL clock cyle Checking Refinement … r RM(r) r (gc 1,gc 2, gc k )…GC_prediction(r) = =? Next

Running Example: Toy Cache Controller Cache Controller Main Memory CPU

Cache Controller HLM ……… Addr Data State  {Invalid,Dirty,Clean} CacheArray Cpu2Cache Cache2Mem Cache2Cpu Mem2Cache Let’s pretend these don’t exist

Ruleset i : CacheIndex “Recv Store" Cpu2Cache.opcode = Store & CacheArray[i].State != Invalid & CacheArray[i].Addr = Cpu2Cache.Addr ==> CacheArray[i].Data := Cpu2Cache.Data; CacheArray[i].State := Dirty; Absorb(Cpu2Cache); end Cache Controller HLM GC Recv_Store

Cache Controller HLM GC Evict Ruleset i : CacheIndex “Evict" CacheArray[i].State != Invalid ==> if (CacheArray[i].State == Dirty) begin Cache2Mem.opcode := WriteBack; Cache2Mem.Addr = CacheArray[i].Addr; Cache2Mem.Data = CacheArray[i].Data; end; CacheArray[i].State := Invalid; end

Cache Controller RTL Cpu2Cache Cache2Mem Cache State & Addr Array Eviction Logic Hit? Pipe stage 1 Pipe stage 2 Cache Data Array

Store with Eviction Cpu2Cache Cache2Mem Cache State & Addr Array Eviction Logic Hit? Pipe stage 1 Pipe stage 2 Store(A0,D0) Cache Data Array Dirty,A1 Store(A0,D0) WriteBack(A1,D1) D1Dirty,A0D0 WriteBack(A1,D1)

Store with Eviction Revisited Cache State & Addr Array Eviction Logic Hit? Pipe stage 1 Pipe stage 2 Store(A0,D0) Cache Data Array Dirty,A1 Store(A0,D0) WriteBack(A1,D1) D1Dirty,A0D0 WriteBack(A1,D1) When do the HLM GCs “happen” in the RTL? Store Evict

Key Point #1 Pipelining causes GCs that are atomic in the HLM to be non-atomic in the RTL. This non-atomicity must be handled by the refinement map.

Key Point #2 In the HLM GCs are interleaved; while the RTL can exhibit true GC concurrency. This must be resolved by the GC prediction.

Cache Controller Refinement Map (conceptual) function HLM_STATE RM(); // refinement map function HLM_STATE HLM; HLM.CacheArray[].State = RTL.AddrArray[].State; HLM.CacheArray[].Addr = RTL.AddrArray[].Addr; HLM.CacheArray[].Data = HLM.Cpu2Cache = HLM.Cache2Cpu = return(HLM); denotes the value will have k clock cycles in the future (k can be negative too, to refer to the past)

Cache Controller Refinement Map (with only non-positive temporal offsets) function HLM_STATE RM(); // refinement map function HLM_STATE HLM; HLM.CacheArray[].State = HLM.CacheArray[].Addr = HLM.CacheArray[].Data = RTL.DataArray[]; HLM.Cpu2Cache = HLM.Cache2Cpu = return(HLM); can be constructed using System Verilog’s $past operator

Store with Eviction Re-Revisited Cache State & Addr Array Pipe stage 1 Pipe stage 2 Store(A0,D0) Cache Data Array Dirty,A1 Store(A0,D0) WriteBack(A1,D1) D1 Dirty,A0 D0 WriteBack(A1,D1) HLM RTL EvictRecvStore

Cache Controller GC Prediction function HLM_STATE Next_HLM_STATE(HLM_STATE hs); if begin i = if hs = Evict(hs,i); if = STORE) hs = Recv_Store(hs,i); else if = LOAD) hs = Recv_Load(hs,i); end;... // figure out when to fire Send_Memory_Request // and Recv_Memory_Response end; Can result in 0, 1, or 2 GCs fired

Back-to-back Stores with Eviction State& Addr Array Pipe stage 1 Pipe stage 2 Store(A0,D0) Data Array Dirty,A1 Store(A0,D0) WriteBack(A1,D1) D1Dirty,A0D0 WriteBack(A1,D1) HLM RTL EvictRecvStore(A0) Store(A2,D2) D2 Dirty,A2 Store(A2,D2) RecvStore(A1)

FYI, we do everything in System Verilog Actual design under verificaiton –written by HW designers Test bench –written by HW validators HLM –written in Murphi by FV team in consultation with Architects –compiled into SV by a tool we wrote Refinement Map –hand-written in SV by FV team GC Prediction –hand-written in SV by FV team

Formal Proof of Refinement

HLM RTL one RTL clock cyle Formal Proof of Refinement version 1.0: looks like FEV  RM(  )  RM(  ) = Next(RM(  )) Totally symbolic RTL state; (represents all possible RTL states) Next(RM(  )) This will most certainly fail for some unreachable RTL states! Rats! ? Can be decided by SAT- or BDD-based solver engine Also might blow-up

HLM RTL one RTL clock cyle Formal Proof of Refinement version 2.0: write an invariant  RM(  )  Inv(  )  RM(  ) = Next(RM(  )) Totally symbolic RTL state; (represents all possible RTL states) Next(RM(  )) Can be decided by SAT- or BDD-based solver engine But concocting Inv is difficult, not to mention you need to also prove Inv is invariant Also might blow-up

Formal Proof of Refinement version 3.0: Model Checking Will likely blow-up; Probably need to restrict behaviors; e.g. use 4 addresses rather than 2 32 RTL & checker HLM of Environment start from initial state of env-HLM & RTL compute forward reachability via symbolic model checking verify that checker never fires.

Open Problems Refinement map is part of spec… or is it? Formal proof: best approach? –I spent 1.5 years banging my head on the formal side; the fact that I’ve retreated to checkers says something Tool issues: pain in the butt –Generated System Verilog has hit 4 bugs so far in expensive third-party simulator HLM/RTL discrepancies: can we weaken our notion of refinement to allow for reasonable mismatches? –E.g. HLM transmits message instantaneously, while RTL scheduling causes arbitrary delay before transmission

Partial Bibliography Using formal HLM as a checker: –Linking simulation with Formal Verification at a Higher Level, Tasiran, Batson, & Yu, 2004 –Runtime Refinement Checking of Concurrent Data Structures, Tasiran & Qadeer, 2004 Original Murphi paper: –Protocol Verification as a Hardware Design Aid, Dill, Drexler, Hu, & Yang, 1992 Formal verification of refinement maps for hardware –Automatic Verification of Pipelined Microprocessor Control, Burch & Dill, 1994 –Protocol Verification by Aggregation of Distributed Transactions, Park & Dill, 1996 –A Methodology for Hardware Verification using Compositional Model Checking, McMillan, 2000 –The Formal Design of 1M-gate ASICs, Eiriksson, 2000 Theory involving refinement in the face of fairness –On the Existence of Refinement Maps, Abadi & Lamport, 1991 Commercial Tools –BlueSpec (BlueSpec Inc.) –Pico (Synfora) –SLEC (Calypto)

Backups

type ---- Type declarations ---- CACHE_ENTRY : record State : enum {Invalid, Dirty, Clean}; Addr : ADDR; Data : DATA; end; var ---- State variables ---- CacheArray : array [0...CACHE_SIZE-1] of CACHE_ENTRY; Cpu2Cache : CPU2CACHE_MSG; Cache2Cpu : CACHE2CPU_MSG; Mem2Cache : MEM2CACHE_MSG; Cache2Mem : CACHE2MEM_MSG; Cache Controller HLM (typedefs & var decls in Murphi)

Guarded Commands Formalized State space S = type consistent assignments to variables Init : subset of state space specifying initial states A guarded command (GC) is a pair (g,c), where –g : S  {True,False} is called the guard; GC is enabled in state s if g(s) = True –c : S  S is called the command; GC fires from s to c(s) Semantics: HLM can transition from s to s iff there exists a GC that –is enabled in s –fires from s to s Nondeterminism arrises when multiple GCs are enabled In practice GCs are often parameterized We assume that the stuttering GC ( s.True, s.s ) is implicit

Refinement Formalized Let H and R be respective state spaces of HLM and RTL A function RM: R  H is called a refinement map –Intuitively, RM(r) is the HLM state that summarizes RTL state r –Many-to-one in general –Human writes this in our methodology We generalize this so that RM: R w  H, for some fixed w –Hence RM maps a fixed length sequence of RTL states to H –Useful for dealing with RTL pipelines

Ruleset i : CacheIndex “Recv Store" Cpu2Cache.opcode = Store & CacheArray[i].State != Invalid & CacheArray[i].Addr = Cpu2Cache.Addr ==> CacheArray[i].Data := Cpu2Cache.Data; CacheArray[i].State := Dirty; Absorb(Cpu2Cache); Ruleset i : CacheIndex “Recv Load" Cpu2Cache.opcode = Load & CacheArray[i].State != Invalid & CacheArray[i].Addr = Cpu2Cache.Addr ==> Cache2Cpu.Data := CacheArry[i].Data; Absorb(Cpu2Cache); Ruleset i : CacheIndex “Evict" CacheArray[i].State != Invalid ==> if (CacheArray[i].State == Dirty) begin Cache2Mem.opcode := WriteBack; Cache2Mem.Addr = CacheArray[i].Addr; Cache2Mem.Data = CacheArray[i].Data; end; CacheArray[i].State := Invalid; Cache Controller HLM GCs (1/2)

Ruleset i : CacheIndex ; a : Addr “Send Memory Request" CacheArry[i].State = Invalid ==> Cache2Mem.opcode := Get; Cache2Mem.Index := i; Cache2Mem.Addr = a; end Ruleset i : CacheIndex “Recv Memory Response" Mem2Cache.opcode = Response ==> CacheArry[Mem2Cache.Index].Data := Mem2Cache.Data; CacheArry[Mem2Cache.Index].Addr := Mem2Cache.Addr; CacheArry[Mem2Cache.Index].State := Clean; Absorb(Mem2Cache); end Cache Controller HLM GCs (2/2)

Load Miss (moot) Cpu2Cache Cache2Cpu Cache2Mem Mem2Cache Cache State & Addr Array Eviction Logic Hit? Pipe stage 1 Pipe stage 2 Load(A0) Cache Data Array Get(A0) Response(A0,D0) Clean,A0 D0 Response(D0)

Cache Controller Refinement Map (conceptual) function HLM_STATE RM(); // refinement map function HLM_STATE HLM; for (int i=0 ;i < CACHE_SIZE; i++) begin HLM.CacheArray[i].State = RTL.AddrArray[i].State; HLM.CacheArray[i].Addr = RTL.AddrArray[i].Addr; HLM.CacheArray[i].Data = end; HLM.Cpu2Cache = HLM.Cache2Cpu = RTL.Cache2Cpu; return(HLM); denotes the value will have k clock cycles in the future (k can be negative too)