ece122 – lab 6 state machines

10
University School of Engineering and Applied Science Department of Electrical and Computer Engineering ECE122 – Lab 6 State Machines Ritu Bajpai Last revised on October 07, 2009

Upload: shea-nash

Post on 31-Dec-2015

30 views

Category:

Documents


0 download

DESCRIPTION

The George Washington University School of Engineering and Applied Science Department of Electrical and Computer Engineering. ECE122 – Lab 6 State Machines. Ritu Bajpai Last revised on October 07, 2009. Introduction. State table gives a time sequence of inputs, outputs and flip flop states. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: ECE122 – Lab 6 State Machines

The George Washington UniversitySchool of Engineering and Applied Science

Department of Electrical and Computer Engineering

ECE122 – Lab 6

State Machines

Ritu Bajpai

Last revised on October 07, 2009

Page 2: ECE122 – Lab 6 State Machines

Introduction

• State table gives a time sequence of inputs, outputs and flip flop states.

• The information presented in the state table is graphically represented in a state diagram.

• A state equation is an algebraic expression that specifies the conditions for a flip-flop state transition.

Page 3: ECE122 – Lab 6 State Machines

Mealy and Moore State Machines

• Mealy state machine has less number of states and the output depends on the input

• Moore state machine, output only depends on the state

Page 4: ECE122 – Lab 6 State Machines

Problem for the lab

• Design Mealy and Moore machine to detect the sequence 1010 in a bit pattern.

• Draw state table

• Implement mealy state machine using D flip flops

Page 5: ECE122 – Lab 6 State Machines

Mealy state machine

S1

S2

S3

S4Reset/0

1/0

0/0 0/0

1/0

1/00/0 0/11/0

Present State

Next State Output

Input=0 Input=1 Input=0 Input=1

S1 (00) S1 (00) S2(01) 0 0

S2 (01) S3 (10) S2 (01) 0 0

S3 (10) S1 (00) S4 (11) 0 0

S4 (11) S3 (10) S2 (01) 1 0

Page 6: ECE122 – Lab 6 State Machines

Moore state machine

S1/0

S2/0S3/0

S4/0Reset

10

0

1

101

S5/1 00

1

Present State

Next State Output

Input=0 Input=1

S1 (000) S1(000) S2(001) 0

S2 (001) S3(010) S2(001) 0

S3 (010) S1(000) S4(011) 0

S4 (011) S3(010) S2(001) 0

S5 (100) S1(000) S4(011) 1

Page 7: ECE122 – Lab 6 State Machines

Implementation of Mealy SM using DFF

Inputs of combinational circuit

Output of combinational circuit

Present state Input Next state Flip flop inputs

output

A B x A B DA DB y

0 0 0 0 0 0 0 0

0 0 1 0 1 0 1 0

0 1 0 1 0 1 0 0

0 1 1 0 1 0 1 0

1 0 0 0 0 0 0 0

1 0 1 1 1 1 1 0

1 1 0 1 0 1 0 1

1 1 1 0 1 0 1 0

Page 8: ECE122 – Lab 6 State Machines

State equations

x/AB 00 01 11 10

0 0 1 1 0

1 0 0 0 1

DA=x’B+xAB’

y=ABx’

x/AB 00 01 11 10

0 0 0 0 0

1 1 1 1 1

DB=x

Page 9: ECE122 – Lab 6 State Machines

Implementation

Page 10: ECE122 – Lab 6 State Machines

Output response

QA

QB

y

nQA

Clear

nQB

Clock

x