what is going on everyone my name is Cody Moore and welcome back to the long awaited electronics episode number 30 I just want to give a really quick thank you to all of the supporters of this series you guys have left some great comments for me I just want to say I appreciate every single one of them I know I have not responded to very many of them and I know that it's been almost a year since we posted the last episode just wanted to say thank you though it will be harder for me to continue this series now just based on my current work and living situation but I am determined to eventually finish this series at some point in time thanks for sticking with me everyone let's talk about the binary full adder so before we discuss binary full adders and why we need them let's take a look at our half adder circuit here so the whole point of our half adder circuit was to add to one bit numbers together so we can add 0 plus 0 we can add 1 plus 0 and of course we can add 1 plus 1 together to get these outputs here and for each of our 1 bit numbers which we call a and B these a and B inputs that we have here we have two bits of output and the rightmost bit here the ones place of the binary is our sum output while the left one is our carry output it's these two outputs of our half adder circuit right here now if you actually analyze how this addition is happening what we're doing is we're taking this column of digits and we are performing the addition so we know 1 plus 1 equals 2 or 1 0 so we bring that 0 down to this place right here and then we had to carry over that extra 1 that we had and that simply comes down to be our carry output in the case over here we add this column of numbers together we know 1 plus 0 equals 1 or 0 1 so we bring the 1 down and we had to carry over 0 we didn't carry over anything so our carry output stays at 0 now why am i recapping all this well it's for a very important reason this works great when we're working with 2 1 bit numbers but what if I wanted to add I don't know 3 plus 1 together to get an answer of 4 well we know that 3 in binary is 1 1 when in binary is 0-1 so we have to add these together so the process here is to take the first column these ones here and we perform the addition we know that one plus one equals two or one zero so we bring the zero down for that column and we have to carry over an extra one to the next column and now we have to perform the addition on these three inputs here so we know 1 plus 1 plus 0 is simply 2 or 1 0 and binary so once again we bring down that 0 for the answer we carry it over another one and that simply comes down to get our answer of 4 or 1 0 0 and binary and here's the issue we can't just chain have adders together to just magically do this because we do not have an adder that takes in three inputs here so we have to design another adder circuit to take three inputs instead of just two inputs a and B it needs to take a third input being the carry in the carry input this way we can chain the carry outputs of the adder that comes before it and effectively add more than just one bit numbers together let's explore this a little further so here we have a slightly larger truth table than the last video is half adder truth table because now we have to add three digits together three binary digits together at once to have a full adder we have our a and B inputs here but we also have a third carry input and most often this carry input would be hooked up to the carry output of another full adder and we'll see how to do that and why we need to do that toward the end of this video but for now let's figure out how to add three binary digits together and what the corresponding sum and carry outputs should be for those cases so 0 plus 0 plus 0 that is an easy one we have a sum of 0 and a carry out of 0 can't get any easier than that 0 plus 1 plus 0 well that's just 1 and we know that 1 in binary is 0 1 so our sum bit is going to become 1 and we don't have to carry anything it's the same thing for the next case 1 plus 0 plus 0 is just 1 so we have a some bit of one and no carryout one plus one plus zero is going to be of course two or one zero in binary so the sum bit becomes zero and we had to carry over that one bit so we have and now a 1 in our carryout position you'll notice this is the exact same thing as our half adder truth table but the second that we start adding the carry in bit as on as one things begin to change 0 plus 0 plus 1 is 1 so we have some bit of 1 carry out of 0 nothing different 0 plus 1 plus 1 is 2 1 0 so we have nothing in the Sun bit but we do have a carry out we had to carry over same for the next column 1 plus 0 plus 1 is 2 so we have 0 in the Sun bit but we have a 1 in our carry bit because we had to carry over that bit and then this special case 1 plus 1 plus 1 of course this equals 3 and we know that that means we need a 1 1 as an answer so our sum bit is going to become a 1 and we had to carry over a bit so we have to have our carry out as a 1 as well so we know that this is the truth table we need in order to add 3 1 digit binary numbers together right a b and carry in which we could just call another input C it doesn't matter what we call it now how in the world can we take a truth table like this and create a circuit out of it that seems like a pretty big task and it's not the easiest of tasks but let's take it slowly piece by piece we already know a huge part to this problem we already know that the first four rows here these four rows are just a binary half adder our carry n is zero so that's not going to affect anything and the truth table is the exact same thing as a binary half adder so let's start with that circuit will have our inputs a and B and we'll just assume that carry n is 0 right now we'll just focus on a and B which gives us these outputs and that's the exact same thing as a half adder so let's create our half adder circuit here remember that's just an xor gate like so remember that this is our sum output and a half adder and then we take a and B and we also run them through a NAND gate like so and that becomes your carry out from our half adder all right that's just our half adder circuit and that completes the first four rows of this truth table which is brilliant now we just have to work on these last four rows right here the only difference with these last four rows from these first four rows is the fact that the carry in this third input we have are all ones for all of the cases so if we stop and think for a second let's make this problem simpler rather than trying to add three different inputs together and determine our sum and carry outputs and making sure they don't interfere with the ones up here we already know the sum of these two inputs a and B when carry in is equal to zero it's it's just the output of our half adder it's these some values and carryout values up here so rather than thinking of this as adding three digits together let's just think of it as another half adder we'll take the sum right here of a and B for each of these and we know that that is simply 0 1 1 and 0 I'm just taking the sum that we know from our normal half adder and we can then simply treat these as another half adder well what's 0 plus 1 it's 1 1 0 all right that matches up what's 1 plus 1 it's 2 1 0 so we have a 0 for the Sun bit and a 1 for the carry yeah ok that matches up same thing here 1 plus 1 equals 2 so a 0 for the Sun bit one for the carryout zero plus one is equal to one so we have a some bit of one and a carry-out of one so that's the only difference so they all work out except for this guy right here zero plus one should just equal a one in the Sun bit and a zero for the carry out but we're in luck we know that when a and B up here are both one and our carry in is zero we get a carry output this carry output from our half adder that we've already drawn into our circuit becomes a 1 so we can simply take that carry output and just or it with whatever carry output value we get down here in this second half adder I'll show you what I mean we'll go ahead and we'll take this sum output from our first half adder from these first four rows so we're taking this output here which corresponds to these that I drew around here and we are just adding that to the carry in bit if the carry in bit is zero if it stays as zero then we're just gonna keep the answer the same 0 1 1 0 otherwise if it's 1 will have these outputs that we just specified aside from this last special case so we'll take this sum bit and we'll take our third input which is our carry in input that's gonna be our third input that we have and these are gonna go into an XOR gate and we're just gonna build another half adder there we go and we can call that our real sum bit for the binary full adder because this sum column is all correct throughout everything matches up the only difference is this carryout bit for this final one one one case all right let me continue we'll take our carry in and we'll continue building this extra half adder that simply has to go into a NAND gate with whatever this input is to this half adder is so we'll have a and gate like so and here's where we can see kind of the special case we have effectively two half adders we have this guy here which handles the top Rose we've got this guy here that handles the bottom four rows except for this incorrect case it's going to report one zero in that case if carrion was one and the Sun bit was zero but we know that if the Sun bit is zero and it just so happens that we're at a equals one and B equals one that our first carry out here is going to equal one and that can fix this little discrepancy we have and besides we can't have two of these outputs here anyways so we'll simply take them these two outputs of the and gates and we'll simply put it through a normal or gate that's just going to turn on if either one of them is a one and that will become our carry output I know that was a lot but this congratulations is a binary full adder and if you're not as excited as I am let's figure out how we can use this and after that I'll briefly go through and kind of explain my thought process when creating this circuit again for those of you who might want an extra explanation at the end of this video so I mentioned it that a full adder will help us add more than just two one-digit numbers together so I used the example of let's add 3 plus 1 together to get 4 so 1 1 plus 0 1 equals 1 0 0 so if we kind of take this simple little equation here and we try to get it into a logic gate form we can kind of sketch out what it might look like so this first column is never going to have a carry input there's no carry input to the first column here so we can get away with just using a half adder we're simply adding to one bit numbers together there's no column for anything to carry over so we don't have to worry about it now I'm gonna call this column of numbers input 0 i0 and this column of numbers input 1 I 1 kind of representing the bit positions of all the digits so to add the ones place of the binary of the 2 2 bit numbers that we're adding we'll simply use a half adder right we don't have any carry input so we just have a half adder that's simply going to take input zero a and input zero B we'll call this number a and this number B and that will produce a some bit and it carry out bit so we know that the second column for I 1 the twos place in the binary numbers a and B we're gonna have a potential carry so we know this first column can result in either a zero carry bit or a one carry bit so we effectively have three inputs for this column here in this case it will carry a 1 so we'll have 1 plus 1 plus 0 so we're gonna need a full adder so we'll have one of our full adder circuits that is going to take in a carry input which is just going to be the carry output of the half adder of essentially this first column and it'll also have a 1 a and i1b these two digits right here and of course this will produce a some output and it too will produce its own carry output essentially our third digit so of course I'm using these boxes to represent our half adder and full adder circuits just to reduce the amount of things we have to draw so we don't have to draw that all over again but this lets us add those two numbers together all right so we know that our number a is 1 1 so i0 this digit here is a 1 so we'll pass a 1 in here I 1 for a is a 1 also so we'll pass a 1 in right here the first position for number B is a 1 so i0 B is gonna be a 1 and a 1 for B is going to be a 0 so we'll add a 0 here so this half adder is gonna do its thing with these two digits it's going to say hey 1 plus 1 that equals 2 so this sum bit is going to become a 0 carry out is going to be a 1 now this full adder can start working it knows that it's carry input is a 1 because this half a door just spit out the number one it's carrying something and we also know it's other two inputs so one plus one plus the zero is two so the son bit is going to be a zero and it's gonna carry a 1 as its carry out and there we go we effectively have our three digit answer one zero zero which is exactly what we expect and this is brilliant because if we have more numbers if we have an 8-bit number if we're adding two 8 bit numbers together for example all we need to do is have eight of these full adders hooked up so if we have a full adder here which by the way this half adder could just be a full adder and we can just kind of hard-code the carry in to zero because nothing will ever be carried into it so you could make it a full adder that's completely valid so we'll just take say our full adder the first one will have a zero hard-coded for the carry input and it'll have its two inputs and it's some output and it'll have its carry out and that can just chain over to this next full adder over here with its own some bit it's next to input digits for the places in the numbers you're adding and it'll have its own carry out and we can simply keep chaining these together just like this another full adder some bit the two inputs and it's carryout and we can just keep adding these together until we have however many bits we want to add together so since we have two adders here we can add two two bit numbers together if we have three of them here we can add two three bit numbers together so that is why we needed this full adder design is that is so that we can actually add however big of a binary number we want to add so if you're making an 8-bit computer for example you would have an 8-bit adder in there so you could add two 8 bit numbers together and get an 8-bit result or a 9 bit result if you count that extra carryout bit that's for a whole other discussion that's it for this episode I'm gonna go through quickly again and kind of recap what we did to actually generate the circuit up here for anyone who'd like maybe a slightly different explanation on it we looked at our truth table and we saw that the first four rows are just a half adder carry n is zero all the time which means we're really just adding a and B together these two bits and that truth table comes out to be the same thing as a half adder so that's why we drew this half adder circuit right here and we have its some output from its XOR gate and it's carry out from its and gate right here then we took a look at the bottom four rows and what we realized was instead of thinking about it as a three-digit adding problem we can simply take the knowledge we already have of a and B being added together which gives us this sum output and simply add this sum to the carry in bit so effectively if you take the sum of a and B right which I'm gonna try to find some space to do this there we go think it kind of erased part of my diagram here kind of redraw it so essentially we're taking the sum of a and B assuming care yet carry n is 0 0 1 1 0 and we're adding it to the carry input so if the carry input is 0 right if we add 0 to all these cases then we get the exact same thing we simply get the sum bit like that and in the carryout stays as whatever the carryout was of course if the carryin becomes 1 for these 4 cases which are these bottom rows here we know that the sum bit will kind of change 0 plus 1 would give us a new some bit of 1 1 plus 1 would give us a new some bit of 0 and a carry out of one and you'll notice that this carry out of 1 differs from this carry out for that case same exact case right here for this third row or this 7th row here that'll give us a 0 as a Sun bit and a 1 as a carry out so even though there's no one as a carry out here we know we have one in the table and 0 1 again gives us a 1 in the Sun bit and is 0 and the Aereo which is wrong because one plus one plus one should give us a one but since we know that the a and B whenever they're one and kerri-anne is zero this carryout is one so we kind of have the cases all overlapping for the carry out cases and of course this first one is just zero still so what we were able to do is take that sum output of the first four rows of this first half adder and use it as an input to another half adder circuit and the other input to that circuit would be our third input the carry in so if it was all zeros if carry in was all zeros then carry out of this of this yellow half adder could never be a one this would always be a zero in that case in the Sun would simply be passed through effectively you know if some was one this Sun would be one if some was zero the Sun would be 0 but if carry in was in fact a 1 then we would be adding a 1 to whatever this Sun bit was and of course we know that that gives us the appropriate Sun bit so that becomes the final sum of our full adder well then the carry outs because we have these minor discrepancies we simply take the carry out of adder number one to carry out of a turn number two and we just pass it through an or gate if either of them are on we're gonna make the carry out of this full adder a 1 otherwise if they're both off this carry out would stay is 0 which winds up to match this truth table exactly it was kind of tricky for me to come up with a way to actually explain my thought process of taking this truth table and converting it into a real full adder circuit I hope it was enough for some of you thank you all so much for watching and I will see you all in the next episode