Presentation is loading. Please wait.

Presentation is loading. Please wait.

Mealy Machines Finite State Machines with Outputs given on the transitions.

Similar presentations


Presentation on theme: "Mealy Machines Finite State Machines with Outputs given on the transitions."— Presentation transcript:

1 Mealy Machines Finite State Machines with Outputs given on the transitions

2 Machines with Outputs Mealy machines can output symbols. The symbols it can output are determined by a pre-defined alphabet. The output and input alphabets are independent from each other and are often made up of different symbols. Outputs are shown on the transition arrow, and are initiated when the transition is followed. A backslash is used to separate inputs and outputs from each other. input / output

3 Example Mealy Machine #1 We will now build a Mealy machine that reverses the input given to it. We can do this in one state, with just two transitions! Here we are saying that if the input is 0 then output a 1. If we read in a 1 then output a 0. This repeats until the end of the string. a 0 / 1 1 / 0

4 Example Mealy Machine #2 We will now look at a Mealy machine that takes base 10 numbers as its input. It will output a 1 if the number is divisible by 3, and a 0 if not. The number is read from left to right. e.g. 126 → 011 State a reads a 1 Output 0 – move to state b State b reads a 2 Output 1 – move to state a State a reads a 6 Output 1 – stay in state a End of input – last output was a 1, so number is divisible by 3.

5 Mealy Challenge Integer Division of Binary Numbers Write a Mealy machine that integer divides binary numbers by 2. e.g. 11110011 → 01111001 0101010 → 0010101 1001 → 0100 1111 → 0111 1001 → 0100 011 → 001 101 → 010 111 → 011 Can you spot a pattern here? What is happening to each number? You can do this using just two states. Use the following logic rule to help you: If digit is a 1, then replace it with a 0 and replace the next zero with a 1.

6 Mealy Machine to Integer Divide Binary Numbers a b

7 Mealy Challenge - Answer a 0 / 0 b 1 / 0 1 / 1 0 / 1


Download ppt "Mealy Machines Finite State Machines with Outputs given on the transitions."

Similar presentations


Ads by Google