Informatique Fondamentale IMA S8

Similar documents
CSC258: Computer Organization. Combinational Logic

Feb 22,2013. CS402- Theory of Automata Solved MCQS From Final term Papers. FINALTERM EXAMINATION Fall 2012 CS402- Theory of Automata

Logic Design ( Part 3) Sequential Logic- Finite State Machines (Chapter 3)

Tape. Tape head. Control Unit. Executes a finite set of instructions

Universidad Carlos III de Madrid Digital Electronics Exercises

Lecture 11: Synchronous Sequential Logic

We are here. Assembly Language. Processors Arithmetic Logic Units. Finite State Machines. Circuits Gates. Transistors

Chapter 12. Synchronous Circuits. Contents

Chapter 3. Boolean Algebra and Digital Logic

Chapter 5 Synchronous Sequential Logic

FPGA Implementation of Sequential Logic

ELCT201: DIGITAL LOGIC DESIGN

Department of CSIT. Class: B.SC Semester: II Year: 2013 Paper Title: Introduction to logics of Computer Max Marks: 30

FSM Test Translation Through Context

Combinational / Sequential Logic

Principles of Computer Architecture. Appendix A: Digital Logic

DIGITAL SYSTEM DESIGN UNIT I (2 MARKS)

cs281: Introduction to Computer Systems Lab07 - Sequential Circuits II: Ant Brain

L5 Sequential Circuit Design

St. MARTIN S ENGINEERING COLLEGE

VeriLab. An introductory lab for using Verilog in digital design (first draft) VeriLab

2 Sequential Circuits

Microprocessor Design

Advanced Digital Logic Design EECS 303

Chapter 5: Synchronous Sequential Logic

Computer Architecture and Organization

Chapter Contents. Appendix A: Digital Logic. Some Definitions

Objectives. Combinational logics Sequential logics Finite state machine Arithmetic circuits Datapath

Synchronous sequential circuits

Digital Logic Design ENEE x. Lecture 24

Using minterms, m-notation / decimal notation Sum = Cout = Using maxterms, M-notation Sum = Cout =

Sequential Circuits. Output depends only and immediately on the inputs Have no memory (dependence on past values of the inputs)

Read-only memory (ROM) Digital logic: ALUs Sequential logic circuits. Don't cares. Bus

Part II. Chapter2: Synchronous Sequential Logic

CS61C : Machine Structures

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad ELECTRICAL AND ELECTRONICS ENGINEERING

ECE 301 Digital Electronics

ECSE-323 Digital System Design. Datapath/Controller Lecture #1

CPS311 Lecture: Sequential Circuits

1.b. Realize a 5-input NOR function using 2-input NOR gates only.

Chapter 5 Synchronous Sequential Logic

Laboratory Exercise 7

CS8803: Advanced Digital Design for Embedded Hardware

Subject : EE6301 DIGITAL LOGIC CIRCUITS

Testing Transition Systems with Input and Output Testers

1. a) For the circuit shown in figure 1.1, draw a truth table showing the output Q for all combinations of inputs A, B and C. [4] Figure 1.

Combinational vs Sequential

Digital Design, Kyung Hee Univ. Chapter 5. Synchronous Sequential Logic

Chapter 11 State Machine Design

Step 1 - shaft decoder to generate clockwise/anticlockwise signals

ENGG 1203 Tutorial. D Flip Flop. D Flip Flop. Q changes when CLK is in Rising edge PGT NGT

Section 6.8 Synthesis of Sequential Logic Page 1 of 8

In this lecture we will work through a design example from problem statement to digital circuits.

TMEL53, DIGITALTEKNIK. INTRODUCTION TO SYNCHRONOUS CIRCUITS, FLIP-FLOPS and COUNTERS

1. What does the signal for a static-zero hazard look like?

EECS150 - Digital Design Lecture 15 Finite State Machines. Announcements

PLTW Engineering Digital Electronics Course Outline

