1 of 14 TDTS07: System Design and Methodology Introduction to Lab 1 and 2 Ivan Ukhov Embedded Systems Laboratory Department of Computer and Information.

Slides:



Advertisements
Similar presentations
Metodi formali dello sviluppo software a.a.2013/2014 Prof.Anna Labella.
Advertisements

CS 267: Automated Verification Lecture 2: Linear vs. Branching time. Temporal Logics: CTL, CTL*. CTL model checking algorithm. Counter-example generation.
M ODEL CHECKING -Vasvi Kakkad University of Sydney.
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:
An Introduction to the Model Verifier verds Wenhui Zhang September 15 th, 2010.
ECE Synthesis & Verification - L271 ECE 697B (667) Spring 2006 Synthesis and Verification of Digital Systems Model Checking basics.
Model Checking I What are LTL and CTL?. and or dreq q0 dack q0bar.
CS6133 Software Specification and Verification
UPPAAL Introduction Chien-Liang Chen.
Timed Automata.
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.
1 Spin Model Checker Samaneh Navabpour Electrical and Computer Engineering Department University of Waterloo SE-464 Summer 2011.
Spin Tutorial (some verification options). Assertion is always executable and has no other effect on the state of the system than to change the local.
Model Checking. Used in studying behaviors of reactive systems Typically involves three steps: Create a finite state model (FSM) of the system design.
Lecture 4&5: Model Checking: A quick introduction Professor Aditya Ghose Director, Decision Systems Lab School of IT and Computer Science University of.
ECE Synthesis & Verification1 ECE 667 Spring 2011 Synthesis and Verification of Digital Systems Verification Introduction.
Loops – While, Do, For Repetition Statements Introduction to Arrays
 2003 Prentice Hall, Inc. All rights reserved. 1 Chapter 3 - Functions Outline 3.12Recursion 3.13Example Using Recursion: The Fibonacci Series 3.14Recursion.
Review of the automata-theoretic approach to model-checking.
Embedded Systems Laboratory Department of Computer and Information Science Linköping University Sweden Formal Verification and Model Checking Traian Pop.
Chapter 1 Program Design
Abstract Verification is traditionally done by determining the truth of a temporal formula (the specification) with respect to a timed transition system.
Fundamentals of Python: From First Programs Through Data Structures
Verification technique on SA applications using Incremental Model Checking 컴퓨터학과 신영주.
Cheng/Dillon-Software Engineering: Formal Methods Model Checking.
SystemC: Introduction. SystemC  A C++ based class library and design environment for system-level design.  Suitable for functional description that.
Fundamentals of Python: First Programs
Timed UML State Machines Ognyana Hristova Tutor: Priv.-Doz. Dr. Thomas Noll June, 2007.
UPPAAL Ghaith Haddad. Introduction UPPAAL is a tool for modeling, validation and verification of real-time systems. Appropriate for systems that can be.
Using Mathematica for modeling, simulation and property checking of hardware systems Ghiath AL SAMMANE VDS group : Verification & Modeling of Digital systems.
CHAPTER 5: CONTROL STRUCTURES II INSTRUCTOR: MOHAMMAD MOJADDAM.
1 Freeha Azmat Saba Zia Dec 02, Agenda Installation Introduction From Verilog to SystemC Counter as an Example Complete SystemC Modeling 2.
VHDL IE- CSE. What do you understand by VHDL??  VHDL stands for VHSIC (Very High Speed Integrated Circuits) Hardware Description Language.
Automatic Verification of Finite-State Concurrent Systems Using Temporal Logic Specifications 1.
Mr. Dave Clausen1 La Cañada High School Chapter 6: Repetition Statements.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
TDDD55- Compilers and Interpreters Lesson 1 Zeinab Ganjei Department of Computer and Information Science Linköping University.
Chapter 5 Control Structure (Repetition). Objectives In this chapter, you will: Learn about repetition (looping) control structures Explore how to construct.
1 CISC181 Introduction to Computer Science Dr. McCoy Lecture 7 Clicker Questions September 22, 2009.
Winter-Spring 2001Codesign of Embedded Systems1 Reactivity, Ports, and Signals in SystemC Part of HW/SW Codesign of Embedded Systems Course (CE )
Introduction to Problem Solving. Steps in Programming A Very Simplified Picture –Problem Definition & Analysis – High Level Strategy for a solution –Arriving.
Safety-Critical Systems 5 Testing and V&V T
- 1 -  P. Marwedel, Univ. Dortmund, Informatik 12, 05/06 Universität Dortmund Validation - Formal verification -
Introduction to Loops Iteration Repetition Counting Loops Also known as.
Verification & Validation By: Amir Masoud Gharehbaghi
Constraints Assisted Modeling and Validation Presented in CS294-5 (Spring 2007) Thomas Huining Feng Based on: [1]Constraints Assisted Modeling and Validation.
CSCI1600: Embedded and Real Time Software Lecture 28: Verification I Steven Reiss, Fall 2015.
1 CSEP590 – Model Checking and Automated Verification Lecture outline for July 9, 2003.
Software Systems Verification and Validation Laboratory Assignment 4 Model checking Assignment date: Lab 4 Delivery date: Lab 4, 5.
SystemC Semantics by Actors and Reduction Techniques in Model Checking Marjan Sirjani Formal Methods Lab, ECE Dept. University of Tehran, Iran MoCC 2008.
CS Class 04 Topics  Selection statement – IF  Expressions  More practice writing simple C++ programs Announcements  Read pages for next.
6/12/20161 a.a.2015/2016 Prof. Anna Labella Formal Methods in software development.
CS5270 Lecture 41 Timed Automata I CS 5270 Lecture 4.
1 of 14 Ivan Ukhov Embedded Systems Laboratory Department of Computer and Information Science Linköping University TDDI08: Embedded Systems Design Introduction.
Complexity of Compositional Model Checking of Computation Tree Logic on Simple Structures Krishnendu Chatterjee Pallab Dasgupta P.P. Chakrabarti IWDC 2004,
Tutorial 1 COEN691B.
Verilog Introduction Fall
CIS 842: Specification and Verification of Reactive Systems
Tsao, Lin-wei Li, Han-lin Hu, Sun-Bo
Design Flow System Level
CSCI1600: Embedded and Real Time Software
CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING
Formal Methods in software development
Computer Security: Art and Science, 2nd Edition
CSCI1600: Embedded and Real Time Software
Formal Methods in software development
Presentation transcript:

