0% found this document useful (0 votes)
19 views33 pages

Lecture 18 & 19

This document discusses sequential circuits and their relationship to Mealy machines. It provides an example of a sequential circuit with inputs A and B and uses it to demonstrate how the circuit defines a Mealy machine. The circuit contains NAND, delay, OR, and AND boxes. It defines 4 states based on the values of A and B. The document explains how the circuit transitions between states based on the input and the previous values of A and B, defining the operation of an equivalent Mealy machine.

Uploaded by

kiranwaheed51
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views33 pages

Lecture 18 & 19

This document discusses sequential circuits and their relationship to Mealy machines. It provides an example of a sequential circuit with inputs A and B and uses it to demonstrate how the circuit defines a Mealy machine. The circuit contains NAND, delay, OR, and AND boxes. It defines 4 states based on the values of A and B. The document explains how the circuit transitions between states based on the input and the previous values of A and B, defining the operation of an equivalent Mealy machine.

Uploaded by

kiranwaheed51
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 33

Welcome to !

Theory Of Automata

Lecture # 18 & 19
Atif Ali

1
Applications of Incrementing and
Complementing machines
1’s complementing and incrementing machines
which are basically Mealy machines are very
much helpful in computing.
The incrementing machine helps in building a
machine that can perform the addition of binary
numbers.
Using the complementing machine along with
incrementing machine, one can build a machine
that can perform the subtraction of binary
numbers, as shown in the following method

2
Subtracting a binary number
from another
Method: To subtract a binary b from a binary
number a
1. Add 1’s complement of b to a (ignoring the
overflow, if any)
2. Increase the result, in magnitude, by 1
(use the incrementing machine ). Ignoring
the overflow if any.
Note: If there is no overflow in (1). Take 1’s
complement once again in (2), instead. This
situation occurs when b is greater than a, in
magnitude. Following is an example of
subtraction of binary numbers 3
Example
To subtract the binary number 101 from the binary
number 1110, let
a = 1110 and b = 101 = 0101.
(Here the number of digits of b are equated with that of
a)
i) Adding 1’s complement (1010) of b to a.
1110
+1010
11000 which gives 1000 ( ignoring the
overflow)

4
Example continued …
ii) Using the incrementing machine,
increase the above result 1000, in
magnitude, by 1
1000
+1
1001 which is the same as obtained by
ordinary subtraction.
5
Equivalent machines
Two machines are said to be equivalent if
they print the same output string when the
same input string is run on them.
Remark: Two Moore machines may be
equivalent. Similarly two Mealy machines
may also be equivalent, but a Moore
machine can’t be equivalent to any Mealy
machine. However, ignoring the extra
character printed by the Moore machine,
there exists a Mealy machine which is
equivalent to the Moore machine.
6
Theorem
Statement:
For every Moore machine there is a Mealy
machine that is equivalent to it (ignoring the
extra character printed by the Moore machine).
Proof: Let M be a Moore machine, then
shifting the output characters corresponding to
each state to the labels of corresponding
incoming transitions, machine thus obtained
will be a Mealy machine equivalent to M.
Following is a note
7
Note
It may be noted that while converting a Moore
machine into an equivalent Mealy machine, the
output character of a state will be ignored if there
is no incoming transition at that state. A loop at a
state is also supposed to be an incoming transition.
Following is the example of converting a
Moore machine into an equivalent Mealy
machine

8
Example
Consider the following Moore machine
a
q0/0 q1/1

b b a

a b a,b
q2/0 q3/1

Using the method described earlier, the


above machine may be equivalent to the
following Mealy machine 9
Example continued ...
a/1
q0 q1

b/0 b /0 a /1

a /0 b /1 a /1,b /1
q2 q3

Running the string abbabbba on both the


machines, the output string can be
determined by the following table
10
Example continued ...

Input a b b a b b b a

States q0 q1 q2 q3 q3 q3 q3 q3 q3

Moore 0 1 0 1 1 1 1 1 1

Mealy 1 0 1 1 1 1 1 1

11
Theorem
Statement:
For every Mealy machine there is a Moore
machine that is equivalent to it (ignoring the
extra character printed the Moore machine).
Proof: Let M be a Mealy machine. At each
state there are two possibilities for incoming
transitions
1. The incoming transitions have the same
output character.
2. The incoming transitions have different
output characters.
12
Proof continued …
If all the transitions have same output characters,
then shift that character to the corresponding state.
If all the transitions have different output
characters, then the state will be converted to as
many states as the number of different output
characters for these transitions, which shows that
if this happens at state qi then qi will be converted
to qi1 and qi2 i.e. if at qi there are the transitions
with two output characters then qi1 for one
character and qi2 for other character.
13
Proof continued …
Shift the output characters of the
transitions to the corresponding new
states qi1 and qi2. Moreover, these new
states qi1 and qi2 should behave like qi as
well. Continuing the process, the
machine thus obtained, will be a Moore
machine equivalent to Mealy machine M.
Following is a note
14
Note
It may be noted that if there is no incoming
transition at certain state then any of the output
characters may be associated with that state.
It may also be noted that if the initial state is
converted into more than one new states then
only one of these new states will be considered
to be the initial state. Following is an example