How to Predict the Output of a Hardware Random Number Generator

Sequential Logic. Analysis and Synthesis. Joseph Cavahagh Santa Clara University. r & Francis. TaylonSi Francis Group. , Boca.Raton London New York \

Digital Electronics Course Outline

More Digital Circuits

A Review of logic design

Synchronous Sequential Logic. Chapter 5

Logic Design II (17.342) Spring Lecture Outline

Chapter 5 Sequential Systems. Introduction

WEEK 10. Sequential Circuits: Analysis and Design. Page 1

Business Intelligence & Process Modelling

Jin-Fu Li Advanced Reliable Systems (ARES) Laboratory. National Central University

Introduction to Digital Logic Missouri S&T University CPE 2210 Exam 2 Logistics

1 Introduction to Finite-State Machines and State Diagrams for the Design of Electronic Circuits and Systems

Analysis of Clocked Sequential Circuits

The word digital implies information in computers is represented by variables that take a limited number of discrete values.

CS6201 UNIT I PART-A. Develop or build the following Boolean function with NAND gate F(x,y,z)=(1,2,3,5,7).

Finite State Machine Design

LESSON PLAN. Sub Code: EE2255 Sub Name: DIGITAL LOGIC CIRCUITS Unit: I Branch: EEE Semester: IV

North Shore Community College

Introduction to Artificial Intelligence. Learning from Oberservations


EECS150 - Digital Design Lecture 19 - Finite State Machines Revisited

Problems with D-Latch

Using Scan Side Channel to Detect IP Theft

Introduction to Artificial Intelligence. Learning from Oberservations

Generating Complete and Finite Test Suite for ioco: Is It Possible?

More design examples, state assignment and reduction. Page 1

A Combined Compatible Block Coding and Run Length Coding Techniques for Test Data Compression

Final Exam review: chapter 4 and 5. Supplement 3 and 4

Artificial Intelligence

Test Data Compression for System-on-a-Chip Using Golomb Codes 1

University of Maiduguri Faculty of Engineering Seminar Series Volume 6, december 2015

Outline. Introduction to number systems: sign/magnitude, ones complement, twos complement Review of latches, flip flops, counters

Encoders and Decoders: Details and Design Issues

FSM Implementations. TIE Logic Synthesis Arto Perttula Tampere University of Technology Fall Output. Input. Next. State.

CS8803: Advanced Digital Design for Embedded Hardware

Digital Circuit Engineering

Spring 2017 EE 3613: Computer Organization Chapter 5: The Processor: Datapath & Control - 1

MC9211 Computer Organization

A New Low Energy BIST Using A Statistical Code

EECS 140 Laboratory Exercise 7 PLD Programming


FPGA Design. Part I - Hardware Components. Thomas Lenzi

Transcription:

Informatique Fondamentale IMA S8 Cours 1 - Intro + schedule + finite state machines Laure Gonnord http://laure.gonnord.org/pro/teaching/ Laure.Gonnord@polytech-lille.fr Université Lille 1 - Polytech Lille March/April 2011

Course introduction and schedule Until now During S5,S6,S7, IMA students have learnt : (programming stuff) C programing and compiling, (conception stuff) algorithm design and encoding, (microelec) circuits and embedded systems hardware, (auto) design flows of industrial processes Solved (computation) problems by ad-hoc solutions. Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 March/April 2011 2 / 38

Course introduction and schedule Until now 2/2 But : No general scheme to design algorithms. (manual) evaluation of the cost of our programs. worse no assurance of correctness. even worse it there always a solution? All these problems will be addressed in this course Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 March/April 2011 3 / 38

Course introduction and schedule Schedule Finite state machines (regular automata), regular languages. Notion of non determinism. Link with circuits. I/O automata, stack automata and grammars. Link to simple languages. Counter automata, Turing machines and undecidable problems. Link to classical programs. Graphs and classical problems/algorithms on graphs. Compiler Construction : front end + classical static analysis. Compiler Construction : code generation + classical dynamic analysis. Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 March/April 2011 4 / 38

