Finite State Automata and Flip-Flops: Implementing FSAs using Flip-Flops, Slides of Computer Science

The concept of finite state automata (fsa) and how they can be implemented using flip-flops. It covers the basics of fsas, their states, and the use of flip-flops as one-bit memories to remember the current state. The document also includes examples of d flip-flops and their role in fsa implementation.

Typology: Slides

2012/2013

Uploaded on 03/22/2013

dhrupad
dhrupad 🇮🇳

4.4

(17)

213 documents

1 / 9

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
FiniteFinite StateStateFinite Finite State State
Machine Machine DesignDesign
Intro to Computer Architecture
Flip-Flops and Finite State Automata
Finite State Automata (FSA) have states.
The system has to remember the current
state.
Flip-Flops are one bit memories.
Flip-Flops can be used to remember the
current
state
of
an
FSA
current
state
of
an
FSA
.
A sequential logic circuit using Flip-Flops
can implement an FSA.
D Flip-Flop
A D flip-flop has
ldt
CDQ
next Comment
0
X
No change
on
l
y one
d
a
t
a
input, D, plus
enable, C
0
X
prev
No
change
1 0 0 Reset
11 1 Set
Clock
Many sequential logic circuits use a clock
input.
A flip-flop can change state on a clock
rising edge.
The new state will be available on the
falling edge.
Docsity.com
pf3
pf4
pf5
pf8
pf9

Partial preview of the text

Download Finite State Automata and Flip-Flops: Implementing FSAs using Flip-Flops and more Slides Computer Science in PDF only on Docsity!

FiniteFinite State

State

FiniteFinite State

State

MachineMachine Design

Design

Intro to Computer Architecture

Flip-Flops and Finite State Automata• Finite State Automata (FSA) have states.• The system has to remember the current

state.

  • Flip-Flops are one bit memories.• Flip-Flops can be used to remember the

current state of an FSAcurrent state of an FSA.

  • A sequential logic circuit using Flip-Flops

can implement an FSA.

D Flip-Flop

  • A D flip-flop has

l^

d t

C

D

Q

next

Comment

0

X

Q

No change

only one datainput, D, plusenable, C

0

X

Q

prev

No change

1

0

0

Reset

1

1

1

Set

Clock

  • Many sequential logic circuits use a clock

input.

  • A flip-flop can change state on a clock

rising edge.

  • The new state will be available on the

falling edge.

Docsity.com

Overview of Design Process

  1. Specifications start with a word description 2

C

t^

Fi it

St t

A t

t^

t^

d l

  1. Create a Finite State Automata to model

the system

  1. Create a state table to indicate next states4. Convert next states and outputs to output

d fli

fl

i^

t^

ti

and flip flop input equations

  1. Simplify logic expressions6. Draw resulting circuits

Example

  • Create a sequential circuit that detects

h

th

ti

1 i

t

when three or more consecutive 1 inputshave been received.

  • Inputs are checked each clock pulse.• The output will be true only when three or

more 1 inputs have been detectedmore 1 inputs have been detected.

  • The output will be false when zeroes and

less than three inputs of 1 have beenreceived.

FSA for 3 Consecutive 1 inputs

-^

State S

0

: zero 1s detected

-^

State S

1

: one 1 detected

-^

State S

2

: two 1s detected

-^

State S

3

: three 1s detected

° Note that each state has 2 output arrows

Moore Machine

  • With a Moore Finite State Automata, the

t^

t i

i t d

ith th

t t

f th

output is associated with the state of theFSA.

  • Often the new state will be available

during the second half of a clock pulse.

  • The output is related to the state and not• The output is related to the state and not

how the FSA got to the state.

  • In our example, state 3 (three consecutive

1’s) has an output of 1. All other are zero.

Docsity.com

Simplify Each Result

OldQ

1

OldQ

0

input

NewD

A

Q’

in’ 0

Q’

in 0

Q^0

in

Q

in’ 0

Q’

1

0

0

1

0

Q^1

0

1

1

0

p

0

0

0

0

0

0

1

0

0

1

0

0

0

1

1

1

1

0

0

0

1

0

0

0

1

0

1

1

1

1

0

0

1

1

1

1

new D

A^

= in * Q

1

  • Q

0

  • in

Simplify new D

B

OldQ

1

OldQ

0

input

NewD

B

Q’

in’ 0

Q’

in 0

Q

in 0

Q

in’ 0

Q’

1

0

1

0

0

Q

1

0

1

1

0

p

0

0

0

0

0

0

1

1

0

1

0

0

0

1

1

0

1

0

0

0

1

0

0

0

1

0

1

1

1

1

0

0

1

1

1

1

new D

B

= in * Q

1

  • Q’

0

  • in

Simplify Output

OldQ

1

OldQ

0

input

output

Q’

in’ 0

Q’

in 0

Q^0

in

Q

in’ 0

Q’

1

0

0

0

0

Q^1

0

0

1

1

p^

p

0

0

0

0

0

0

1

0

0

1

0

0

0

1

1

0

1

0

0

0

1

0

0

0

1

0

1

0

1

1

0

1

1

1

1

1

output = Q

1

  • Q

0

FSA implementation

Docsity.com

Flip-Flops Required

  • If there are

n

states in the FSA, it will

i^

l^

(^

) fli

fl

require log

n

)^

flip-flops.

  • If

n

is not an even power of two, you have

to round up.

  • When n is not an even power of two, the

truth table may have

“don’t care”

entries

truth

table may have

don t

care

entries

Example: Parity Checker

  • Even parity is when the count of the “1”

bit

i^

b

bits is an even number.

  • We want the output to be true when the

parity is even.

Parity FSA

  • The parity changes

h

1 i

i^

t

when a 1 is input

  • The parity stays the

same on 0 input.

How many flip-flops will be required

to implement the parity?

        1. none

Docsity.com

Regular Languages

  • A regular language can be recognized by

Fi it

St t

A t

t

a Finite State Automata.

  • Compilers use FSA to remove comments,

separate strings and numbers and dividethe input into a series of “tokens”.

Context Free Languages

  • Most computer languages, like Java, C++,

P

l^

d PHP

t^

t f

Pearl and PHP, are context freelanguages.

  • Context Free languages can be

recognized by a FSA with a stack memory.

Context Sensitive and R.E.

  • Context Sensitive languages and

R

i^

l^

E

bl

l

Recursively Enumerable languages canbe recognized by a Turing Machine.

  • A Turing Machine can compute anything

that a modern “real” computer can.

  • The Turing-Church thesis states:• The Turing-Church thesis states:

“Every function which would naturally beregarded as computable, can becomputed by a Turing machine”

Turing Machine

  • A Turing Machine has a FSA and a tape

for memory.

  • Based on the state of the FSA and the

current symbol on the tape, the TuringMachine can write a new symbol, movethe tape left or right and change the stateof the FSAof the FSA.

Docsity.com

Non-Computable

  • There are problems that cannot be

t d

computed.

  • There are several well defined problems

for which there cannot be a computersolution.

Halting Problem

  • You cannot write a program that will read

i^

th

d

f^

d t ll

in the source code of any program and tellif that program will get caught in an infiniteloop.

  • You can write a program that can detect

infinite loops in many programs, but not allinfinite loops in many programs, but not allprograms.

Post Correspondence Problem

  • Image you have a piles of dominos that

each have a binary number on the top andeach have a binary number on the top andbottom.

  • Can you put the dominos in a series so the

numbers on the top and bottom are thesame? You can use each domino as often

lik

as you like.

Solution to Simple Problem

Dominos

Solution

1001100100100

Docsity.com