Exercise Q3.17 Design an FSM to keep track of the mood of four students working in the digital design lab. Each Student is either: 1. Happy (the circuit.

Slides:



Advertisements
Similar presentations
General Sequential Design
Advertisements

Counters. In class excercise How to implement a “counter”, which will count as 0,3,1,4,5,7,0,3,1,…… Q2Q1Q0D2D1D
TOPIC : Finite State Machine(FSM) and Flow Tables UNIT 1 : Modeling Module 1.4 : Modeling Sequential circuits.
COE 202: Digital Logic Design Sequential Circuits Part 3
Sequential Circuit Analysis & Design Dr. Aiman H. El-Maleh Computer Engineering Department King Fahd University of Petroleum & Minerals Dr. Aiman H. El-Maleh.
Sequential Circuit Design
ECE 331 – Digital System Design
ECE C03 Lecture 111 Lecture 11 Finite State Machine Optimization Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
ECE C03 Lecture 131 Lecture 13 Finite State Machine Optimization Prith Banerjee ECE C03 Advanced Digital Design Spring 1998.
Sequential Circuits and Finite State Machines Prof. Sin-Min Lee
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
Spring 2002EECS150 - Lec15-seq2 Page 1 EECS150 - Digital Design Lecture 15 - Sequential Circuits II (Finite State Machines revisited) March 14, 2002 John.
Synchronous circuit design and analysis. Synchronous circuit design To implement a synchronous circuit corresponding to a given specification Revision.
Contemporary Logic Design FSM Optimization © R.H. Katz Transparency No Chapter #9: Finite State Machine 9.4 Choosing Flip-Flops 9.5 Machine Partitioning.
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)
A.Abhari CPS2131 Registers A register is a group of n flip-flops each of them capable of storing one bit of information There are two types of registers:
Introduction to Sequential Design. Types of Logic Circuits  Logic circuits can be: Combinational Logic Circuits-outputs depend only on current inputs.
Sequential circuit design
FAMU-FSU College of Engineering EEL 3705 / 3705L Digital Logic Design Fall 2006 Instructor: Dr. Michael Frank Module #8: Introduction to Sequential Logic.
1 Lecture 15 Registers Counters 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.
Rabie A. Ramadan Lecture 2
1 COMP541 State Machines Montek Singh Feb 8, 2012.
Elevator Controller We’re hired to design a digital elevator controller for a four-floor building st try: Design a counter that counts up.
Rabie A. Ramadan Lecture 3
Sequential Logic Materials taken from: Digital Design and Computer Architecture by David and Sarah Harris & The Essentials of Computer Organization and.
ECE 3130 – Digital Electronics and Design Lab 6 State Machines Fall 2012 Allan Guan.
Counters. In class excercise How to implement a “counter”, which will count as 0,3,1,4,5,7,0,3,1,…… Q2Q1Q0D2D1D
Computer Organization & Programming Chapter 5 Synchronous Components.
Lecture 9: Sequential Networks: Implementation CSE 140: Components and Design Techniques for Digital Systems Fall 2014 CK Cheng Dept. of Computer Science.
© BYU 13 COUNTERS Page 1 ECEn 224 COUNTERS Counters Transition Tables Moore Outputs Counter Timing.
Lecture 5. Sequential Logic 2 Prof. Taeweon Suh Computer Science Education Korea University 2010 R&E Computer System Education & Research.
DLD Lecture 26 Finite State Machine Design Procedure.
Digital Logic Design.
EEL-3705 TPS QUIZZES Chapters 6,7,8. Quiz 1 Quiz Design a FSM which implements the state equations given below.
1 A counter counts Number of elements in counter determines how many different states we need For example, an eight-state counter can count eight steps.
DESIGN OF SEQUENTIAL CIRCUITS by Dr. Amin Danial Asham.
1Sequential circuit design Acknowledgement: Most of the following slides are adapted from Prof. Kale's slides at UIUC, USA by Erol Sahin and Ruken Cakici.
Learning to Design Counters
Counters Transition Tables Moore Outputs Counter Timing
ECE 448 Lecture 6 Finite State Machines State Diagrams vs. Algorithmic State Machine (ASM) Charts.
Sequential Circuit Design 05 Acknowledgement: Most of the following slides are adapted from Prof. Kale's slides at UIUC, USA.
1 Registers A register is a group of n flip-flops each of them capable of storing one bit of information There are two types of registers: parallel and.
George Mason University Finite State Machines Refresher ECE 545 Lecture 11.
Lecture 4. Sequential Logic #2
EEL 3705 / 3705L Digital Logic Design
FINITE STATE MACHINES (FSMs)
Sequential circuit design
ECE 3130 – Digital Electronics and Design
EEL 3705 / 3705L Digital Logic Design
CSE 370 – Winter Sequential Logic-2 - 1
Sequential circuit design
Lecture 17 Logistics Last lecture Today HW5 due on Wednesday
Finite State Machines.
DESIGN OF SEQUENTIAL CIRCUITS
ECE 352 Digital System Fundamentals
Chapter5: Synchronous Sequential Logic – Part 4
Counters.
Lecture 17 Logistics Last lecture Today HW5 due on Wednesday
Instructor: Alexander Stoytchev
ECE 352 Digital System Fundamentals
EGR 2131 Unit 12 Synchronous Sequential Circuits
ECE 352 Digital System Fundamentals
Announcements Assignment 7 due now or tommorrow Assignment 8 posted
Chapter5: Synchronous Sequential Logic – Part 3
CSE 370 – Winter Sequential Logic-2 - 1
COE 202: Digital Logic Design Sequential Circuits Part 3
Presentation transcript:

