Discussion in 'Homework Help' started by Ryuk, Oct 10, 2012.

1. ### Ryuk Thread Starter New Member

Oct 9, 2012
18
0
Hi, I need to design a circuit that adds two 4 bit numbers that are positive/positive, positive/negative, and negative/negative in two's compliment format.

The range is -7 to 8. I have set up a table matching the binary representation of each input. Now what?

I have been hinted that I would need to use XOR gates.

2. ### WBahn Moderator

Mar 31, 2012
18,085
4,917
Are you sure that the range is -7 to 8? If so, then the representation is not 2's compliment, which has values from -8 to 7.

3. ### Ryuk Thread Starter New Member

Oct 9, 2012
18
0
^Sorry, yes, I meant -8 to 7.

I have no experience with adders whatsoever.

4. ### WBahn Moderator

Mar 31, 2012
18,085
4,917
So what background in digital logic do you have? We need a feel for this so that we don't end up throowing a bunch of terminology and concepts at you that you haven't been exposed to, yet. Most courses don't through 4-bit adder design problems at students until they have been exposed to 1-bit adder designs. Also, if you are going to design signed adders it is important that you have a firm understanding of signed binary arithmetic. Do you?

5. ### Ryuk Thread Starter New Member

Oct 9, 2012
18
0
I've designed circuits that convert binary to excess 3, postnet to binary, and binary to Roman numerals using truth tables, Boolean algebra equations and Karnaugh maps to simplify them allowing me to use less OR/AND gates than I have to.

I have been exposed to the very basics of half adders and full adders showing their truth tables for 2 inputs and what kind of carry in/carry out is displayed. I've also seen the equations for the truth tables. What I meant by I have no experience is that I have no experience designing a circuit with adders.

I know how to convert positive to negative in two's compliment. I just invert the bits and add 1. So in a 4 bit system -1 would be 1111. I do know how to add binary numbers by hand. I also know how to subtract but the method I know is really just adding negative numbers.

6. ### WBahn Moderator

Mar 31, 2012
18,085
4,917
Okay, that helps a lot.

So let's start with a bunch of full adders as our buiding blocks. If you understand how and what a full adder does in terms of adding two bits together and dealing with a carry-in and a carry-out (and what each of those mean in terms of addition), then first try to construct a 4-bit adder that only has to work with unsigned binary values (often called 'straight' binary). Once you have that, we can see how some very minor tweaks will make it perform subtration and work with 2's complement.