15
Example
Consider the following Mealy machine

q1 b/1 q2

a/0 a/1 b/1 a/0

b/0
q0 q3 a/1
b/1

16
Example continued ...
Shifting the output character 1 of transition b to q0

q1 b/1 q2

a/0 a/1 b/1 a/0

b/0
q0/1 q3 a/1
b

17
Example continued ...
Shifting the output character 0 of transition a to q1

b/1 q2
q1/0

a a/1 b/1 a/0

b/0
q3 a/1
q0/1 b

18
Example continued ...
Shifting the output character 1 of transition b to q2

b
q1/0 q2/1

a a/1 b/1 a/0

b/0
q3 a/1
q0/1 b

19
Example continued ...
Splitting q3 b
1 2 q1/0 q2/1
into q3 and q3
a b
a

a
q0/1
b a
1
b q3/1
b
a

2
q3/0
20
Example continued …
Running the string abbabbba on both the
machines, the output strings can be determined
by the following table

Input a b b a b b b a

States q0 q1 q2 q3 q3 q0 q3 q0 q1

Mealy 0 1 1 1 1 0 1 0

Moore 1 0 1 1 1 1 0 1 0
21
Mealy machines in terms
of sequential circuit

22
Example
Consider the following sequential circuit

input A B output
NAND DELAY OR

AND

The following four types of boxes are used in this


circuit
23
Example continued ...
1. NAND box (NOT AND): For given
inputs, it provides the complement of
Boolean AND output.
2. DELAY box (Flip Flop box): It delays the
transmission of signal along the wire by
one step (clock pulse).
3. OR box: For given inputs, it provides the
Boolean OR output.
4. AND box: For the given inputs, it provides
the Boolean AND output.
The current in the wire is indicated by 1 and 0
indicates the absence of the current. 24
Example continued ...
There are two points A and B w.r.t. to
which following four states of the machine
are identified according to the presence
and absence of current at these points i.e.
1) q0(A=0, B=0) = (0,0)
2) q1 (A=0, B=1) = (0,1)
3) q2 (A=1, B=0) = (1,0)
4) q3 (A=1, B=1) = (1,1)
25
Example continued ...
The operation of the circuit is such that the machine
changes its state after reading 0 or 1. The transitions
are determined using the following relations
new B = old A
new A = (input) NAND (old A AND old B)
output = (input) OR (old B)
It is to be noted that old A and old B indicate the
presence or absence of current at A and B before
inputting any letter. Similarly new A and new B
indicate the presence or absence of current after
reading certain letter.
26
Example continued …
At various discrete pulses of a time clock, input is
received by the machine and the corresponding
output string is generated.
The transition at the state q0 after reading the letter
0, can be determined, along with the corresponding
output character as under
new B = old A = 0
new A = (input) NAND (old A AND old B)
= 0 NAND ( 0 AND 0) = 0 NAND 0
=1
output = (input) OR (old B) = 0 OR 0 = 0
27
Example continued …

Thus after reading 0 at q0 new B is 0 and


new A is 1 i.e. machine will be at state
(1,0) = q2 and during this process it’s
output character will be 0.
The remaining action of this sequential
circuit can be determined as shown by the
following suggested transition table of the
corresponding Mealy machine
28
Example continued …
Old state Inputting 0 Inputting 1 State
State Output Output

q0 = (0,0) (1,0) = q2 0 (1,0) = q2 1


q1 = (0,1) (1,0) = q2 1 (1,0) = q2 1
q2 = (1,0) (1,1) = q3 0 (1,1) = q3 1
q3 = (1,1) (1,1) = q3 1 (0,1) = q1 1
The corresponding transition diagram may
be as follows
29
Example continued …
q2
0/0, 1/1 0/0, 1/1
0/1

q0 0/1 1/1 q3

1/1

q1
Note: It may be noted that if the string 00 is read
at any state, it results ending in state q3.
30
Example continued …
Running the string 01101110 on the previous
machine, the output string can be determined
by the following table
Input 0 1 1 0 1 1 1 0

States q0 q2 q3 q1 q2 q3 q1 q2 q3

output 0 1 1 1 1 1 1 0

Following is a note regarding the sequential


circuit under consideration 31
Note

input A B output
NAND DELAY OR

AND

It is to be noted that in this sequential circuit,


delay box plays an important role in introducing
four states of the machine.
32
Thank You

33

You might also like