Synchronous Logic. These must be the slings and arrows of outrageous fortune. Comp 411 Fall /18/06. L14 Synchronous Logic 1

Similar documents
Synchronous Logic. These must be the slings and arrows of outrageous fortune. Comp 411 Spring /12/12. L13 Synchronous Logic 1

Synchronous Logic. These must be the slings and arrows of outrageous fortune. Comp 411 Fall /20/15. L15 Synchronous Logic 1

Sequential Logic. Road Traveled So Far

Limits of Computation

State Machines. Example FSM: Roboant

Sequential Logic. Handouts: Lecture Slides Spring /27/01. L06 Sequential Logic 1

6. Finite State Machines

ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN. Week 9 Dr. Srinivas Shakkottai Dept. of Electrical and Computer Engineering

MACHINE COMPUTING. the limitations

Lecture 10: Synchronous Sequential Circuits Design

5. Sequential Logic x Computation Structures Part 1 Digital Circuits. Copyright 2015 MIT EECS

Models for representing sequential circuits

Latches. October 13, 2003 Latches 1

Ch 7. Finite State Machines. VII - Finite State Machines Contemporary Logic Design 1

The Design Procedure. Output Equation Determination - Derive output equations from the state table

Chapter 3. Digital Design and Computer Architecture, 2 nd Edition. David Money Harris and Sarah L. Harris. Chapter 3 <1>

Chapter 3. Chapter 3 :: Topics. Introduction. Sequential Circuits

Memory, Latches, & Registers

EEE2135 Digital Logic Design

CPE100: Digital Logic Design I

Appendix B. Review of Digital Logic. Baback Izadi Division of Engineering Programs

ALU, Latches and Flip-Flops

EECS Components and Design Techniques for Digital Systems. FSMs 9/11/2007

3. Complete the following table of equivalent values. Use binary numbers with a sign bit and 7 bits for the value

Computers also need devices capable of Storing data and information Performing mathematical operations on such data

State and Finite State Machines

CPE100: Digital Logic Design I

Problem Set 9 Solutions

CPE100: Digital Logic Design I

King Fahd University of Petroleum and Minerals College of Computer Science and Engineering Computer Engineering Department

Synchronous Sequential Circuit Design

Memory Elements I. CS31 Pascal Van Hentenryck. CS031 Lecture 6 Page 1

Sequential Logic (3.1 and is a long difficult section you really should read!)

CSE140: Design of Sequential Logic

Synchronous Sequential Circuit Design. Dr. Ehab A. H. AL-Hialy Page 1

Boolean circuits. Lecture Definitions

FSM model for sequential circuits

Sequential Circuits Sequential circuits combinational circuits state gate delay

ENGG 1203 Tutorial _03 Laboratory 3 Build a ball counter. Lab 3. Lab 3 Gate Timing. Lab 3 Steps in designing a State Machine. Timing diagram of a DFF

11.1 As mentioned in Experiment 10, sequential logic circuits are a type of logic circuit where the output of

ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN. Week 7 Dr. Srinivas Shakkottai Dept. of Electrical and Computer Engineering

Digital Circuit Engineering

Turing Machine Variants

Finite State Machines CS 64: Computer Organization and Design Logic Lecture #15 Fall 2018

CSE 200 Lecture Notes Turing machine vs. RAM machine vs. circuits


LOGIC CIRCUITS. Basic Experiment and Design of Electronics

Counters. We ll look at different kinds of counters and discuss how to build them

Introduction to Turing Machines

Finite State Machine (FSM)

CMPE12 - Notes chapter 1. Digital Logic. (Textbook Chapter 3)

Binary addition example worked out

14.1. Unit 14. State Machine Design

Part I: Definitions and Properties

Department of Electrical & Electronics EE-333 DIGITAL SYSTEMS

Synchronous Sequential Circuit Design. Digital Computer Design

Gates. Quiz 1 will cover up to and including this lecture. The book says something about NAND... maybe an in-law. Is he talking about BILL??? 6.