Exercise Q3.17 Design an FSM to keep track of the mood of four students working in the digital design lab. Each Student is either: 1. Happy (the circuit works) 2. Sad (the circuit blew up) 3. Busy (working on the circuit) 4. Clueless (confused about the circuit) 5. Asleep (face down on the circuit board) How many states does the FSM have ? What is the minimum number of bits necessary to represent these states ?

Each Student can either be: 1. Happy (the circuit works). 2. Sad (the circuit blew up). 3. Busy (working on the circuit). 4. Clueless (confused about the circuit). 5. Asleep (face down on the circuit board). So each student can be in five different states. Hence, we can say that overall we have 625 distinct states (5 possible states for 4 students, 5 4 = 625). For 625 distinct states, we need a minimum of ceiling(log 2 625) = 10 bits. Exercise Q3.17 Solution

Exercise Q3.22 Design an FSM that recognizes 1101 or – Draw state transition diagram (use as few states as possible). – Choose state encodings. – Write state transition and output table using the encodings. – Write next state equations and output equations.

Exercise Q3.22 Solutuon “ ” 0 “1” 0 “11” 0 “110” 0 “1101” 1 “111” 0 “1110” Reset

“ ” 0 “1” 0 “11” 0 “110” 0 “1101” 1 “111” 0 “1110” Reset State encoding: A = 000 ; B = 001 ; C = 010 ; D = 011; E = 100 ; F = 101 ; G = 110

State transition and output table: Present State S2 S1 S0 X = 0X = 1 F NS S2+ S1+ S0+ NS S2+ S1+ S

K-Maps: XX 0010 S0+ S0 X S2 S S0+ = S0’.S1.S2’ + X.S0’.S2’ + X.S0.S XX 0101 S1+ S0 X S2 S S1+ = X.S0.S1’.S2’ + X’.S0’.S1.S2’ + X.S0’.S1’.S2 + X’.S0.S XX 0011 S2+ S0 X S2 S S2+ = S0.S2 + X.S X 10 F S0 X S2 S F = S0’.S2

Interview Q 3.1 (textbook) Design an FSM that recognizes when it is received serially. “1” “0” “01” “010” “0101” “ Reset

Exercise Q3.27 (textbook) Design an FSM with one input, A, and two outputs, X and Y. X should be 1 if A has been 1 for at least three cycles altogether (not necessarily consecutively). Y should be 1 if A has been 1 for at least two consecutive cycles. Show your state transition diagram, encoded state transition table, next state and output equations, and schematic.

Important : Understand the problem correctly X should be 1 if A has been 1 for at least three cycles altogether (not necessarily consecutively). Y should be 1 if A has been 1 for at least two consecutive cycles. Sample Pattern1 (assuming Moore Machine, output is 1 cycle delayed) Input A Output Y Output X Sample Pattern2 A Y X Sample Pattern3 A Y X Sample Pattern4 A Y X

0 A ---- X = 0 Y = 0 0 B ---- X = 0 Y = 0 0 C X = 0 Y = A ---- X = 0 Y = 0 1 B ---- X = 0 Y = 0 1 C X = 1 Y = A ---- X = 0 Y = 0 2 B ---- X = 1 Y = 0 2 C X = 1 Y = A ---- X = 1 Y = 0 +3 B ---- X = 1 Y = 0 +3 C X = 1 Y = ― ― ― Are there any equivalent states? Redundant/Equivalent states are those which can not be observed/distinguished from the FSM I/O behavior

0 A ---- X = 0 Y = 0 0 B ---- X = 0 Y = 0 0 C X = 0 Y = A ---- X = 0 Y = 0 1 B ---- X = 0 Y = 0 1 C X = 1 Y = A ---- X = 0 Y = 0 2 B ---- X = 1 Y = 0 2 C X = 1 Y = A ---- X = 1 Y = 0 +3 B ---- X = 1 Y = 0 +3 C X = 1 Y = ― ― ― Combining equivalent states 1c, 2c, 3c Reason : once these states are reached, output is always X=1, Y=1 for any input sequence.

0 A ---- X = 0 Y = 0 0 B ---- X = 0 Y = 0 0 C X = 0 Y = A ---- X = 0 Y = 0 1 B ---- X = 0 Y = 0 1 C X = 1 Y = ― 2 A ---- X = 0 Y = 0 2 B ---- X = 1 Y = A ---- X = 1 Y = 0 +3 B ---- X = 1 Y = Are there any more equivalent states? Explicit Equivalence: Two states are equivalent if outputs, Next states are identical for all input combinations.

