all right hello class in this one we're going to just talk about um a half adder uh which is a small circuit which forms a larger component of ripple carry adders and potentially other sorts of circuits um so yeah let's just get cracking all right so the idea here is that we want to create a circuit which can add two bits um to do so it's probably useful to think about like what the possible outcomes here are so with only two bits that is two one bit numbers right so we're just going to add i guess a single bit right two two single bit numbers getting added together uh we have four combinations right we could be adding uh zero and zero and actually let me just scooch that over uh there we go we could be adding oh and i suppose i should put the uh the answer in right we could be adding zero and zero we could be adding uh zero and one and we could be adding one and one and uh in a sense this is almost like a truth table in many ways it really is uh one and zero zero and one and one and one and then the answers of course to those would be one and one and the answer to this one is well i mean we need another uh column don't we right we've got to carry the two right not the ten i mean like well it's carrying the one that's the digit but that digit represents a two not a ten um we kind of talked about that in an earlier video so right one plus one is two and the way you write two in binary is like that right with a one in the twos place and a zero in the ones place so we'll come back to that in a second and kind of the problem that that causes but let's just focus for now on this and ignore that part of it right what is our truth table here zero and zero gives zero zero and one gives one zero and one gives one the other way around and then one and one gives zero so if we think about that as a truth table right where we have you know some number p some you know one digit number p some one digit number q and then this output of p plus q uh we can see what it looks like so true true false false oops if i could operate my keyboard there we go uh and then true false true false right or on off zero one same thing so uh one and one that's zero one and zero that's one zero and one that's one and zero and zero that's zero and of course this one is special because it's got the whole carry thing but we're gonna worry about that in a minute okay so there's our truth table does that look like any of the operations that we know of so far and or not no it doesn't um in fact it doesn't even look like some of the other ones that we discussed uh kind of you know briefly in previous videos but didn't look at the gates for it kind of looks like the opposite of if and only if right so as long as these are not the same right as long as the inputs are not the same it gives a one um in fact you might call that an exclusive or right so we talked about or being inclusive and so this can't be inclusive or which is what the gate we saw last time that i called an or gate was was an inclusive or gate but it's an exclusive ore and there is a gate for that actually um in logisim and in real life however i just wanted to point out that you can simulate um this exclusive or operation with just and gates and or gates and not gates specifically we are happy basically uh you know when it's not both true and not both false so you could hook up an and gate and negate it and hook up an and gate with two negated inputs uh and negate it and then run it through or no and not negate it but just negate the inputs and then run that through um an and gate as well i think that would do it let's just make it because might as well so we're going to have an and gate open let's do oh no not that that's fine let's do small oh no what did i do 20. i don't want 20 let's how about two there we go all right so we're gonna have a pair of and gates and so this one represents just the the normal and right so that's only true when they're both on and and we don't want that so we're going to negate the output right so this one will tell us you know it'll be true as long as both of these aren't on right or yeah that's correct this this output will be and then likewise uh we don't want both of these to be off either so we can throw down a not gate and a not gate and then run these guys through here oop i didn't quite reach there did i there we go and then we can negate that as well uh uh yep and then i think that's what we want yeah so if we turn just one of these guys on both of these outputs are on and likewise here and then if we turn both of them on we don't get both and so then the last step of course is to run these through an and gate of their own and actually let me not do that let me just copy one of these guys and we'll join these up right okay so then this is our final output here this is our xor operation okay so the goal here is to reproduce our truth table so this should be off when both of these are off and it should be off when both of these are on and when it's mixed it should be on so there's mixed there's mixed the other way and there's both on and it is off okay so we have correctly reproduced our truth table now again this is just simulating the exclusive or operation with ands and ors well actually there's no words but and's and not specifically um that isn't necessary because like i said there is an xor gate and so in fact we are just going to replace all of this with one of those because it's going to be better that way but i thought just for the sake of exercise and demonstrating that that's not a strictly necessary gate we could just uh you know throw throw together a combination of gates that would show how it can be built up from the other ones oh i did it again that's like a little space plane thing that's kind of cool okay there we go so this is the symbol for an exclusive or gate uh this extra little swoosh behind the or gate indicates that it's exclusive or which again means that uh it will only give true as its output whenever um one or the other inputs is on but not both and not neither so then we can just run our little inputs into this and we should get the exact same behavior that we had before but with just a single gate which is nice alrighty and this is gonna come around and plug in here and then let's test it so zero and one that gives one one and zero that gives one and then one and one gives zero okay cool so this is not the full half adder although don't be confused because there's also a full adder but this is not the complete half adder i should say this is only part of it uh and the reason is because we do need to take account of this carry right and that's not too difficult because if you think about this as being its own digit like its own output of a circuit or of a logical expression we can see its behavior is very clear right when the inputs are you know zero and zero so imagine you know both of these are inputs and this is one output and then it's also being run through some other circuit and this is the second output right so this this column follows the logic of xor and this column follows the logic of and right it's only on whenever both inputs are ones so very simply we can just take an and gate and this will be our our carry out right here and let's face that south also and then like i said we'll just take an and gate and we're gonna flip that south as well maybe i'll scooch this over and then we just pull both of these inputs into that as well oops there we go and that should give us the appropriate outfit output for the whole thing so zero and zero added together that's hey look zero working good so far um one plus zero that's one zero plus one that's also one and then finally one plus one that's two and that's exactly what we get right a one in the two's place and zero in the ones place so this is a half adder you can draw it a little bit more compactly and that's how you would see it represented in like a textbook would be something like this you know an or and an and and then the two uh input pins like this and you might just see something like this and like and actually here we'll just turn this to face south like this and like this and that is often what is shown as the diagram for a half adder right and that's what we have here the wires are just a little strung out and we've got our outputs over here instead of coming out this way so there you go a half adder that does one bit of addition uh in the next video we'll talk about how you can string a bunch of these things together to do like actual addition and then from there we'll be ready to talk about an arithmetic processing unit so i will see you in the next one