Course introduction and schedule I - Regular languages and automata Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 March/April 2011 5 / 38

Finite state machines 1 Finite state machines 2 Regular Languages 3 The notion of non determinism 4 Classical Algorithms 5 Expressivity of regular languages 6 Link to other models Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 March/April 2011 6 / 38

Finite state machines What for? We want to model : the behaviour of systems with behavioural modes. the behaviour of (Boolean) circuits. sets of words. A finite representation. Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 March/April 2011 7 / 38

Finite state machines Example Opening/Closing door - Source Wikipedia. state 1 Opened E: open door transition close_door open_door transition condition 2 Closed entry action E: close door Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 March/April 2011 8 / 38

Finite state machines General definition Finite state machine (FSM) or regular automata States are labeled, and there are finitely many (s Q) Initial state(s) (i I) and accepting (terminating/finishing) states (t F ) Transitions are finitely many. Transitions are labeled with letters (a A). The transition function is δ : Q A Q. b s a 0 s a 1 s 2 Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 March/April 2011 9 / 38

Finite state machines Accepted language 1/2 Accepted word A word w on the alphabet A is accepted by the automaton iff there exists a finite path from an initial state to an accepting state which is labeled by w. b s a 0 s a 1 s 2 w = aa is accepted/recognised. Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 March/April 2011 10 / 38

Finite state machines Accepted language 2/2 Accepted language The accepted language of a given automaton A is the set of all accepted words and is denoted by L(A). Remark : it can be infinite. b s a 0 s a 1 s 2 L(A) = {ab k a, k N}. Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 March/April 2011 11 / 38

Finite state machines Data Structure for implementation Problem : how to encode an automata? b s a 0 s a 1 s 2 The transition function can be (for instance) encoded as a transition table : s 0 s 1 s 2 s 0 a s 1 b a s 2 Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 March/April 2011 12 / 38

Regular Languages 1 Finite state machines 2 Regular Languages 3 The notion of non determinism 4 Classical Algorithms 5 Expressivity of regular languages 6 Link to other models Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 March/April 2011 13 / 38

Regular Languages Goal Problem : how to describe languages easily in a textual linear way? use regular expressions. Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 March/April 2011 14 / 38

Regular Languages Regular expressions Regular expression (recursive def) A regular expression e on the alphabet A is defined by induction. It can be of any of the following kinds : the empty word ε a letter a A a choice between an expression e 1 and another expression e 2 : e 1 + e 2 two successive expressions : e 1 e 2 0,1 or more successive occurrences of e 1 : e 1. Example with A = {a, b, c, d} : e = a (b + c d) Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 March/April 2011 15 / 38

Regular Languages Regular expression vs word A regular expression encodes the form of a word. For instance : i m a (3 + 4 + 5) (on the alphabet {i, m, a, 3, 4, 5}) describes all words beginning by the prefix ima and finishing by one of the numbers 3, 4 or 5. A regular expression describes a language Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 March/April 2011 16 / 38

Regular Languages Regular language Regular language Given a regular expression e, L(e) denotes the set of words (the language) that are described by the regular expression e. Example with A = {0,..., 9} : e = (1 + 2 +... + 9) (0 + 1 + 2 +... + 9). What is L(e)? Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 March/April 2011 17 / 38

Regular Languages Linux world Some commands use (extended) regular expressions (regexp) : ls *.pdf lists all pdfs of the current directory grep ta*.* *.c find all lines in.c files that contains words that begin with t + some a s. sed ''s ta*.*/toto/g'' file replace all occurrences... Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 March/April 2011 18 / 38

Regular Languages Relationship between automata and languages - 1/3 First, some experiments. Given the following automata A, are you able to give a regular expression e such that L(e) = L(A)? b s a 0 s a 1 s 2 e =? Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 March/April 2011 19 / 38