1 of 14 TDTS07: System Design and Methodology Introduction to Lab 1 and 2 Ivan Ukhov Embedded Systems Laboratory Department of Computer and Information Science Linköping University

2 of 14 2 Contacts  Petru Eles (lectures)  Office: Building B 329:220   Ivan Ukhov (lessons)  Office: Building B 329:228   Adrian Horga (labs)  Office: Building B 329:198 

3 of 14 3 Outline  Today  Organization  Lab 1  Break  Lab 2  Next time  Lab 2 (demo)  Lab 3

4 of 14 4 Organization  Lab groups  Webreg groups A and B  Web page   Check for detailed information and links to tutorials  Organization  2 lessons (including this one)  10 two-hour lab sessions  Lab assignments 1.Modeling and simulation with SystemC 2.Formal verification with UPPAAL 3.Design-space exploration with MPARM

5 of 14 5 Organization  Choose a lab partner and sign up in Webreg   Deadline for registration: January 31  Register as soon as possible  Deadline for labs: March 27  This is the last day for handing in ( ing) lab reports  After the deadline, your assistant will correct the remaining lab reports at his earliest convenience  Rules: Please read them (see the labs’ page)

6 of 14 6 Structure 1.Modeling and simulation with SystemC 2.Formal verification with UPPAAL 3.Design-space exploration with MPARM  Each lab has a tutorial. Please read it and be prepared before you attend the lab session. We want to work efficiently during the supervised lab sessions.

7 of 14 7 Examination  Written report for each lab (pdf)  Present your solution to the lab exercises  Explain your design and implementation choice in detail  Present and discuss your results  Prepare an archive with the report (pdf) and the code (where any) and it to your group’s assistant (CC both lab partners)  Grades:  Passed  Intermediate: revise your solution and report according to your assistant’s comments