0 A ---- X = 0 Y = 0 0 B ---- X = 0 Y = 0 0 C X = 0 Y = A ---- X = 0 Y = 0 1 B ---- X = 0 Y = 0 1 C X = 1 Y = ― 2 A ---- X = 0 Y = 0 2 B ---- X = 1 Y = A ---- X = 1 Y = 0 +3 B ---- X = 1 Y = Combining equivalent states 2b, 3b Reason : Next states, outputs are identical for all input combinations.

Common Mistake in Midterm2 Many got B = C = F, but didn’t get E = G Their state table looked like this. Present State Next State I=0 I=1 Output I = 0 I = 1 AAB00 BBE11 DBA00 EBD10 GBD10 Explicit Equivalence E = G.

0 A ---- X = 0 Y = 0 0 B ---- X = 0 Y = 0 0 C X = 0 Y = A ---- X = 0 Y = 0 1 B ---- X = 0 Y = 0 1 C X = 1 Y = ― 2 A ---- X = 0 Y = 0 2 B ---- X = 1 Y = A ---- X = 1 Y =

Another approach is to design an FSM for X (FSM-X) and a separate FSM for Y (FSM-Y) Then “simulate” the execution from the “initial states”

V A ---- X = 0 V B ---- X = V C X = 0 V D X = S A ---- Y = 0 S B ---- Y = 0 S C Y = FSM-X FSM-Y ― ―

V B S A ---- X = 0 Y = 0 0 V A S A ---- X = 0 Y = 0 V B S B ---- X = 0 Y = 0 V C S C X = 0 Y = V D S C X = 1 Y = 1 ― V C S B ---- X = 0 Y = V C S A ---- X = 0 Y = 0 V D S B ---- X = 1 Y = 0 V D S C X = 1 Y = V D S A ---- X = 1 Y = 0 V D S B ---- X = 1 Y = 0 V D S C X = 1 Y = ― ―

V B S A ---- X = 0 Y = 0 0 V A S A ---- X = 0 Y = 0 V B S B ---- X = 0 Y = 0 V C S C X = 0 Y = V D S C X = 1 Y = 1 ― V C S B ---- X = 0 Y = V C S A ---- X = 0 Y = 0 V D S B ---- X = 1 Y = 0 V D S C X = 1 Y = V D S A ---- X = 1 Y = 0 V D S B ---- X = 1 Y = 0 V D S C X = 1 Y = ― ―

V B S A ---- X = 0 Y = 0 0 V A S A ---- X = 0 Y = 0 V B S B ---- X = 0 Y = 0 V C S C X = 0 Y = V D S C X = 1 Y = 1 ― V C S B ---- X = 0 Y = V C S A ---- X = 0 Y = 0 V D S B ---- X = 1 Y = V D S A ---- X = 1 Y =

Can also synthesize an FSM for X (FSM-X) and an FSM for Y (FSM-Y) separately (although this is different than what’s asked in this question)

V A ---- X = 0 V B ---- X = V C X = 0 V D X = S A ---- Y = 0 S B ---- Y = 0 S C Y = FSM-X FSM-Y ― ―

State transition and output table, K-Maps for X, V1+, V0+ (for FSM-X) V1+ A V1 V V1+ = V1 + V0.A V0+ A V1 V V0+ = V0.A’ + V1V0 + V0’.A Y V0 V Y = V1.V0 Present State V1 V0 A = 0A = 1 X NS V1+ V0+ NS V1+ V0+ V A = V B = V C = V D =

Schematic for X, V1, V0 DFF DFF V1 X V0 V0+ V1+ A

State transition and output table, K-Maps for Y, S1+, S0+ (for FSM-Y) XX 11 S1+ A S1 S S1+ = S1 + S0.A XX 00 S0+ A S1 S S0+ = A.S0’.S1’ 00 1X Y S0 S Y = S1 Present State S1 S0 A = 0A = 1 Y NS S1+ S0+ NS S1+ S0+ S A = S B = S C =

Schematic for Y, S1, S0 DFF DFF S1Y S0 S0+ S1+ A

State transition and output table, K-Maps for Y, S1+, S0+ (for FSM-Y) : Using a different State Assignment for Sc. (Using 11 instead of 10) This helps in reducing the number of literals required to compute S0+. (requires 2 literals instead of 3) Efficient State Assignment problem is sometimes taken care of by EDA tools XX S1+ A S1 S S1+ = S1 + S0.A XX S0+ A S1 S S0+ = S1 + A 00 X1 Y S0 S Y = S1 Present State S1 S0 A = 0A = 1 Y NS S1+ S0+ NS S1+ S0+ S A = S B = S C =

Can also directly implement using datapath (e.g. counters and shift registers) – all FF’s initialize to “0”. One possible way is as given here. Other methods of implementations also exist. + 2 MUX 2 1 “01” bit D-FFs 2-input AND X (counts to 3 and remains at 3) A (shifts to “11” and remains at “11”) FF MUX FF MUX Y 1010