Arithmetic negation of binary input

Thread Starter

Yodoxin

Joined Nov 2, 2009
1
Hey guys, I'm currently studying Software Engineering and I've been handling this section of the course pretty well up until now; this question has stumped me in an assignment. I'll paste the previous question along with it so you can understand what's going on.

Rich (BB code):
Remind me how to make a half-adder. Give your answer as a 
GateWork definition in the bracket below. You may use none, some, or all of 0,
1, [and], [or], [not], [nand], [nor], [xor], [xnor]. Hint: "none" is a
bad choice.

[
hadd :: 2 -> 2
      A B
      | |
      ^ ^
     / % \
    / / \ \
  [and] [xor]
    |     |
    !     !

]
(5 marks)

Now that you have your half-adder, please construct a circuit whose
output is the arithmetic negation of its input in 4-bit two's
complement arithmetic. (You can do this with four [hadd]s and four
[not]s, but you might need to fix a 0 or 1 to some input lines
and use ! to absorb some unwanted outputs.)

[
negate4 :: 4 -> 4

]
(20 marks)
Incase the GateWork deinitions are something that my teacher has made up in an attempt to aid learning, you can see they're pretty straight forward; ! is an output line, / | \ and ^ are all wiring and the [TEXT] are gates filled accordingly. I'm not asking for the answer or any help in that form; a circuit diagram would be wonderful or a few pointers on how I'd manage to add 1 to the decimal value of the binary input once I've flipped the bits using not gates.

Thanks for your time.
 

Papabravo

Joined Feb 24, 2006
21,228
My recollection is that a half adder takes two inputs called A and B and produces 2 Outputs called Sum and CarryOut. A half adder is only useful for the least significant bit of a cascade of adders. The full adder takes three inputs called A, B, and CarryIn. It produces the same two outputs Sum and CarryOut.

In order to add `1' to something. You can add a literal `1' to something or you can add somrthing to a literal `0' with the CarryIn set to `1'. The only chnge you need to make is that your adder must be constructed from full adders.
 
Top