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

Thread Starter

Huzaifa Asif

Joined Mar 22, 2015
11
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
 

MrChips

Joined Oct 2, 2009
30,714
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.
 

Papabravo

Joined Feb 24, 2006
21,159
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.
 

WBahn

Joined Mar 31, 2012
29,979
Sorry. The 2nd row 3 column is supposed to be 1001.
Now how does it look?
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.
 

Thread Starter

Huzaifa Asif

Joined Mar 22, 2015
11
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.
Alright thanks :)
by the way, the next step is to be create carnage maps for 4 outputs and then create a logic, right?
 
Top