How do you design a mealy machine which outputs the two's complement of a binary string?

1 answer

Answer

1226693

2026-05-12 18:30

+ Follow

This is a tricky one, usually we read from MSB to LSB but for this particular priblem we will move from LSB to MSB, now check the 2's complement of these binaries-

110011 => 001101

10100 => 1100

Take more binaries and get their 2's complement, we observe that when read from LSB, all 0s remain 0s until a 1 is encountered, this is the first 1 that is encountered and is remained 1 in the output, the reast of the 0s and 1s encountered are interchanged as in 1's complement.

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.