1
\$\begingroup\$

One of my final exam questions in digital design was to design a circuit that converts an 8-bit Sign/Magnitude number to Two's Complement number using only inverters, XOR gates, half adders and full adders. The simplest approach to this problem, I thought, was to use a multiplexer. However, I couldn't design one using the allowed components. Is it even possible to make a MUX out of these components or does this problem require a different approach?

Edit:

If I could make a multiplexer, my solution would be to multiplex the input number and a version of it that is inverted and added 1 using the sign bit as select.

\$\endgroup\$
  • \$\begingroup\$ Give us a bit more detail of your thinking so far. \$\endgroup\$ – RoyC Jan 19 '17 at 9:43
2
\$\begingroup\$

X-Y problem why would you be thinking of a multiplexer given those components the examiners were giving you a clue. Expressing the problem in words.... If sign bit is set(negative) invert the value and add 1. If sign bit is not set don't invert the value and add 0. That should be easy with those components.

This is an xor on each value bit as an inverter which is switched by the sign bit. Then a half adder which adds the sign bit to the result of that.

If a multiplexer is deemed to be absolutely necessary you need an and function followed by an or function. The carry out of a half adder is an and, you can convert this to an or by inverting the inputs and outputs of the and. So you can make one mux bit with three half adders and three inverters.

\$\endgroup\$
  • \$\begingroup\$ I know how to take Two's Complement. Your answer describes two different circuits that still need to be multiplexed. And, the question is about whether is it possible to make a multiplexer or not. \$\endgroup\$ – deterjan Jan 19 '17 at 9:59
  • \$\begingroup\$ No it does not. It describes one circuit that behaves differently depending on whether one of the inputs is a zero or a one. \$\endgroup\$ – RoyC Jan 19 '17 at 11:00
  • \$\begingroup\$ @deterjan, yes, RoyC is spot on, I came up with the same thing. Your mux idea is a blind alley, I'm afraid. By 'simplest', do you mean 'uses fewest gates' or something else? \$\endgroup\$ – TonyM Jan 19 '17 at 17:31
  • \$\begingroup\$ No, just the first thing that comes to mind \$\endgroup\$ – deterjan Jan 19 '17 at 20:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.