Clocked Synchronous State-machine Analysis

Parity Checker Example. EECS150 - Digital Design Lecture 9 - Finite State Machines 1. Formal Design Process. Formal Design Process

Most General computer?

Sequential Circuits. Circuits with state. Silvina Hanono Wachman Computer Science & Artificial Intelligence Lab M.I.T. L06-1

Lecture 14 Finite state machines

(a) Definition of TMs. First Problem of URMs

King Fahd University of Petroleum and Minerals College of Computer Science and Engineering Computer Engineering Department

CSE140: Components and Design Techniques for Digital Systems. Midterm Information. Instructor: Mohsen Imani. Sources: TSR, Katz, Boriello & Vahid

CprE 281: Digital Logic

ELEC Digital Logic Circuits Fall 2014 Sequential Circuits (Chapter 6) Finite State Machines (Ch. 7-10)

Sequential Synchronous Circuit Analysis

Analysis of clocked sequential networks

CS151 Complexity Theory. Lecture 1 April 3, 2017

Digital Circuit Engineering

Different encodings generate different circuits

Lecture 13: Sequential Circuits, FSM

Example: vending machine

State & Finite State Machines

CS4026 Formal Models of Computation

LOGIC CIRCUITS. Basic Experiment and Design of Electronics. Ho Kyung Kim, Ph.D.

Lecture 9: Sequential Logic Circuits. Reading: CH 7

14:332:231 DIGITAL LOGIC DESIGN

Turing Machines. Lecture 8

Timing Constraints in Sequential Designs. 63 Sources: TSR, Katz, Boriello & Vahid

Sequential Logic Worksheet

Lecture 8: Sequential Networks and Finite State Machines

EECS 144/244: Fundamental Algorithms for System Modeling, Analysis, and Optimization

ALU A functional unit

Synchronous Sequential Logic

Table of Content. Chapter 11 Dedicated Microprocessors Page 1 of 25

Adders allow computers to add numbers 2-bit ripple-carry adder

State & Finite State Machines

Digital Logic and Design (Course Code: EE222) Lecture 19: Sequential Circuits Contd..

Topic 8: Sequential Circuits

Combinational vs. Sequential. Summary of Combinational Logic. Combinational device/circuit: any circuit built using the basic gates Expressed as

ELCT201: DIGITAL LOGIC DESIGN

ENGG 1203 Tutorial_9 - Review. Boolean Algebra. Simplifying Logic Circuits. Combinational Logic. 1. Combinational & Sequential Logic

From Sequential Circuits to Real Computers

University of Toronto Faculty of Applied Science and Engineering Edward S. Rogers Sr. Department of Electrical and Computer Engineering

Review for B33DV2-Digital Design. Digital Design

CSE370: Introduction to Digital Design

ECE 341. Lecture # 3

Fundamentals of Digital Design

Transcription:

Synchronous Logic 1) Sequential Logic 2) Synchronous Design 3) Synchronous Timing Analysis 4) Single Clock Design 5) Finite State Machines 6) Turing Machines 7) What it means to be Computable These must be the slings and arrows of outrageous fortune L14 Synchronous Logic 1

Road Traveled So Far Fets & voltages Logic gates Combinational logic circuits Sequential Logic Voltage-based encoding V OL, V IL, V IH, V OH Combinational contract: discrete-valued inputs complete in/out spec. static discipline Acyclic connections Composable blocks Design: truth tables sum-of-products muxes, ROMs, PLAs Storage & state Dynamic discipline Finite-state machines Throughput & latency Pipelining Our motto: Sweat the details once, and then put a box around it! L14 Synchronous Logic 2

Something We Can t Build (Yet) What if you were given the following design specification: button When the button is pushed: 1) Turn on the light if it is off 2) Turn off the light if it is on The light should change state within a second of the button press light What makes this circuit so different from those we ve discussed before? 1. State i.e. the circuit has memory 2. The output was changed by a input event (pushing a button) rather than an input value L14 Synchronous Logic 3

