Design a Moore Machine to Generate 1's Complement of a Binary Number



Moore machine has 6 tuples, which are as follows −

(Q, q0, Σ, O, δ, λ)

Where,

  • Q: Finite set of states
  • q0: Initial state of machine
  • Σ: Finite set of input symbols
  • O: Output alphabet
  • δ: Transition function where Q × Σ → Q
  • λ: Output function where Q → O

The transition diagram is as follows −

Explanation

  • Step 1 − q0 is the start state on input ‘0’ goes to q1 state and on ‘1’ goes to state q2 generating output 0.
  • Step 2 − q1 on input ‘0’ goes to q1 itself and on ‘1’ goes to q2 generating output ‘1’.
  • Step 3 − q2 on input ‘0’ goes to q1 and on ‘1’ goes to q2 generating output ‘0’.

For instance,

Take one binary number: 1011.

Input

Input
1 0 1 1
State q0 q2 q1 q2 q2
Output 0 0 1 0 0

Let’s construct the transition table for the given language. The table is as follows −

Current State Next State Output
0 0
->q0 q1 q2 0
q1 q1 q2 1
q2 q1 q2 0
Updated on: 2021-06-12T09:08:25+05:30

10K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements