Presentation is loading. Please wait.

Presentation is loading. Please wait.

Finite Automata (FA) with Output FA discussed so far, is just associated with R.Es or language. Is there exist an FA which generates an output string corresponding.

Similar presentations


Presentation on theme: "Finite Automata (FA) with Output FA discussed so far, is just associated with R.Es or language. Is there exist an FA which generates an output string corresponding."— Presentation transcript:

1 Finite Automata (FA) with Output FA discussed so far, is just associated with R.Es or language. Is there exist an FA which generates an output string corresponding to each input string ? The answer is yes. Such machines are called machines with output. There are two types of machines with output. Moore and Mealy machines. 1

2 2 Moore Machine Created by E.F Moore in 1956. To Design a mathematical model for sequential circuits. A state machine that determines its outputs from the present state only. Moore machines is a Collection of Five Things 1) A finite set of states q0, q1, q2, … where q0 is the initial state. 2) An alphabet of letters ∑ = {a,b,c,…} from which the input strings are formed. 3) An alphabet Г ={x,y,z,…} of output characters from which output strings are generated. 4) δ: Transition function. 5) λ: output function. It depends on the state only. (λ= Q  Г )

3 3 Example-1 Consider the following Moore machine having the states q0, q1, q2, q3 where q0 is the start state and ∑= {a,b}, and Г={0,1} the transition table follows as Transition Table

4 4 Example-2 Pictorial Representation of Previous Moore Machine Input String = abbabbba Output String =100010101 Output can be determined by the following table It may be noted that the length of output string is l more than that of input string as the initial state prints out the extra character 1, before the input string is read

5 5 Sequential circuit (Block Diagram) Next State Logic State Register Output Logic Clock Current State Next State Input Depends on the Current State

6 6 Example-2 (A D-Flip flop type Moore Machine Consider the following Moore machine having the states A,B where A is the start state and ∑= {0,1}, and Г={0,1} the transition table follows as A/0B/1 1 0 0 1 Old StatesNew States after Reading input Symbols Character to be printed 01 AAB0 BAB1 Moore Machine State Diagram

7 7 Mealy Machine Created by G.H Mealy in 1955. A state machine that determines its outputs from the present state and from the inputs. Mealy machines is a Collection of Five Things 1) A finite set of states q0, q1, q2, … where q0 is the initial state. 2) An alphabet of letters ∑ = {a,b,c,…} from which the input strings are formed. 3) An alphabet Г ={x,y,z,…} of output characters from which output strings are generated. 4) δ: Transition function. 5) λ: output function. It depends on the input and state. (λ= Qx ∑  Г ) All transitions are in the form i/o (input symbol/output character).

8 8 Example-1 Consider the following Mealy machine having the states q0, q1, q2, q3 where q0 is the start state and ∑= {a,b}, and Г={0,1} Input String= abbabbba Output String=01111010 It may be noted that in Mealy machine, the length of output string is equal to that of input string

9 Considered as a state machine, the turnstile has two states: Locked and Unlocked. [2] There are two inputs that affect its state: putting a coin in the slot (coin) and pushing the arm (push). In the locked state, pushing on the arm has no effect; no matter how many times the input push is given, it stays in the locked state. Putting a coin in – that is, giving the machine a coin input – shifts the state from Locked to Unlocked. In the unlocked state, putting additional coins in has no effect; that is, giving additional coin inputs does not change the state. However, a customer pushing through the arms, giving a push input, shifts the state back to Locked. [2]

10 10 Example-2 (Serial Adder) Consider the following Mealy machine having two states q 0, q 1 where q 0 is the start state and ∑= {00,01,10,11}, and Г={0,1} q 0 corresponds to No-carry State and q 1 corresponds to a carry State. In case of last bits, when there is 1 carry but you are not getting any input at q 1, so u will consider the 00 as input, it will output 1 and you will reach at State q 0. q0q0 q1q1 Start 00 / 0 01 / 110 / 1 11 / 0 00 / 1 10 / 0 01 / 0 11 / 1 11001 10101 + ----------- 101110

11 11 Complementing Machine Consider the following Mealy machine having only one state q0 ∑= {0,1}, and Г={0,1} the transition table follows as If 0011010 is run on this machine then the corresponding output string will be 1100101. This machine is called Complementing machine.

12 12 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. 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.

13 13 Theorem-1 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. 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).

14 14 Example Moore Machine: Mealy Machine:

15 15 Example Running the string “abbabbba” on both the machines, the output string can be determined by the following table Same output is generated by both machines by ignoring the first output of Moore machine.

16 16 Theorem-2 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, The incoming transitions have the same output character. The incoming transitions have different output characters. 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 qi 1 and qi 2 i.e. if at qi there are the transitions with two output characters then qi 1 for one character and qi 2 for other character. Shift the output characters of the transitions to the corresponding new states qi 1 and qi 2. Moreover, these new states qi 1 and qi 2 should behave like qi as well. Continuing the process, the machine thus obtained, will be a Moore machine equivalent to Mealy machine M.

17 17 Note about Theorem-2 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.

18 18 Example: Mealy Machine: Shifting the output character 1 of transition b to q0

19 19 Example (Continued ….) Shifting the output character 0 of transition a to q1 Shifting the output character 1 of transition b to q2

20 20 Example (Continued ….) Splitting q3 into q3 1 and q3 2

21 21 Example (Continued ….) Running the string “abbabbba” on both the machines, the output strings can be determined by the following table Same output is generated by both machines by ignoring the first output of Moore machine.

22 22 Applications The various flip-flops, counters and shift registers are all examples of sequential machines (automatons). All these circuits contain memory elements. The flip-flops are the elementary memory elements. The counters and shift registers are composed of more than one such element. All the circuits are capable of assuming more than one state. Their outputs do not depend only on the inputs but also on the state in which the circuit is at the time when the input is acting on it. If we note carefully the circuits of all these elements, they have a feedback from the output to the input.

23 The serial binary adder or bit-serial adder is a digital circuit that performs binary addition bit by bit. The serial full adder has three single-bit inputs for the numbers to be added and the carry in. There are two single-bit outputs for the sum and carry out. The carry-in signal is the previously calculated carry-out signal. The addition is performed by adding each bit, lowest to highest, one per clock cycle.digital circuitbinaryadditionfull adder

24 THANKS


Download ppt "Finite Automata (FA) with Output FA discussed so far, is just associated with R.Es or language. Is there exist an FA which generates an output string corresponding."

Similar presentations


Ads by Google