200 likes | 320 Views
Automated Refinement Checking of Concurrent Systems. Sudipta Kundu, Sorin Lerner, Rajesh Gupta Department of Computer Science and Engineering, University of California, San Diego. …. x = a * b; c = a < b; if (c) then a = b – x; else a = b + x; a = a + x; b = b * x; ….
E N D
Automated Refinement Checking of Concurrent Systems Sudipta Kundu, Sorin Lerner, Rajesh Gupta Department of Computer Science and Engineering, University of California, San Diego
…. x = a * b; c = a < b; if (c) then a = b – x; else a = b + x; a = a + x; b = b * x; …. • C/C++, SystemC < 100 – 10K lines > Functionally Equivalent Data path Functionally Equivalent S0 Controller S1 !f f • Verilog, VHDL < 1K – 100K lines > S3 S2 S4 Hardware Design Methodology Algorithmic Description Functionally Equivalent High Level Synthesis Behavior Description RTL Description
The Model • Properties of interest: • Concurrency • Visible events • Model both the specification and implementation • Formal semantics • Various modeling languages • Process Algebra [CSP, CCS] • Petri Nets • SpecC/SystemC
(Trace) Refinement Checker Checker The Problem CSP Program (Specification) Transformed CSP Program (Implementation) Refinements
Previous Work Previous work in Refinement Checking of CSP programs • Inspired by translation validation [Necula 00] [Pnueli 98] State Space Relational Approach [Josephs 88] Interactive Theorem Provers [Dutertre 97] [Tej 97] [Isobe 05] Infinite Our Approach FDR Model Checker [FDR 05, Roscoe 95] Finite Level of Automation Semi Automatic Fully Automatic Manual
Outline • Motivation and Problem definition • Algorithms • Checking Algorithm • Inference Algorithm • Experiments and Results • Conclusion
Implementation: right left mid send recv ack An Example of Refinement Specification: right left Link v1 v1 4*v1 v1 v1 4*v1 2*v1 2*v1
| | True left?a left?x mid?u w:=a*4 a == x y:=x*2 z:=u*2 right!w mid!y right!z w == z Link ack?_ ack!1 Send Recv Specification Implementation CFGs for the Example Simulation Relation • A relation R that matches a given program state in the implementation with the corresponding state in the specification. • The simulation relation is a set of entries of the form (p1, p2, Ф). p1 – program point in Specification p2 – program point in Implementation Ф– formula that relates the data • Split state space in two parts: • control flow state, which is finite. => explored by traversing the CFG • dataflow state, which may be infinite. => explored using Automated Theorem Prover (ATP)
| | left?a left?x mid?u w:=a*4 y:=x*2 z:=u*2 right!w mid!y right!z Link ack?_ ack!1 Send Recv Specification Implementation Checking Algorithm C1: True C2: a == x ATP[C1 => WP(C2)] C3: w == z ATP[(C3) => WP(C2)] ATP[(C2) => WP(C3)]
Outline • Motivation and Problem definition • Algorithms • Checking Algorithm • Inference Algorithm • Experiments and Results • Conclusion
Inference Algorithm • It works in two steps. • Forward pass: collect local condition for externally visible events to be matched. • Backward pass: propagate local conditions backward, using weakest preconditions. • May not terminate • Loops - iterate to a fixed point • In practice it can find the required simulation relation.
| | left?a C1 left?x mid?u w:=a*4 C2 y:=x*2 z:=u*2 right!w mid!y right!z C3: w == z Link ack?_ ack!1 Send Recv Specification Implementation Inference Algorithm: Forward Pass
| | left?a left?x mid?u w:=a*4 y:=x*2 z:=u*2 right!w mid!y right!z Link ack?_ ack!1 Send Recv Specification Implementation Inference Algorithm: Backward Pass C1: True ATP[C2 -> WP(C3)] C2: a == x C2: True ATP[C1 -> WP(C2)] ATP[C3 -> WP(C2)] C3: w == z
Outline • Motivation and Problem definition • Algorithms • Checking Algorithm • Inference Algorithm • Experiments and Results • Conclusion
CSP Specification CSP Implementation Front End Parser A R C C o S Implementation (CFG) Specification (CFG) Simulation Relation Inference Engine Checking Engine Automated Theorem Prover (Simplify) Partial Order Reduction Engine Prototype Implementation - ARCCoS
Outline • Motivation and Problem definition • Algorithms • Checking Algorithm • Inference Algorithm • Experiments and Results • Conclusion
Conclusion and Future Directions • We have presented an automated algorithm for checking trace refinement of CSP programs that has infinite state spaces. • Checking Algorithm • Inference Algorithm • The work presented here is only the first step in a broader research plan whose goal is to check the refinement of SystemC.