8 of 14 8 Lab 1 and 2: Modeling, Validation, Verification After the system is designed:  Find out whether the system works according to its specification and correctly  Validation – Quality assurance process  “Are we building the right product?”  Simulation  Testing  Verification – Quality control process  “Are we building the product right?”  Model checking  Theorem proving

9 of 14 9 Lab 1: SystemC Modeling and Simulation

10 of Simulation  Based on executable models of the system  Generate input stimuli  Permits a quick and shallow evaluation of the design quality  Good for finding bugs  Not suitable for finding subtle errors

11 of SystemC  Compare to VHDL and Verilog  Contains structures for modeling HW components and their interaction  Comes with a simulation kernel  It’s a unified HW-SW design language  What do we need to model systems?  time  modules  concurrent processes  events  channels  ports

12 of SystemC – Time  Data type sc_time (a C++ class)  Use like an ordinary basic C++ data type ( int, double )  sc_time t1(9,SC_MS);  sc_time t2 = sc_time(5,SC_SEC);  if (t1<t2) cout << t1*3 << endl << t2+t2;  Many of the standard operators are defined for sc_time  The underlying representation is based on 64-bits unsigned integer values  The representable time is limited (discrete time)  Depends on the time resolution  Default: 1 picosecond  Can be set by the user through the function sc_set_time_resolution

13 of SystemC – Modules Modules:  Basic building blocks in SystemC  Contains ports, concurrent processes, internal data structures, channels, etc.  Created with the macro SC_MODULE  Concurrent processes ( SC_THREAD or SC_METHOD )  Use wait statements to advance time (or event notification)  Sensitive to events ( sc_event ) or value changes in channels  Input and output ports to communicate with the environment

14 of Example: Adder Adder a b sum

15 of SystemC Module Example #include using std::cout; using std::endl; SC_MODULE(Adder) { sc_in a_p; sc_in b_p; sc_out sum_p; sc_event print_ev; void add_method() { sum_p = a_p + b_p; print_ev.notify(SC_ZERO_TIME); } void print_method() { cout << sc_time_stamp() << ”:Sum=” <<sum_p << endl; } SC_CTOR(Adder) { sum_p.initialize(0); SC_METHOD(add_method); sensitive << a_p << b_p; SC_METHOD(print_method); dont_initialize(); sensitive << print_ev; } }; // END Adder

16 of Generate Inputs Adder a b sum Generator

17 of SystemC – Input Generator SC_MODULE(Generator) { sc_out a_p; sc_out b_p; void gen_thread() { for (;;) { wait(1,SC_SEC); a_p = a_p + 1; b_p->write(b_p->read() + 1); } } SC_CTOR(Generator) { a_p.initialize(0); b_p.initialize(0); SC_THREAD(gen_thread); } }; // END Generator

18 of SystemC – Test Bench // Definition of an input generator (next slide) int sc_main(int argc, char *argv[]) { sc_set_default_time_unit(1,SC_SEC); sc_signal a_sig, b_sig, sum_sig; // create channels Adder adder_module(”Adder_1”); // create an instance adder_module(a_sig, b_sig, sum_sig); // connect ports to channels Generator gen(”Generator_1”); gen(a_sig, b_sig); sc_start(30,SC_SEC); return 0; }

19 of Simulation Run $./adder.x SystemC 2.1.v1 --- Dec :12:32 Copyright (c) by all Contributors ALL RIGHTS RESERVED 0 s: Sum=0 1 s: Sum=2 2 s: Sum=4 3 s: Sum=6 4 s: Sum=8 5 s: Sum=10 6 s: Sum=12 7 s: Sum=14 8 s: Sum=16 9 s: Sum=18 10 s: Sum=20 11 s: Sum=22.

20 of Simulator Kernel  1. Initialize: each process executed once; it’s possible to disable this phase for methods  2. Evaluate: select a ready to run process and execute/resume it; immediate notification may happen – e.notify()  3. repeat 2 until no more processes to run  4. Update: values assigned to channels in the previous evaluate cycle  5. stept 2-4 = delta-cycle; if 2 or 3 resulted in delta event notifications (e.notify(0) or wait(0)) go to 2 without advancing simulation time  6. Advance to next simulation time with pending events  Determine processes ready to run and go to 2

