# 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)):
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.
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.