Sequential = Stateful Memory Device LOAD Current State Combinational Logic New State Input Output Plan: Build a Sequential Circuit with stored digital STATE MEMORY stores CURRENT state, produced at output Combinational Logic computes the NEXT state (from input, current state) the OUTPUTs (from input, current state) State changes on LOAD control input Didn t we develop some memory devices last time? L14 Synchronous Logic 4

Review of Flip Flop Timing <t PD D CLK D Q Q Q CLK >t CD t PD : maximum propagation delay, CLK Q How long after a clock before the outputs (Q) are valid D >t SETUP >t HOLD t CD : minimum contamination delay, CLK Q How soon after a clock can the outputs (Q) go invalid t SETUP : setup time How long the data (D) input must be stable before the clock s rising edge t HOLD : hold time How long the data (D) inputs must be held after the clocks rising edge L14 Synchronous Logic 5

Synchronous Timing Analysis CLK CLK D Q L D Q reg1 reg2 t 1 t 2 Questions for register-based designs: How much time for useful work (i.e. for combinational logic delay)? Does it help to guarantee a minimum t CD? How bout designing registers so that t CD,reg > t HOLD,reg? t 1 = t CD,reg1 + t CD,L > t HOLD,reg2 t 2 = t PD,reg1 + t PD,L < t CLK - t SETUP,reg2 What happens if CLK signal doesn t arrive at the two registers at exactly the same time (a phenomenon known as clock skew )? Minimum Clock Period : t CLK > t PD,reg1 + t PD,L + t SETUP,reg2 L14 Synchronous Logic 6

Example: Flip Flop Timing start button button 1 button Current state t CD =? t PD = 5ns ROM 64x4 unlock Next state Questions: 1. t CD for the ROM? t CD,REG + t CD,ROM > t H,REG 1 ns + t CD,ROM > 2 ns t CD,ROM > 1 ns 2. Min. clock period? 3 t CD = 1ns t PD = 3ns t S = 2ns t H = 2ns Q D clock 3 Just how do I assure that? t CLK > t PD,REG + t PD,ROM + t S,REG t CLK > 3 ns + 5 ns + 2 ns t CLK > 1 ns 3. Constraints on inputs? start,, and 1 must be valid t PD,ROM + t S,REG = 5 + 2 = 7 ns before the clock and held t H,REG t CD,ROM = 2 1 = 1 ns after it. L14 Synchronous Logic 7

Single Synchronous Clock Design Sequential Synchronous However, Synchronous = A recipe for robust sequential circuits: No combinational cycles (other than those already built into the registers) Only cares about values of combinational circuits just before rising edge of clock Clock period greater than every combinational delay Changes state after all logic transitions have stopped! L14 Synchronous Logic 8

Designing Sequential Logic Sequential logic is used when the solution to some design problem involves a sequence of steps: How to open digital combination lock w/ 3 buttons ( start, and 1 ): Step 1: press start button Step 2: press button Step 3: press 1 button Step 4: press 1 button Step 5: press button Information remembered between steps is called state. Might be just what step we re on, or might include results from earlier steps we ll need to complete a later step. L14 Synchronous Logic 9

Implementing a State Machine This is starting to look a lot like a PROGRAM Current state start 1 Next state unlock --- 1 --- --- start start 1 digit1 1 start 1 error 11 start start digit1 1 1 digit2 1 digit1 1 1 error 11 digit1 1 digit1 1 digit2 1 1 digit3 11 digit3 11 1 unlock 1 unlock 1 1 error 11 1 unlock 1 1 error 11 1 unlock 1 unlock 1 1 error 11 --- --- error 11 6 different states encode using 3 bits L14 Synchronous Logic 1

Now Do It With Hardware! start button button 1 button Current state ROM 64x4 6 inputs 2 6 locations each location supplies 4 bits unlock Next state 3 3 Q D Trigger update periodically ( clock ) L14 Synchronous Logic 11