21 of Simulator kernel – Delta-Cycle Example //inside a process sc_signal sig_int; //assume current value //of sig_int is 0 sig_int.write(1); int value = sig_int.read(); cout << value << endl; wait(SC_ZERO_TIME); value = sig_int.read(); cout << value << endl; 0101

22 of Try the Example  You can find the example at:  /home/TDTS07/tutorials/systemc/adder  Copy it to your home directory  Two files:  adder.cc (implements the two modules + the test bench)  Makefile (helps you compile and build the program)  Type make at the command line assuming you are in the correct directory  Creates an executable adder.x  After building the example, type./adder.x to run it  Study the source code together with the tutorial

23 of Lab Assignment  Study the lab material linked from the web pages  At the end of the document you find the lab assignment  Design and implement a traffic light controller  For details: SystemC Language Reference Manual 

24 of Lab 2: Formal Verification with UPPAAL

25 of Formal Methods For the levels of complexity typical to embedded systems:  Traditional validation techniques (e.g., simulation) cover a small fraction of the system behavior  Bugs found late have a negative impact on the time-to-market  A failure may lead to a catastrophe

26 of Model Checking

27 of UPPAAL Design and verification tool:  Requirements specification: computation tree logic (CTL)  Modeling: timed automata  Validation: simulation  Verification: model checking  User-friendly graphical user interface  (free for academic use)

28 of Timed Automata in UPPAAL  A timed automaton is a finite automaton augmented with a finite set of real variables called clocks  All the clocks change along the time with the same constant rate  Timing constraints can be expressed imposing conditions over clocks  The timed automata model consists of a collection of automata that operate and coordinate with each other through shared variables and synchronization labels

29 of Timed Automata — Syntax X 3 n m Clocks: X, Y a Action used for synchronization Guard = clock constraint X = 0 Reset (action performed on clocks) Y<=2Invariant

30 of Timed Automata — Example a1a2 a3 b1 b2 b3 y=1 t? ca=0 ca<=3 y=2 t! y==2 y==1 cb=0 y=2 cb>4

31 of Temporal Logics How do we specify properties for timed systems?  Logic augmented with temporal modal operators  Allow us to reason about how the truth of assertions changes over time  Used to specify desired properties of timed systems  Safety: Nothing bad will ever happen  Liveness: Something good may eventually happen  Boundedness: Something will happen within a time limit  Different forms of temporal logic  Depending on the underlying model of time  Computation tree logic (CTL)

32 of CTL: Computation Tree Logic  Based on propositional logic of branching time: it may split into more than one possible future  Atomic propositions (states in timed automata) and boolean connectors  Temporal operators:  Path quantifier  A – all computation paths  E – some computation path  Forward-time operators  G – globally  F – in the future  X – next time  U – until

33 of Computation Tree  Represents an unfolded state graph – nodes are the possible states that the system might reach  Build (infinite) computation trees from the TA model OKError OK

34 of CTL Temporal Operators p EX p p EF p p AX p p EG p p p p p AF p pp p p AG p pp p pp p p InvariantInevitable Possible Potentially global

35 of CTL Example Two properties of the system  Possible error: EF Error (True!)  Possibly globally OK: EG OK (True!)  AG OK (False!) OKError OK

36 of CTL in UPPAAL  UPPAAL has a special syntax for CTL  AF p = A<> p Always eventually p  AG p = A[] pInvariantly p  EF p = E<> pPossibly p  EG p = E[] pPotentially always p  Boolean connectives: and, or, not, imply  No nested formulas, except  A[] (p imply A<> q) = p --> q  p --> q ”If p holds in some state, then q will hold in some future state”  This construction can be used to verify one of the properties in the assignments: ”If a car arrives at the traffic light, it should eventually be granted green light.”

37 of Formal Methods Formal methods can  overcome some of the limitations of traditional techniques,  give a better understanding of the system,  help to uncover ambiguities, and  reveal new insights of the system. Formal methods do have limitations and are to complement simulation and testing, rather than replacing them.

38 of Lab Assignment  Study the lab material linked from the lab pages  In the document you will find the lab assignments as well as the requirements on the deliverables  Introductory assignments to get familiar with timed automata, CTL, and UPPAAL  Model the traffic light controller in timed automata  Simulate and verify  Implement a communication protocol  Alternating bit protocol

39 of Thank you! Questions?