# ALU / Full Adder Homework Problem

Discussion in 'Homework Help' started by Gotmilk0112, Apr 21, 2013.

1. ### Gotmilk0112 Thread Starter Member

Mar 24, 2013
32
0
...............

Last edited: Apr 22, 2013
2. ### WBahn Moderator

Mar 31, 2012
23,175
6,978
A and B are your two numerical inputs.

And I don't agree with the problem's Hint that the Yi (which I assume Y is the Sum output of the adder) is a function only of S, B, and Cin. What about A?

I would recomment starting with an adder that can do nothing but add two numbers, A and B, and nothing more. Now see what would be required to make that perform subtraction (A-B). Now see what modification would make it perform increment. Then what mod would be needed to make it perform decrement. Feel free to post the stages of your work as you go if you get stuck.

3. ### Gotmilk0112 Thread Starter Member

Mar 24, 2013
32
0
.................

Last edited: Apr 22, 2013
4. ### WBahn Moderator

Mar 31, 2012
23,175
6,978
Ah, a diagram is worth a thousand words. When you just talk about a "Yi" of the Full Adder and there is no description or diagram of what the inputs and outputs of the thing are, then we have to guess. I guessed that it was the output of the ith stage since "Y" is typically used to denote a logic blocks output.

So, A is sent directly as one input to the adder (and A is a "numerical input" because it represents a number, namely a number that is going to be added to whatever is eventually presented at the Yi input.

So do what I suggested. Start off with just a circuit that will add A and B. Then see what changes you need to make at the Cin and Yi inputs in order to make it peform one of the other functions (such as A-B). Then see what further mods you need to make in order to perform another one of the functions and, finally, the fourth. You should discover that the logic that goes in the box is very tame.

5. ### Gotmilk0112 Thread Starter Member

Mar 24, 2013
32
0
But I only need to draw "the first two stages". What does that mean?

6. ### WBahn Moderator

Mar 31, 2012
23,175
6,978
Draw the diagram for the least two significant bits -- in other words, think of A and B as being 2-bit values.

7. ### Gotmilk0112 Thread Starter Member

Mar 24, 2013
32
0
I don't know what that means, though.

Looking over my notes again and listening to the recording I made of the professor going over a similar problem, I need to complete the truth table for Y, then make a K-map of Y to get the logic for the full adder, or something like that.

And for "first two stages", I need to draw one diagram with s0, b0, c0, etc, and the 2nd diagram with s1, b1, c1, etc, but I'm not sure if it will have the same logic...

8. ### WBahn Moderator

Mar 31, 2012
23,175
6,978
Take a step back and, using Full Adders as your building blocks, draw the diagram for a circuit that can add two 2-bit numbers (with a carry-in to the lsb).

If you can't do that, then you need to drop this course and retake the prerequiste course (or perhaps just retake this course from scratch) because you have managed to completely miss some key fundamental concepts.

9. ### Gotmilk0112 Thread Starter Member

Mar 24, 2013
32
0
The "circuit that can add two 2-bit numbers" is the same as what I posted, minus the logic box connecting all that stuff there. Where does that get me, though? I need to find what logic goes in that box, I'm not trying to draw diagrams for all of the functions listed there. Those are used for finding the truth table for Y, and from there, I can complete the truth table, K-map it and get the logic.

I don't know exactly how to complete the truth table, though.

10. ### WBahn Moderator

Mar 31, 2012
23,175
6,978
A Full Adder takes two 1-bit inputs, plus a 1-bit carry-in input, and produces a 1-bit SUM output and a 1-bit carry-out output. The box you have is a multi-bit adder that takes two N-bit inputs, plus a 1-bit carry-in input, and produces an N-bit SUM output and a 1-bit carry-out output. The "stages" involve what is INSIDE that box. You can't draw the first two stages for the problem unless you can draw the first two stages for an N-bit adder (which IS a 2-bit adder) since that is your starting point.

I can see that you are headed for problems because you are not making a clear distinction between the full multi-bit adder and the individual full adders. But since you won't take my advice and draw the circuit, there's nothing I can do but let you run head first into that particular brick wall. That's fine. Brick walls make good learning aids -- I've used many of them in my time.

You can approach this problem from a number of directions, but in all cases you can't build your truth table unless you understand what it is you are trying to accomplish.

I'm not getting the impression that you have the math concepts down well enough to tackle it from that perspective, but since you are resistant to drawing the circuits and building up your truth table that way, let's give it a shot.

In terms of the multi-bit value B, what do you want Y to be for:

Subtraction:
Increment:
Decrement:

Don't forget that Cin to the full multi-bit adder will be 1 for Increment and Subtract and 0 for Decrement and Add.

11. ### Gotmilk0112 Thread Starter Member

Mar 24, 2013
32
0
This is what I'm trying to figure out. I'm trying to figure out what Y is, based on those four functionalities that are listed in the problem. Depending on the values of S and Cin, you use one of those four functionalities to figure out what Y is, but I'm not entirely sure what to do with the functionalities.

12. ### WBahn Moderator

Mar 31, 2012
23,175
6,978
That's what I'm trying to get you to figure out!

Take it ONE FUNCTION AT A TIME!

If you want to ADD the quantities A and B with A going directly to the X input of the multi-bit adder and B going through a logic box to produce the Y input to the adder, what does Y have to be? Forget about any and all other issues (except, perhaps, the fact that Cin is equal to 0 in this case). What does Y have to be in order for the thing to perform A + B?

13. ### Gotmilk0112 Thread Starter Member

Mar 24, 2013
32
0
I don't know what Y has to be to perform A+B. I know S and Cin have to be 0 to use it, but I don't know what Y has to be. That's what I'm trying to figure out: The value of Y.

Last edited: Apr 21, 2013
14. ### WBahn Moderator

Mar 31, 2012
23,175
6,978
The output of your multi-bit adder is X+Y. Call that F, so

F = X + Y

The function that want to have happen is

F = A + B

The circuit is hard wired so that X = A

What does Y absolutely HAVE to be?

You don't need ANYTHING more than the information in THIS post to answer THAT question!

15. ### Gotmilk0112 Thread Starter Member

Mar 24, 2013
32
0
I don't know...1?

16. ### WBahn Moderator

Mar 31, 2012
23,175
6,978
Well, let's see.

F = X + Y
F = A + B

Since

F = F

we have

X + Y = A + B

Since

X = A

we have

A + Y = A + B

Subtracting A from both sides leaves us with

Y = B

This is 6th or 7th grade math in most places. Since this was beyond your present math skills, the likelihood that you can figure out the other functions is remote and, even if we spoonfed it to you (as I just did for this one), you will be no better off because the next problem will trip you up just as bad. You lack the basic math skills to work these types of problems. Stop where you are and go back and develop those skills -- or reassess your goals and choose a path that is more suitable for the skills that you do currently have. If you don't do one or the other, you are just setting yourself up for ultimate failure.

17. ### Gotmilk0112 Thread Starter Member

Mar 24, 2013
32
0
I'm in a Calculus II course, and doing quite well in it. I most certainly do not "lack basic math skills".

What I DO lack is understanding on what I'm supposed to be doing here, yet for some reason you're interpreting that is "lacking basic math skills". I didn't know that "F=A+B" was equal to "F=X+Y", and thus Y = B. That's not "lack of basic math skills", that's "lack of knowledge on ALU functions".

Now are you going to help me or not?

18. ### WBahn Moderator

Mar 31, 2012
23,175
6,978
Fine, then what does Y have to be if the goal is to increment A (so F=A+1) given that Cin will be a 1?

19. ### Gotmilk0112 Thread Starter Member

Mar 24, 2013
32
0
Y has to be 0 because the Cin does the increment.

20. ### WBahn Moderator

Mar 31, 2012
23,175
6,978
Very good. So we have half of the functions already mapped out:

S = 0, Cin = 0 => Y=B
S = 0, Cin = 1 => Y=0

Now, what does Y have to be if we want F=A-B, again given that Cin is 1. Remember that you are working with 2's complement.