mealy and moore machines

15
Mealy and Moore Machines

Upload: sangam-choudhary

Post on 30-Apr-2017

281 views

Category:

Documents


6 download

TRANSCRIPT

Mealy and Moore Machines

Mealy Machines

State TablePresent State Next State Output

X=0 X=1 X=0 X=1

S0 S1 S0 0 0

S1 S1 S2 0 0

S2 S1 S0 1 0

STATE ASSIGNMENT1.Pair the present state for which the next state is same for X=0 and X=12.Pair the next state for the present state. For eg: for S0 the next states would be S1 and S2. Hence pair of (1,2) will be formed. 3.Pair the present states for which the output value is equal to 1

State Assignment• According to the State assignment rules, pairs formed will be:• 1. For X=0, (0,1,2) and for X=1 (0,2) will be paired• 2. no pairing is possible• 3. (2) single pair

• S0 = 00• S1 = 10• S2 =01

0 1

0 S0 S1

1 S2 --

Q1

Q2

State tablePresent state Next State Output (z)

X=0 X=1 X=0 X=1

Q1 Q2 Q1+ Q2+ Q1+ Q2+

0 0 1 0 0 0 0 0

1 0 1 0 0 1 0 0

0 1 1 0 0 0 1 0

Now solve for Q1+ and Q2+ and output z using K maps.

K map Solution• For Q1+

• Q1 Q2 00 01 11 10

X 0 Q1+ = X

1

• For Q2 + Q1 Q2

00 01 11 10 Q2+ = X Q1X 0

1

1 1 x 1

x

X

x 1

Output and hardware implementation

• Value of output z = Q1Q2 00 01 11 10X 0

1Z= X Q2

X

1 x

Hardware implementation

D1 Q1

Q1

D2 Q2

Q2

Moore Machines• Output depends only upon the present state not on the

inputs. Pattern to be detected: 010 X=1

(1 is stored)

X=1 X=0 X=0X=1

X=0 (0 is stored)(010 is stored)

X=0 X=1(01 is stored)

S00

S10

S20

S31

State Table • 4 states are used.

• Assignment of States1. (0,1) and (0,2)2. 3. (3)

Present State Next State OutputX=0 X=1 X=0/1

S0 S1 s0 0

S1 S1 S2 0

S2 S3 S0 0

S3 S1 S0 1

K Map

• Assignment of states Q1 0 1 S0 : 00

Q2 0 S1 : 101 S2 : 01

S3 : 11

S0 S1

S2 S3

State table Present state Next State

X=0 X=1Output(z)

Q1 Q2 Q1+ Q2+ Q1+ Q2+

0 0 1 0 0 0 0

1 0 1 0 0 1 0

0 1 1 1 0 0 0

1 1 0 0 1 0 1

Solution for Q1+ and Q2+

• Q1+ : Q1Q2 00 01 11 10 X 0

1 D1 = X Q2 + X Q1 + X Q1 Q2• Q2+ :

D2 = X Q1 Q2 + X Q1 Q2

1 1 1

1

1

1

Solution for K map

Since it is the moore machine only at the state output shall be equal to 1 and ‘Z’ is independent of input variable ‘X’. Z = Q1 Q2

Hardware Implementation