Abstraction du jour: Finite State Machines m Clocked FSM n A FINITE STATE MACHINE has k STA TES S 1... S k (one is "initial state) m INPU TS I 1... I m n O U TP U TS O 1... O n Transition R ules S'(S,i) for each state S and input i Output Rules Out(S) for each state S L14 Synchronous Logic 12

Discrete State, Time inputs STATE s ROM NEXT s outputs Two design choices: (1) outputs *only* depend on state (Moore) (2) outputs depend on inputs + state (Mealy) s state bits 2 s possible states Clock STATE NEXT Clock Period 1 Clock Period 2 Clock Period 3 Clock Period 4 Clock Period 5 L14 Synchronous Logic 13

State Transition Diagrams S S U= D1 U= S S S S 1 1 D2 U= D3 U= 1 1,1 U U=1 A state transition diagram is an abstract graph representation of a state machine, where each state is represented as a node and each transition is represented as a as an arc. It represents the machine s behavior not its implementation. S E U= S NAME of state Heavy circle means INITIAL state = no buttons pressed OUTPUT when in this state (Moore) XXX U= INPUT causing transition L14 Synchronous Logic 14

Valid State Diagrams S 1 S1 S2 1 1 1 MOORE Machine: Outputs on States /1 S 1/1 1/ S1 / / S2 1/ MEALY Machine: Outputs on Transitions Arcs leaving a state must be: (1) mutually exclusive can only have one choice for any given input value (2) collectively exhaustive every state must specify what happens for each possible input combination. Nothing happens means arc back to itself. L14 Synchronous Logic 15

Let s Play State Machine Let s emulate the behavior specified by the state machine shown below when processing the following string from LSB to MSB. S 1 S1 1 1 S2 1 39 1 = 1111 2 State Input Next Output T= S 1 S1 T=1 S1 1 S 1 T=2 S 1 S1 T=3 S1 S2 T=4 S2 S1 T=5 S1 1 S 1 T=6 S S 1 It looks to me like this machine outputs a 1 whenever the bit sequence that it has seen thus far is a multiple of 3. L14 Synchronous Logic 16

in/out Busted Stuff S1 1/ S2 1/ 1/ 1/ / / S3 S8 S9 S4 1/1 -/ 1/ -/ / Can you spot the problems? S5 1/1 -/1 1/ / CONVENIENT NOTATION: S7 When a transition is made on the next input regardless of its value the arc can be labeled with an X or - AMBIGOUS TRANSITIONS (Mutual Exclusive property violated): For each input there can only be one arc leaving a state S6 input/output (Mealy) UNSPECIFIED TRANSITIONS (Collectively Exhaustive property violated): There must be an arc leaving a state for all valid inputs (It can, however, loop back to the same state) L14 Synchronous Logic 17

FSM Party Games 1. What can you say about the number of states? States 2 k k ROM k x y z 2. Same question: FSM 1 m-states States m n FSM 2 n-states 3. Here's an FSM. Can you discover its rules? L14 Synchronous Logic 18

What s My Transition Diagram? =OFF, 1=ON? 1 1 vs. "1111" = Surprise! 1 1 1 1 1 1 If you know NOTHING about the FSM, you re never sure! If you have a BOUND on the number of states, you can discover its behavior: K-state FSM: Every (reachable) state can be reached in < k steps. BUT... states may be equivalent! L14 Synchronous Logic 19

FSM Equivalence 1 1 vs. 1 1 1 1 1 ARE THEY DIFFERENT? NOT in any practical sense! They are EXTERNALLY INDISTINGUISHABLE, hence interchangeable. FSMs are EQUIVALENT iff every input sequence yields identical output sequences. ENGINEERING GOAL: HAVE an FSM which works... WANT simplest (ergo cheapest) equivalent FSM. L14 Synchronous Logic 2

Housekeeping issues 1. Initialization? Clear the memory? inputs STATE s ROM or gates outputs NEXT s 2. Unused state encodings? - waste ROM (use PLA or gates) - meaning? 3. Synchronizing input changes with state update? That symbol doesn t register 4. Choosing encoding for state? L14 Synchronous Logic 21

2-Flavors of Processing Elements Combinational Logic: Table look-up, ROM i Addr Data o Fundamentally, everything that we ve learned so far can be done with a ROM and registers Finite State Machines: i o ROM with Feedback Memory s Addr Data Thus far, we know of nothing more powerful than an FSM L14 Synchronous Logic 22

FSMs as Programmable Machines The number of states that a bit can be set to: 1 or ROM-based FSM sketch: Given i, s, and o,we need a ROM organized as: 2 i+s words x (o+s) bits So how many possible i-input, o-output, FSMs with s-state bits exist? The number of bits in the ROM 2 (o+s)2i+s (some may be equivalent) s i 2 i+s An FSM s behavior is completely determined by its ROM contents. i...... 111 11...1 inputs s N outputs s N+1 o o L14 Synchronous Logic 23

GOAL: List all possible FSMs in some canonical order. INFINITE list, but Every FSM has an entry in and an associated index. i...1 inputs s N...... 111 11 FSM Enumeration outputs o s N+1 i s o FSM# Truth Table 1 1 1 1 1 1 1 2 1 1 1 1 256 11111111 2 2 2 257 2 2 2 258 1 18,446,744,73,79,551,872 3 3 3 4 4 4 These FSMs have 2 inputs and 2 outputs, or 8- bits in their ROM. 2 8 FSMs 2 64 Every possible FSM can be associated with a unique number. This requires a few wasteful simplifications. First, given an i-input, s-state-bit, and o-output FSM, we ll replace it with its equivalent n-input, n-state-bit and n-output FSM, where n is the greatest of i, s, and o. We can always ignore the extra input-bits, and set the extra output bits to. This allows us to discuss the i th FSM L14 Synchronous Logic 24

FSM 837 FSM 177 FSM 1537 FSM 89143 Some Perennial Favorites... modulo 3 counter 4-bit counter Combination lock Cheap digital watch FSM 22698469884 Intel Pentium CPU rev 1 FSM 784362783 Intel Pentium CPU rev 2 FSM 784363783 Intel Pentium II CPU L14 Synchronous Logic 25

Are FSMs the Ultimate Computation Device? Nope! There exist many simple problems that cannot be computed by FSMs. For instance: Checking for balanced parenthesis (()(()())) - Okay (()())) - No good! PROBLEM: Requires ARBITRARILY many states, depending on input. Must "COUNT" unmatched LEFT parens. An FSM can only keep track of a finite number of objects. Is there a machine that can solve this problem? L14 Synchronous Logic 26

Unbounded-Space Computation 1 1 1 1 S 1,(1,R) 1,(1,L),(1,L) 1,Halt S 2 DURING 192s & 193s, much of the science part of computer science was being developed (long before actual electronic computers existed). Many different Models of Computation were proposed, and the classes of functions which could be computed by each were analyzed. One of these models was the TURING MACHINE, named after Alan Turing. Alan Turing A Turing Machine is just an FSM which receives its inputs and writes outputs onto an infinite tape... This simple addition solves "FINITE" problem of FSMs. L14 Synchronous Logic 27

A Turing Machine Example Turing Machine Specification Doubly-infinite tape Discrete symbol positions Finite alphabet say {, 1} Control FSM INPUTS: Current symbol OUTPUTS: write /1 move Left/Right Initial Starting State {S} Halt State {Halt} Current State A Turing machine, like an FSM, can be specified with a truth table. The following Turing Machine implements a unary (base 1) incrementer. Tape Input Write Tape Move Next State S 1 1 R S S 1 L S1 S1 1 1 L S1 S1 R Halt 1 1 1 1 1 L14 Synchronous Logic 28

Turing Machine Tapes as Integers Canonical names for bounded tape configurations: b 8 b 6 b 4 b 2 b b 1 b 3 b 5 b 7 1 1 1 FSM i Look, it s just FSM i operating on tape j L14 Synchronous Logic 29