Regular Languages Relationship between automata and languages - 2/3 And the converse : Given the following regular expression e = b (c + a), are you able to give an automaton A such that L(A) = L(e)? Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 March/April 2011 20 / 38

Regular Languages Relationship between automata and languages - 3/3 General result - Kleene Theorem The regular languages are exactly the languages that are described by finite automata. What we ve done before is always possible. Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 March/April 2011 21 / 38

The notion of non determinism 1 Finite state machines 2 Regular Languages 3 The notion of non determinism 4 Classical Algorithms 5 Expressivity of regular languages 6 Link to other models Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 March/April 2011 22 / 38

The notion of non determinism Goal Sometimes some info lacks to make a choice between two transitions : c q a 0 q c 1 q 2 From state q 1, there is a non deterministic choice while reading c : either go to state q 2 or stay in q 1. Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 March/April 2011 23 / 38

The notion of non determinism Definition Non deterministic FSM A deterministic automaton is A =< A, Q, I, F, δ > with δ : A Q Q A non deterministic automata is the same with : δ : A Q P (Q) A non deterministic automata with ε-transitions is the same with δ : (A {ε}) A P (Q) Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 March/April 2011 24 / 38

The notion of non determinism Example A non deterministic automata with ε-transitions : c p a q d r ε Then L(A) = a (c d ). Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 March/April 2011 25 / 38

Classical Algorithms 1 Finite state machines 2 Regular Languages 3 The notion of non determinism 4 Classical Algorithms 5 Expressivity of regular languages 6 Link to other models Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 March/April 2011 26 / 38

Classical Algorithms Find the associated language Goal : Given A an automaton, find the associated language. Exercises! Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 March/April 2011 27 / 38

Classical Algorithms Construction of automaton from a regular expression Goal : Given a regular expression, construct a regular automaton that recognises it. Exercises! Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 March/April 2011 28 / 38

Classical Algorithms Determinisation Goal : transform a non deterministic automaton into a deterministic one. Exercises! Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 March/April 2011 29 / 38

Classical Algorithms Other Algorithms In the literature you will easily find : algorithms to eliminate ε transitions without determinising (ε closure) ; algorithms to minimise automata (the number of states) ; algorithms to use automata to find words in a text ; algorithms to test language inclusion (if they are regular)... Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 March/April 2011 30 / 38

Expressivity of regular languages 1 Finite state machines 2 Regular Languages 3 The notion of non determinism 4 Classical Algorithms 5 Expressivity of regular languages 6 Link to other models Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 March/April 2011 31 / 38

Expressivity of regular languages Non regular languages Important result There exists some non-regular languages. Examples of non-regular languages : {a n b n, n N}. palindromes on a non-singleton alphabet. {a p, p prime} There exists a quite systematic way to prove that a given language is not regular (Pumping Lemma). Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 March/April 2011 32 / 38

Link to other models 1 Finite state machines 2 Regular Languages 3 The notion of non determinism 4 Classical Algorithms 5 Expressivity of regular languages 6 Link to other models Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 March/April 2011 33 / 38

Link to other models Moore and Mealy Machines - 1 Moore : I/O machine whose output values are determined solely by the current state : source Wikipedia Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 March/April 2011 34 / 38

Link to other models Moore and Mealy Machines - 2 Mealy : output values are determined both by the current state and the value of the input. source Wikipedia Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 March/April 2011 35 / 38

Link to other models UML Implementation of FSMs UML variants of FSMs are hierarchical, react to messages and call functions. source Wikipedia Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 March/April 2011 36 / 38

Link to other models Hardware Implementation of FSMs It requires : a register to store state variables a block of combinational logic for the state transition (optional) a block of combinatorial logic for the output Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 March/April 2011 37 / 38

Conclusion Summary Regular Automata or Finite State Machines are : Acceptors for regular languages. But some languages are not regular. Algorithmically efficient. Useful to describe (simple) behaviours of systems. Closely linked to circuits. Laure Gonnord (Lille1/Polytech) Informatique Fondamentale IMA S8 March/April 2011 38 / 38