# Convert 4-bit input to its negative number in 2's complement format

Discussion in 'Homework Help' started by Huzaifa Asif, Mar 29, 2015.

1. ### Huzaifa Asif Thread Starter New Member

Mar 22, 2015
11
0
Design a circuit that takes in 4-bit 2's complement number and outputs its negative number in 2's complement format. For +4, output is -4.

I'm thinking of finding the logic using K-map but i'm not too sure whether it's the right way. Can anybody help me out?

Regards

2. ### MrChips Moderator

Oct 2, 2009
12,642
3,457
Draw a truth table with a column for all states DCBA, 0-7 (D is MSB, A is LSB).
Draw to the right of these columns, the 2's complement of 0-7.

3. ### Papabravo Expert

Feb 24, 2006
10,340
1,850
The way we do it inside a processor is to invert each bit and add 1 to the result. Don't know if that will help you.
BTW the range of the results will be [-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7] and the complement of -8 is -8.

4. ### Huzaifa Asif Thread Starter New Member

Mar 22, 2015
11
0
This is what I did according to my understanding. What do you think?

File size:
758.3 KB
Views:
35
5. ### MrChips Moderator

Oct 2, 2009
12,642
3,457
Start by drawing the truth table. The Karnaugh map will come later.

6. ### Papabravo Expert

Feb 24, 2006
10,340
1,850
That's not correct. You have identical values in row 2, columns 2 and 3.

7. ### Huzaifa Asif Thread Starter New Member

Mar 22, 2015
11
0
Sorry. The 2nd row 3 column is supposed to be 1001.
Now how does it look?

8. ### WBahn Moderator

Mar 31, 2012
18,088
4,917
With that modification, it looks correct.

You need to get in the habit of checking your own work because there usually will not be someone around to check it for you -- that's you they are paying you to do it.

Where possible, use the structure of what you are trying to doing to provide a means of checking your work. In this case you (should) know that the 2's complement bit patterns start at -8 (1000) for an input value of 8 (the most negative representable value) and then count up from there. So visually walk along the table and find 8 and see it it's 1000, then find 7 and it should be 1001 and so on. Then do the same for the negative input values.

9. ### Huzaifa Asif Thread Starter New Member

Mar 22, 2015
11
0
Alright thanks
by the way, the next step is to be create carnage maps for 4 outputs and then create a logic, right?

10. ### WBahn Moderator

Mar 31, 2012
18,088
4,917
That's certainly one way to proceed -- and probably the way that you are expected to proceed.