Design a mealy machine for 2's complement

We will design mealy machine for 2's complement.
Generally we take 2's complement as follows:

  1. Take 1's complement of the input
  2. Add 1 to step 1

But here we are taking 2's complement in a different manner to design mealy machine.
The approach goes as follows:
  1. Start from right to left
  2. Ignore all 0's
  3. When 1 comes ignore it and then take 1's complement of every digit
  1. Lets take 001 and we know that its 2's complement is (110+1 = 111)
  2. So scan from right to left
  3. On state A '1' came first to go to stage B and in output write 1
  4. On state B replace '0' with '1' and vice-versa
  5. So finally we got 111 as output
  6. Be aware that the output is also printed in right to left order