TMs as Integer Functions Turing Machine T i operating on Tape x, where x = b 8 b 7 b 6 b 5 b 4 b 3 b 2 b 1 b y = T [x] i x: input tape configuration y: output tape when TM halts I wonder if a TM can compute EVERY integer function... L14 Synchronous Logic 3

Alternative Models of Computation Turing Machines [Turing] 1 1 1 FSM i Hardware head Recursive Functions [Kleene] F(,x) x F(1+y,x) 1+F(x,y) (define (fact n) (... (fact (- n 1))...) Theory head Turing Lambda calculus [Church, Curry, Rosser...] Math head λx.λy.xxy (lambda(x)(lambda(y)(x (x y)))) Kleene Production Systems [Post, Markov] Language head α β IF pulse= THEN patient=dead Church Post L14 Synchronous Logic 31

The 1 st Computer Industry Shakeout Here s a TM that computes SQUARE ROOT! 1 1 1 FSM L14 Synchronous Logic 32

And the Battles Raged Here s a Lambda Expression that does the same thing... (λ(x)...)... and here s one that computes the n th root for ANY n! (λ(x n)...) L14 Synchronous Logic 33

Fundamental Result: Computable Functions Each model is capable of computing exactly the same set of integer functions! Proof Technique: BIG IDEA: Constructions that translate between models Computability, independent of computation scheme chosen Does,this mean that we know of no computer that is more powerful than a Turing machine? Church's Thesis: Every discrete function computable by ANY realizable machine is computable by some Turing machine. L14 Synchronous Logic 34

Computable Functions f(x) computable <=> for some k, all x: f(x) = T K [x] f K (x) Representation tricks: to compute f k (x,y) <x,y> integer whose even bits come from x, and whose odd bits come from y; whence f 12345 (x,y) = x * y f K (x, y) T K [<x, y>] f 23456 (x) = 1 iff x is prime, else L14 Synchronous Logic 35

Enumeration of Computable functions Conceptual table of TM behaviors... VERTICAL AXIS: Enumeration of TMs. HORIZONTAL AXIS: Enumeration of input tapes. (j, k) entry = result of TM k [j] -- integer, or * if never halts. f i f f 1 f k f i () f i (1) f i (2) f i (j) X 1 X 1 * X X 1 X 37 23 62 * f k (j) Is every Integer Function that I can precisely specify computable? The Halting Problem: Given j, k: Does TM k Halt with input j? L14 Synchronous Logic 36

The Halting Problem The Halting Function: T H [k, j] = 1 iff TM k [j] halts, else Can a Turing machine compute this function? Replace the Halt state of TH with this. Suppose, for a moment, T H exists: 1 iff Tx[y] HALTS otherwise Then we can build a T Nasty : T H x y If T H is computable then so is T Nasty 1,(1,L) -,(,R) N 2 N 1,(,L) LOOP HALT 1? T H k N H T Nasty [k] LOOP if T k [k] = 1 (halts) HALT if T k [k] = (loops) L14 Synchronous Logic 37

What does T Nasty [Nasty] do? Answer: T Nasty [Nasty] loops if T Nasty [Nasty] halts T Nasty [Nasty] halts if T Nasty [Nasty] loops That s a contradiction. Thus, T H is uncomputable by a Turing Machine! Net Result: There are some questions that Turing Machines simply cannot answer. Since, we know of no better model of computation than a Turing machine, this implies that there are some questions that defy computation. L14 Synchronous Logic 38

Reality: Limits of Turing Machines A Turing machine is formal abstraction that addresses Fundamental Limits of Computability What is means to compute. The existence of incomputable functions. We know of no machine more powerful than a Turing machine in terms of the functions that it can compute. But they ignore Practical coding of programs Performance Implementability Programmability... these latter issues are the primary focus of contemporary computer science (Remainder of Comp 411) L14 Synchronous Logic 39