Elevator Controller We’re hired to design a digital elevator controller for a four-floor building 00 01 10 11 1st try: Design a counter that counts up.

Slides:



Advertisements
Similar presentations
ENGIN112 L23: Finite State Machine Design Procedure October 27, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 23 Finite State Machine.
Advertisements

Chapter #8: Finite State Machine Design Contemporary Logic Design
General Sequential Design
Finite State Machines (FSMs)
Counters. In class excercise How to implement a “counter”, which will count as 0,3,1,4,5,7,0,3,1,…… Q2Q1Q0D2D1D
Circuits require memory to store intermediate data
CS 151 Digital Systems Design Lecture 25 State Reduction and Assignment.
Sequential Circuit Design
ECE C03 Lecture 101 Lecture 10 Finite State Machine Design Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
Contemporary Logic Design Finite State Machine Design © R.H. Katz Transparency No Chapter #8: Finite State Machine Design 8.5 Finite State Machine.
Give qualifications of instructors: DAP
Contemporary Logic Design Finite State Machine Design © R.H. Katz Transparency No Chapter #8: Finite State Machine Design Finite State.
Sequential Circuit Design
ECE C03 Lecture 121 Lecture 12 Finite State Machine Design Prith Banerjee ECE C03 Advanced Digital Design Spring 1998.
Spring 2002EECS150 - Lec0-intro Page 1 EECS150 - Digital Design Lecture 9 - Finite State Machines 1 February 19, 2002 John Wawrzynek.
Spring 2002EECS150 - Lec15-seq2 Page 1 EECS150 - Digital Design Lecture 15 - Sequential Circuits II (Finite State Machines revisited) March 14, 2002 John.
VII - Finite State Machines © Copyright 2004, Gaetano Borriello and Randy H. Katz 1 Finite State Machines Sequential circuits  primitive sequential elements.
ECE 301 – Digital Electronics Introduction to Sequential Logic Circuits (aka. Finite State Machines) and FSM Analysis (Lecture #17)
ECE 331 – Digital Systems Design Introduction to Sequential Logic Circuits (aka. Finite State Machines) and FSM Analysis (Lecture #19)
ENGIN112 L25: State Reduction and Assignment October 31, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 25 State Reduction and Assignment.
Lecture 21 Overview Counters Sequential logic design.
1 Lecture 15 Registers Counters Finite State Machine (FSM) design.
1 Sequential Circuits Registers and Counters. 2 Master Slave Flip Flops.
Lecture 17 General finite state machine (FSM) design
Lecture 8: Sequential Networks and Finite State Machines CSE 140: Components and Design Techniques for Digital Systems Fall 2014 CK Cheng Dept. of Computer.
ELEC 256 / Saif Zahir UBC / 2000 Counters An (up/down) k-bit counter produces a sequence of k-bit binary numbers in a response to a COUNT pulse. A k-bit.
SEQUENTIAL CIRCUITS Introduction
ECE 368: CAD-Based Logic Design Lecture Notes # 5
1 COMP541 State Machines Montek Singh Feb 8, 2012.
ECE C03 Lecture 101 Lecture 10 Finite State Machine Design Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
1 EECS 465: Digital Systems Lecture Notes # 8 Sequential Circuit (Finite-State Machine) Design SHANTANU DUTT Department of Electrical and Computer Engineering.
Sequential Logic Materials taken from: Digital Design and Computer Architecture by David and Sarah Harris & The Essentials of Computer Organization and.
Chapter #8: Finite State Machine Design
VII - Finite State Machines © Copyright 2004, Gaetano Borriello and Randy H. Katz 1 Finite State Machines (FSM) Sequential circuits  primitive sequential.
Hussein Bin Sama && Tareq Alawneh
ECNG1014 Digital Electronics
Lecture 18 More Moore/Mealy machines.
1 Lecture 22 State encoding  One-hot encoding  Output encoding State partitioning.
Introduction to Sequential Logic Design Finite State-Machine Design.
1 CSE370, Lecture 19 Lecture 19 u Logistics n Lab 8 this week to be done in pairs íFind a partner before your lab period íOtherwise you will have to wait.
1 CSE370, Lecture 15 Lecture 15 u Logistics n HW5 due this Friday n HW6 out today, due Friday Feb 20 n I will be away Friday, so no office hour n Bruce.
Introduction to State Machine
Counters. In class excercise How to implement a “counter”, which will count as 0,3,1,4,5,7,0,3,1,…… Q2Q1Q0D2D1D
DLD Lecture 26 Finite State Machine Design Procedure.
Digital Logic Design.
1 Finite State Machines (FSMs) Now that we understand sequential circuits, we can use them to build: Synchronous (Clocked) Finite State Machines Finite.
State Table Problem #1 An electronic lock is controlled by a keypad, which has three buttons labeled A, B, and R. The keypad is restricted such that, at.
 Seattle Pacific University EE Logic System DesignCounters-1 Shift Registers DQ clk DQ DQ ShiftIn Q3Q3 Q2Q2 DQ Q1Q1 Q0Q0 A shift register shifts.

1 COMP541 Finite State Machines - 1 Montek Singh Sep 22, 2014.
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Logic Design Dr. Oliver Faust.
1 COMP541 Sequential Logic – 2: Finite State Machines Montek Singh Feb 29, 2016.
Chapter #6: Sequential Logic Design
© Copyright 2004, Gaetano Borriello and Randy H. Katz
Digital Electronics Tutorial: Sequential Logic
Instructor: Alexander Stoytchev
Synchronous Sequential Circuit Design
Instructor: Alexander Stoytchev
CSE 370 – Winter Sequential Logic-2 - 1
Introduction to Sequential Circuits
CSE 370 – Winter Sequential Logic-2 - 1
Lecture 17 Logistics Last lecture Today HW5 due on Wednesday
Finite State Machines.
ECE 465: Digital Systems Lecture Notes # 8
CSE 370 – Winter Sequential Logic-2 - 1
Counters.
Lecture 17 Logistics Last lecture Today HW5 due on Wednesday
Lecture 18 Logistics Last Lecture Today HW6 due today Midterm 2
Lecture 22 Logistics Last lecture Today HW7 is due on Friday
Lecture 22 Logistics Last lecture Today HW7 is due on Friday
Presentation transcript:

Elevator Controller We’re hired to design a digital elevator controller for a four-floor building 00 01 10 11 1st try: Design a counter that counts up and down 00, 01, 10, 11, 10, 01, 00, ... Problem: Never stops! 2nd try: Add “Stop” button that disables counter Problem: Have to press button when elevator happens by We need a way to have user inputs into a complex system

Finite State Machines Counters - Next state based on current state If counter is in state ‘101’, next state is ‘110’ No inputs (other than reset, enable) Finite State Machines Next state is a function of the current state and the inputs If the elevator is on floor 00 and the UP button is pressed on floor 10, then move to floor 01 If current state is 00  If UP2, Next state is 01

A Finite State Machine Inputs Clock Current State Next State Next floor/ direction Current floor/ direction Combinational Logic For Next State Comb. Logic For Outputs State FlipFlops Clock Current State Next State Motor/Door Controls Example shown for elevator controller Elevator Buttons Inputs

Gumball Machine We’re building a gumball machine 15 cents for a gumball Machine has a single slot, which can take dimes or nickels Subcontractor provides a coin sensor, which has two outputs: N is true if a nickel was input D is true if a dime was input We must provide the output Open when 15 cents entered Gumball Machine FSM N D Reset Clk Open Coin Sensor Candy Release Mechanism

Gumball Machine Tabulate typical input sequences: three nickels Reset N’D’ Diagram what is going on in a state diagram S0 Note: No change provided! Tabulate typical input sequences: three nickels nickel, dime two nickels, dime two dimes dime, nickel N D N’D’ N’D’ S1 S2 D N D N N’D’ S3 [open=1] S4 [open=1] S5 [open=1] S6 Draw state diagram: Inputs: N, D, reset Output: open N’D’ S0 N S1 D S2 N’D’ S0 N S1 D S2 N’D’ S0 N S1 D S2 N D [open=1] S7 [open=1] S8 N’D’ S0 N S1 D S2 N’D’ S0 N S1 D S2 Output (open) indicated during states in which is is asserted

A More Efficient Solution 10¢ 1 5¢ 15+¢ 0¢ Q+ Next State N Input D Input Q Current State Q Current State Open Output 0¢ 5¢ 10¢ 15+¢ 1 Reset 0¢ N’D’ 0¢ N’D’ D 5¢ N N’D’ 10¢ 5¢ X N D 5¢ N 10¢ N’D’ 10¢ 15+¢ Output Table X D N+D 10¢ 15+¢ [open=1] 15+¢ 15+¢ X Reuse states whenever possible 0¢ 5¢ 10¢ Symbolic State Table X

Gumball Machine State Table Q1Q0 Current State 1 Q1+Q0+ Next State N Input D Input Q1Q0 Current State Open Output 1 Encode states into binary numbers Calculate total number of states: 4 (0¢, 5¢, 10¢, 15¢) Use as many bits as needed for the states 4 states --> 2 bits Encoding: 0¢: 00 5¢: 01 10¢: 10 15+¢: 11 1 X 1 Output Table Encoded State Table

Gumball Machine Implementation Q1Q0 DN 00 01 11 10 Q1 Q0 D N D1 Q1Q0 DN 00 01 11 10 Q1 Q0 D N D0 If we chose D FF’s, we don’t have to convert Q’s to FF inputs 1 x 1 x D1= D + NQ0Q1’ + Q0’Q1 Q1Q0 Current State Open Output 1 D2= NQ0’ + N’Q1’Q0 + NQ1 + DQ1Q0’ Open = Q1Q0 Note that the output is a function of only the state

Inputs FSMs change state based on clock edges I.e. Rising clock edge clocks all FFs This part can change only when clock “ticks” Combinational Logic For Next State Comb. Logic For Outputs State FlipFlops Clock Inputs Synchronous Inputs: Change in synch with the clock. Obey setup and hold time. This part can change at any time Asynchronous Inputs: Change at any time. May violate setup and hold times.

Asynchronous vs. Synchronous Inputs Example: Elevator pushbuttons Arrive at any time Usually asserted for many clock cycles FSM logic must not make any assumptions about input timing Example: Data arriving on a serial line from a computer Arrive synchronized exactly to a clock One bit of data per clock cycle FSM can assume that data changes once per clock cycle

Parity Checker Assert output (parity) whenever input bit stream (synchronous) has odd # of 1's 1 Clk Input Output Reset State Diagram In’ Q Present State In Input Q+ Next State Even 1 Odd Even [0] Q Present State Parity Output Even Odd 1 In In Odd [1] Parity = Q In’ Q+ = Q Å In

Parity Checker Q+ = Q Å In Parity = Q In T Q Pre Clr Parity In Reset D Q Clr Parity Reset D FF Implementation T FF Implementation Parity Checking is a type of Synchronous Serial Input FSM A single input Input is synchronized with clock (1 bit per clock cycle) Goal is to look for patterns in the input bit stream

Pattern Matcher A string recognizer has one synchronous input (X) and one output (Z). The output is asserted whenever the input sequence …010… has been observed, as long as the sequence …100… has never been seen. This is a synchronous serial input problem Sample input/output behavior: 1. Work though sample inputs to understand problem X: 1 1 1 1 1 1 Z: 1 2. Develop FSM to recognize patterns X: 1 1 1 1 3. Implement using standard techniques Z: 1 1 1

Pattern Matcher 1 1 1 1 1 1 0+1 Pick a reset state. Draw paths for strings to recognize (010 and 100) Fill in all of the missing transitions (each state needs a path out for 0 and 1) Reset signal places FSM in S0 Reset S0 [0] 1 ...0 ...1 State S3: have recognized …010 if next input is 0 then have …0100 (state S6) if next input is 1 then have …0101 = …01 (state S2) S1 [0] S4 [0] 1 1 1 State S1: recognizes strings of form …0 (no 1 seen) loop back to S1 if input is 0 ...10 S2 [0] S5 [0] 1 ...01 State S4: recognizes strings of form …1 (no 0 seen) loop back to S4 if input is 1 1 S3 [1] S6 [0] ...100 State S2: if input is 1, then have …1 (state S4) 0+1 Outputs 1 State S5: recognizes …10 if input is 1, then have …01 (state S2) ...010 Loops in State

Pattern Matcher - Implementation S0 [0] S1 S2 S3 [1] S4 S5 S6 0+1 Reset 1 000 Current State Input Next State Q2 Q1 Q0 X 1 100 001 101 010 110 011 Assign each state a binary number Make the state transition table Make the output table

Pattern Matcher - Implementation S0 [0] S1 S2 S3 [1] S4 S5 S6 0+1 Reset 1 000 001 010 011 110 101 100 Current State Output Q2 Q1 Q0 Z 1 X Build the FSM: Use three FF’s Build next state logic based on state transition table Build output logic based on output table Assign each state a binary number Make the state transition table Make the output table