How Computer Memory Works - Computerphile

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
So we saw how the Mac used 30 pin SIMS like this to store its memory And we'll look later at what sort of information the computer stores in these things But for now, I just want to look at how this actually stores information. Now as I'm sure all of you are aware, it stores it in terms of binary digits or bits But actually what we are really interested in [is] just storing a single bit and we can put them together to form lots of memory. So to understand how the memory works, we need to look at some of the basic digital logic circuits we can build using logic gates. Now over on Numberphile, Matt Parker introduced these using dominoes to create various things We're going to look at them in terms of the electronic chips So you can buy your basic logic circuits in integrated circuits like this. This one's four OR gates. So [incomprehensible], you put them together in an electronic circuit to build memory Now this is a bit odd because normally these are just used to process or combine various inputs but if we connect them in a specific way, we can actually get them to store information at least until the power is turned off. So what we've got here are two very basic electronic circuits. We've got an AND gate here, and an OR gate in this chip, here. These chips come with four AND gates or four OR gates together And if we remember from the Numberphile video, an AND gate is on when both of its inputs are on. If either input if off, then the output is off. So in this case, I wired it up to a simple L.E.D., so that we can see the output of one of the AND gates. And I've wired both of the inputs to the positive voltage rail because we use positive five volts to represent TRUE or one in binary and we use ground, or zero volts, to represent false or zero in binary. Now. That's generally what we use with what was called TTL logic. These days you use different voltage levels and so on, but the principle is the same; you have one voltage which represents FALSE, or zero, and another voltage which is generally higher that represents one, or TRUE. So if I take... Hang on. If I just move these over so you can see what I'm doing. So both of these are currently connected to logic 1, or five volts. If I disconnect one and connect it to logic zero, you can see that immediately that light goes off, because the AND gate has now got one input zero, one input at one, one and zero is zero by the laws of boolean algebra. So we can combine these in different ways, And [incomprehensible] back in one, both one, it's on. Put them both to zero, then they're both off. Over here, I've got an OR gate. And if you remember back from the Numberphile video, an OR gate is on when either of its inputs are on, or both of them are on. So I'm gonna to rewire the circuit to do that. So often you'll get books like this which will give you details of different things. The quad input positive OR gates has inputs on pins one and two and the output on pin three. The AND gate, the 7402, has the inputs on pins two and three, and the [output] on pin one. So, connect the output to pin three. And we can now start to connect the inputs. Now in both cases... Woops! I just shorted the uh... Oo. Ha Ha. *laughing" I just shorted the uh... [BRADY]: A little bit hot? [GUY]: Yeah. Just shorted the power supply which is why it's making noise. So we connect both of these to... The cable's all melted! ...pin zero. And if we now unplug that and plug it into there, Have I just broken everything? [BRADY]: You fried the chip! [GUY]: I hope this gets edited out Yeah. So that's right. Um. I've either fried everything on here... [BRADY]: Are you now turning it off and on again? [GUY]: I am indeed turning it off and on again, here, in the hope that I haven't just shorted everything out. Uum. [BRADY]: Shall we pause there? [GUY]: Yeah. I think we might need to pause it. Ha ha ha ha. Smoke's cleared, and we've just had a slight problem with power supply but we're back and running now. There's a little hamster running around in a wheel to power everything at the moment. So we've rewired this so that the output of the OR gate is now connected to the L.E.D. and these are both tied to logic zero through these resistors here. If I now connect any of these to logic one, the input comes on. So that's input two connected to logic one. Input one, the input comes on. And of course because it's an OR gate, if I connect the second input at the same time, then they're both on. We also get other versions of these chips. and these are called NAND gates or NOR gates. And they work in exactly the same way. They two inputs and they AND them together but immediately following that, build into the chip, is what's called a NOT gate, which inverts the output. So it's the opposite of an AND gate. Its output is off when both of its inputs are on. So I'm-gonna-open this up. There we are. So-I'm-gonna take the AND chip out. There we are! And pop this chip in. It can be a pain because you have to bend all of the legs to fit in. There we go. So that's now in place So-I-gotta rewire it now to use a NAND gate that I've popped in there. So I connect the output to pin three of this circuit. and the L.E.D. of course comes on, because both inputs one and two are wired to zero. Normally an AND gate would be off because both of its inputs are zero But this is the opposite of that so both of its inputs are zero, it's now on. So if we connect input two to five volts, it stays on because zero and one is zero. There inverse of that is one. But if we connect input one as well to five volts, then the L.E.D. goes off. Because one and one is one, the opposite of that is zero, so the L.E.D. is now off. But as soon as we disconnect one of the pins, it comes back on. And one of the fascinating things about NAND gates is that you could build a whole computer just using the circuits on this chip. You'd need lots of them. You'd need more than four. But what we are going to do today is use, not a NAND gate to start with, but a NOR gate, which is an OR, then NOTed. to actually build some memory. So over here, here is one I prepared earlier, we have quad input NOR gate. So-this-is four NOR gates So-what-I'm-gonna do is wire two NOR gates into a circuit so that it'll actually store the information that we put in it. I'm gonna use this one on the left here. And this one over here. Let me just check the wiring diagram We have pins one is the output of the NOR gate. Two and three are the inputs. And on the other side, pin thirteen is the output in pin eleven and twelve. So I'm gonna connect the output of this NOR gate on the right hand side to the input of the one on the left hand side [BRADY]: Shall we call them A and B or..? [GUY]: Yeah. So we connected the output of NOR gate B to the input of NOR gate A And-now-I'm-gonna connect the output of NOR gate A back to the input of NOR gate B. It's a very tight fit so... There we go. So we've got these two things crossed over, but the output of one is connected to the input of the other. And just to make sure the circuit works, I'm just gonna put some resistors to tie the other input to zero volts to our logic zero. This means that I can make them logic one or logic zero just by touching the leg of the resistor with a wire connected to five volts later in the demonstration So the other thing I'm gonna do is I've connected the output of NOR gate A to this wire here. And I'm just gonna put a L.E.D. across that wire to ground like so. And I'm gonna to the same on the other side. So I'll connect that up like so. There. And well see that this L.E.D. has now come on. So I now get a fly wire, plug this into five volts like that. And if I touch this one, this L.E.D. comes on, and it stays on. If I touch that one, that L.E.D. goes off and this one comes on, and stays on. This circuit is remembering its state. And we can do that by just driving a signal into the chip. And it'll stay like that until I turn the power off. We need to look at how this circuit works. What-I'm-gonna do is draw it out. But before we do that, it would be useful to refresh out memory of how a NOR gate works. Ah. So that's a NOR gate and it has two inputs which we'll label as a and b and it has an output which we'll label as q. So we can build a truth table for this. So normally with an OR gate, zero OR zero would be zero. But we're inverting it because it's a NOR gate. So the output is one. Zero or one is one, but it's inverted so the output is zero. One or zero is one, but it's inverted so the output's zero. One or one is one, inverted, so the answer is zero. So that's the truth table for our NOR gate. Now let's have a look at the circuit that we used over there. So we had our first NOR gate and we also had our second NOR gate, like that. And we've got the inputs to these like so. And we took the output from here and connected it to the input of that one. And we took the output from here and connected it here. We've now got two inputs left that we're not using and I gotta label them as R because that is what we use to reset it. and we've got S which is what we used to set it, or to store a bit. We've also got two outputs. And I'm gonna label the first one q and the other one we're gonna call this NOT q. And the way we do that is is we draw a line over the top to say that this is NOT q. Now the thing we have to remember about these circuits is that they don't switch the output instantaneously when the inputs switches. There is a slight very short delay. And depending in what kind of chip you get... But there is always a slight delay. So-what-I'm-gonna do is I'm gonna draw out our truth table for this So we've got input R, and we've got input S, we've got output q, and output q NOT q. But these are also inputs to this. So I'm actually going to put in q prime and NOT q prime. To start with, this is at zero, this is at zero. We don't know what these values are, so we'll leave them blank. What's the next value of q going to be? So it's going to be zero, OR'd with the current value of NOT q, NOT'd, so that's gonna be represented as q NOT q, NOT'd. NOT q, NOT'd is of course q because the two NOTs cancel out. So the value of q prime is whatever the old value of q was effectively. Same happens for NOT q prime. That's s, which is zero. OR'd with the old value of q, NOT'd so we get NOT q. So as long as the two inputs are zero, you get the same values propagating through the circuit. But what happens if we set s to be one. We'll leave r at zero. So our new value of q is gonna be the old value of NOT q OR'd with zero So it's gonna be NOT NOT q again. So it's gonna be q. Our new value of NOT q is gonna be s, which is one, OR'd with whatever the value of q was, NOT'd. Now if you OR anything with one, if you think about the truth table, the answer is always one. So NOT q is going to be zero because it's NOT of one. So we're gonna get a zero in there. So we can feed those back in again We've still got zero and one as the input here We now know that the output of q bar, or NOT q, is zero. So what's the new value of q gonna be? Well, it's the output of NOT q, which is zero OR'd with zero NOT'd which is one The output of q prime is going to be one and the output of q bar prime... Well that's still one OR'd with whatever the output of q was before. So we'll call that q, that's always going to be one, NOT'd, so that's gonna be zero. And if we run those values through again... So we've got zero, one, one zero. Then we get the same values out: one, zero. But the interesting thing is, when this becomes zero, and that becomes zero again, q is still at one, NOT q is still at zero If we run the circuit through here, the new value of q is the old value of NOT q OR'd with zero that's zero, NOT'd, that's one. And NOT q prime is S, which is zero, with the old value of q, which was one, and that's one, NOT'd, that's zero. So it stays the same, and you get the same input coming through. So it actually continues. And we could do the same thing with the reset, and you'd find if you work it through, that it resets it and all of the values go to zero. So that very simple circuit will actually store the state if it is set and if it is reset. And you can actually build up a complete memory circuit because you can put some very simple digital logic in front of that to generate the right s or r signal based on the value of a bit and whether you want to store it or not. [LEFTVIDEO]: ...and everybody was gonna click on that one. Well it turned out that the video behind that was a person talking about the fight [RIGHTVIDEO]: Only that will fall over, that wont move. Here we go! Ready?
Info
Channel: Computerphile
Views: 837,048
Rating: undefined out of 5
Keywords: computers, computerphile, Computer Memory, computer science, university of nottingham, dr steve bagley, computer, logic, logic gates, RAM
Id: XETZoRYdtkw
Channel Id: undefined
Length: 14min 15sec (855 seconds)
Published: Mon Jun 23 2014
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.