previously we look at how we can build a simple memory circuit
from NOR gates. Today we're gonna look at how we can take this further and see how
computer memory's built in a bit more detail.
So if you remember the previous video, and if you haven't seen it
well, click the link below. We had this circuit here, which has got two
NOR gates in it, wired so that the output of one NOR gate
feeds back to the input of the other and so on with the other one.
We had two inputs to the circuit S and R which stood for 'set'
and 'reset' & we had two outputs Q and Q bar which is the inverted Q.
If we took the set input high
the output went high and it remained high even if the set output went
low again and the same with the reset thing. If we took that high
then it reset Q back to zero, or low
and so on. The circuit remembered what state we put it in.
So this is a useful circuit, it's referred to as an SR latch
but often we want to store not just setting a bit
and resetting it we actually want to store whatever data is on this
line which we'll call D for 'data', So we're gonna have another input
which we'll call 'clock' and when that's high,
we want that to remember whatever data is on D. So let's have a look at how we
can map these inputs into the inputs
of our previous circuit to do that. So it helps if we actually have a look
at the truth table of what input we have coming in. So we've got our data bit coming in
and we have our clock signal coming in and we're going to produce
outputs S and R. Now we need to map these
to the outputs S & R so whenever clock is zero we don't want the values to
change so we want the output to S & R
to be zero. Now if the data is 0 and clock is 1
then we want the thing to be reset so we want the reset pin to be high
so we want S to have 0 output from it and we want R
to have a 1 output from it. If D is 1
and clock is 1 then we want to change the value 'cause our clock pin is high
D is 1 so we want to set it. So we want to take S to be 1 and R to be 0.
So we now know for all of our inputs, what we want the outputs to be
and so we need to build a set of logic gates here
that will map these inputs to the
outputs here. So we need to think of some circuit that is true
for S when both D is 1 and clock is 1
If you remember your logic gates the simple circuit that is true when both
of its inputs are true
is the AND gate so we can draw in
an AND gate that's connected to the S pin and its inputs
are the clock signal and the D signal so when both of them
are 1, then the output is true so the set pin is taken high
and the output of this sets the circuit. Need to do the same to reset it
& we want reset to be 1
when D is zero and clock is one
now an OR circuit's no good because if we OR'd them then 1 & 1 would also be true
and we wouldn't want reset and set to be set at the same time
so what we do is we use another AND gate, connect that up to the
clock signal but we also need to have a signal that is true
when data or D is 0 and so the easiest way to do that
is to use a NOT gate like that and connect that into the circuit.
Normally when we're writing circuits, drawing that out
in full takes up a lot of space, so we just reduce it down
to a simple rectangle and this is what's referred to
as a 'D latch' and the reason why it's called a latch is because
when clock is high then the output will follow whatever
D is, it'll change as D changes while the output is high. When clock is low
the output is frozen at whatever it previously was. There is another type of circuit
which is called a flip flop, which is drawn in very similar
fashion the difference with this though is that the data is only remembered
when this transitions from being low
to high. So when the signal on this input goes from being low
to being high (this is at low and this is at high)
as it's changing it remembers whatever the data is
at that point there and the rest of the time it's fixed
so it keeps that going - until it goes high again
and it remembers at this point whatever it was when it changed from low
to high. Both these circuits are used in building computers but this one in
particular can be used
to build memory circuits that store things
so what we're going to do now is look at how we can put these together to build up
memory for our computer. With the D flip-flop we can store a single bit
of information but often on a computer we want to store more than that.
We want to store a byte, 32 bits worth and so on
or we'll want have to have several bits and we can choose which one
we want to select, so let's have a look at how we can store more than one bit
Now the simplest case to understand when you install something like a byte
or a 32-bit word or a 64-bit word or even a 128-bit word is something you get these days
now the way you do that is - if you remember how binary
numbers work, we store it as a series of bits.
Inside a computer the data is stored along the various wires and each bit
is stored on its own individual wires. If you look carefully
on the back of this motherboard you'll see that coming off the processor here
you have lots and lots of wires, that go together. Now some of these are used to tell it
where to store things but others are actually carrying the data
We've got 16 lines on the motherboard with which to transfer the data between the
various chips. Each wire stores one bit
So one wire stores 'bit 0' - one wire stores 'bit 1' and so on.
So our circuit uses several wires to carry the data.
Now if we wanted to store a 16- or 32-bit number it's very simple.
We're gonna use four-bits here just because it saves on drawing
So our input would be one, two, three, four input wires,
and they'd be labelled something like that
and if we wanted to store, say, that four bit number, what we'd do is we'd have
four flip-flops - and we connect each of the data pins,
up to a different flip-flop, but we now need it to store things when we want it to,
so remember we had this input here which when we took it from low to high
would store everything well we just connect them altogether
like so, like that and then we have a single signal
here which we can use to tell it to store anything - so when we put the data on here
and transition this one from low to high all four of these flip-flops will remember
that data and the outputs here will be the data that we wanted to store.
So storing multiple bits is really easy, we just have multiple flip flops
each flip-flop stores one particular bit of information
If we wanted 8, then we'd have 8 flip-flops - if we wanted to store a 32-bit word
we'd have 32
now you can actually buy these pre-made so what we've got here
are 3 8-bit registers as they're called because they can store
8 bits but they're basically just 8 flip flops
with 8 inputs and an input that we can use to
tell it to store things and the eight outputs and then you've got the voltage supply & the ground
to actually power the chip.
So that's how we can store multiple bits that are stored in parallel, that make up, say, a byte or so on.
& if we look at this SIM that we took out of the Apple Macintosh
then we can see that there are 8 chips. Now you don't have to have them as separate chips
but often they are so we've got 8 chips here
and each one of these chips will be wired up to store a different bit of the byte.
Doesn't have to be the case, if you look at some other SIMs you'll find
that they perhaps only have 2 chips in or perhaps even just one and so on
it doesn't make any difference 'cause the implementation is the same
but in this case they actually used 8 chips on the SIM to store things.
So that's how we can store 8 bits whether a byte or a word we just have 8
single bit 'things' in parallel.
But, if you've done any programming with computers, you'll know that you can store
more than one thing's and you can address them all separately
and we'll look at that in another video
We'd like to thank Audible dot com for sponsoring this Computerphile video
if you like books you must check out Audible. Go to Audible Dot Com
slash Computerphile, there's a chance to download one for free.
Now today I'd like to recommend Christopher Brookmyre as an author, he's
an absolute genius in my mind
try "A Snowball in Hell" which is a really really good book
if you like your novels dark it's very clever it's quite funny with a dark
sense of humor
and it's well worth a read so check out "A Snowball in Hell" by Christopher Brookmyre
at Audible Dot Com slash Computerphile, and thanks once again
to them for sponsoring this Computerphile video.
...and if we slide the front out, we can start to see how it is inside,
so it's a CRT based monitor
so you can see the tube at the back here - and you'll notice I'm being very careful not...