Arithmetic negation of binary input

Discussion in 'Homework Help' started by Yodoxin, Nov 2, 2009.

1. Yodoxin Thread Starter New Member

Nov 2, 2009
1
0
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.

Code ( (Unknown Language)):
1. Remind me how to make a half-adder. Give your answer as a
2. GateWork definition in the bracket below. You may use none, some, or all of 0,
3. 1, [and], [or], [not], [nand], [nor], [xor], [xnor]. Hint: "none" is a
5.
6. [
7. hadd :: 2 -> 2
8.       A B
9.       | |
10.       ^ ^
11.      / % \
12.     / / \ \
13.   [and] [xor]
14.     |     |
15.     !     !
16.
17. ]
18. (5 marks)
19.
20. [B]Now that you have your half-adder, please construct a circuit whose
21. output is the arithmetic negation of its input in 4-bit two's
22. complement arithmetic. (You can do this with four [hadd]s and four
23. [not]s, but you might need to fix a 0 or 1 to some input lines
24. and use ! to absorb some unwanted outputs.)[/B]
25.
26. [
27. negate4 :: 4 -> 4
28.
29. ]
30. (20 marks)
31.
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.

2. Papabravo Expert

Feb 24, 2006
12,272
2,721
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.