so in a previous video we made this one
bit register it's got a single input
single output here is led and it stores
one bit of data and this is kind of a
reminder basically the interface for
this is we've got our input our output
we've got a write signal which if this
is active then it it stores whatever's
coming in our input and we have an
enable signal which when this is active
it sends whatever bit is stored in here
to our output and of course the
registers we've been building also have
a clock signal which for the for this
video I'm going to kind of sidestep but
just as a reminder you know the the
clock makes this a synchronous register
because it even if or when the they made
the right signal is active it still only
reads data at the on the rising edge of
the clock so it's synchronous in the
sense that it's synchronized with this
clock for for when it's storing data but
but for now just to simplify things I'm
not including the clock here what we'll
come back to that in a future video we
talked more about the actual
implementation of our memory of course
after we implemented a one bit register
we then went on to implement an 8-bit
register which you know we've got a
couple of them here we've got you know
this is our a registers is our B
register down here and it's the same
idea
it stores eight bits of data instead of
one bit but we still have our enable
signal we still have our write signal
and then of course we have our clock in
here as well to this white wire and in
this case input and output are are
through the bus we have our eight bits
of input and output so it's essentially
the same idea as our single bit register
input/output right and enable but now
we've got eight of them so we have our
eight inputs our eight outputs we have a
write and enable that either writes a
whole bite into into all of these or
enable it outputs the whole byte from
all of these now if we want to build a
memory for our computer basically we can
do the same thing and just replicate
that 8-bit storage as many times as we
want to as we want bytes that we want to
store so in our case we're going to
build a 16 byte memory so we could
essentially replicate 16 essentially
registers I guess 8-bit register 8-bit
storage units
and we have a separate right signal for
each of those registers so right zero
will write into this first memory
location right one will write into the
second one
if this right two is active it writes
into the third one and so on all the way
up to right 15 which writes into this
last the 16th byte down here and you can
see the 8 bits that make up the byte are
connected to each of these and you know
we either we either have one of these
enable signals active you know one of
these 16 enable signals active in which
case we would be reading whichever
whichever byte is enabled so if we have
enable one that's this byte here this
row is enabled then it would be
outputting each of its bits onto each of
our 8-bit lines so these these vertical
lines we can call those bit lines and
then these horizontal rows are
essentially our words you know they're
each one is a byte but generally it's
referred to as a word because it could
be a different length depending on the
memory in our case our memory is 8-bit
words but you can get memory that's
16-bit words or 32-bit words or so on
and so each of these memory cells each
of these little boxes here is a memory
cell and in our case we're going to
build these we're going to we're going
to use something that's very similar to
the registers that we used which you
know at its core is essentially a latch
which is able to store one bit of data
in you know practical memory that you
might that you might have in your
computer or for example the computer
that I'm using to edit this video on I
have 16 gigabytes of memory in that
computer so that would be 16 billion of
these rows essentially which is which is
a lot I would certainly wouldn't to
build it like this but you can imagine
you know these these flip-flops are
fairly complex I mean you know you've
seen the the one that we built here you
know six well 16 billion bytes that's
128 billion memory cells so you wouldn't
want to build 128 billion of these that
certainly wouldn't work very well of
course you know it can be miniaturized
and all
rest but even that is a fairly complex
circuit to store one bit
so most memory you know the memory in my
computer that I'm editing this video on
for example uses it you know essentially
the the simplest way of storing a bit
which is essentially in each of these
cells is you know just a single
transistor and a capacitor and the the
bit is stored as a charge on the
capacitor now one drawback of that is
that the capacitor will discharge over
time you know after a few seconds it
will lose its charge and so you can only
store a bit in here for you know a
couple seconds at most but one way to
get around that is they have a separate
circuit that big the reeds by t'v memory
and then writes that same byte back into
that same memory location and so you
have a separate circuit that's just
doing that constantly it's going through
all of memories reading every byte and
then writing the exact same data back to
that byte and so it's refreshing what's
in each of those bits so even though you
know capacitor could only store that
data for you know at most a couple
seconds because we're reading and
writing that many times a second it's
keeping that data refreshed but because
we have to continually refresh it like
that this is referred to as dynamic Ram
it's dynamic because if you don't
refresh it you lose the data that's in
it whereas if we used a flip-flop
circuit or something like we've been
building with our registers as you know
once you store a bit of data in here it
stays there essentially forever until we
take the power away so as long as this
is powered up we don't have to
constantly refresh this or anything we
store the bit in there it stays it stays
there and so this is if we're using this
type of memory cell that's referred to a
static Ram and that's what we're going
to do for our computer and it's you know
static Ram is generally more expensive
than dynamic Ram because you need a lot
more transistors you know there's a lot
more complexity to each memory cell in
in static Ram it has some advantages
right you don't have to do the refresh
although that's you know fairly easy to
do that you know certainly in a larger
larger scale computer but it's also
generally faster so you see static Ram
used
in special applications where you need
really fast memory access of course we
don't really care about speed for the
computer we're building so you know
we're basically using static Ram just
because it's more convenient because we
don't want to have to build that that
refresh circuit so for our computer you
know easy way to think of it is is each
of these bytes is essentially just like
the registers that we've already built
so you already know how these work the
thing that's a little bit weird now is
that we have a separate write signal for
each of our 16 bytes of memory and we
have a separate enable enable signal for
each of our 16 bytes of memory and so
that could get a little bit unwieldy
so what we'd like to do is be able to
encode which of these 16 bytes were
reading or writing from using an address
because you can represent a number from
0 to 15 using just a 4-bit address so
the way we can do that is using this
address decode logic where we have four
address signals and these four bits
essentially represent which address you
know which of the 16 bytes in memory we
want to we want to talk to and our
address decode logic starts out by you
know basically giving us the address
signals and then an inverted copy of the
address signal so we have a 0 and
inverse of a 0 a 1 inverse of a 1 a 2
inverse of a 2 a 3 inverse of a 3 and
then we just have a bunch of a end gates
and so if if we add together the
inverses of a 0 a 1 a 2 and a 3 this and
gate will only turn on if all of these
address addresses are 0 so if it's 0 0 0
0 then this and gate turns on in our
enable 0 comes on and so that would be
our enable 0 that would enable this this
first row in our address there in our
memory if we had one 0 0 0 so a binary
of 1 then then this hand gate wouldn't
be on but this one would be because a 0
is 1 and then the inverse of a is a 1 a
2 and a 3 is also 1 because a 1 a 2 and
a 3 are zeros
so we have one zero zero zero then this
is this all of all of these signals are
on
and so this angei turns on and so now
we're enabling reading from bite one
which is our second bite here in memory
and so on so you know enable two is zero
one zero zero is essentially what's
coming in on our address lines over here
for three it's one one zero zero which
is binary / 3 4 4 it's zero zero one
zero and so on and so on until we get
down to our 16th byte which is you know
15 because they were zero based and then
that case if our address lines are 1 1 1
1 then this last one comes on we have
enable 15 and that enables reading from
our our 15th row here and of course this
is for our enables and we because we're
also anding it with our enable signal
down here at the bottom and so we'd have
something similar for the right lines as
well so we'd have you know all these
same things added in the in kind of a
similar way with with our with our write
signal down here instead of the enable
signal so this is essentially how we
would go about building a 16 byte memory
now we could do this you know by hand
and build 128 of these of these
individual memory cells but now that you
kind of have an understanding of how it
works I'm actually going to use a chip
that does this for us and that's the 74
LS 189 which if you can't find that you
can also use the 74 189 without the LS
for some reason that's that one's easier
to find but if you can find the LS 189
that's that's fine too but this is a 64
bit random access memory and of course
with 8 bits per byte and 16 bytes that's
8 times 16 is 128 bits this is only 64
bit and that's because it essentially
has a four bit it's four bits wide
instead of eight bits wide but if we use
two of these chips then we'll be able to
build our 8 or 8 bit 16 byte memory and
so I'm going take a look at the data
sheet here they have a block diagram on
the back of what's going on here
and you can see they have a 16 word by
four bit memory cell array and that's
you know basically what we have here of
course we have a 16 word by 8 bit so
they're basically just giving us half of
this which is fine because we can use 2
chips and you can see they have the 4
bits coming in they've got the 4 bits
coming out and there's a chip select and
right enable signals that enable whether
we're we're reading or writing from this
and then you can see the 4 address lines
and you know they just have this address
decoder as a block but of course you
know we just went through how that works
this is essentially what that address
decoder is doing or something very
similar to this and so if we look at the
pin out here just to get a sense of
what's going on you can see you know
like most of these chips we've got our
voltage and our ground to power the chip
but then we've also got our address
lines a 0 a 1 a 2 and a 3 or our address
lines to select which of the rows we're
going to be reading or writing from and
then we have our inputs you know d1 d2
d3 and d4 are our inputs so that's kind
of coming in the top here and then we
have our outputs oh 1 o 2 O 3 and oh
four and something that's a little bit
interesting here that we're going to
have to account for is you'll notice
that our outputs have a little bar over
over them and that's because this chip
for whatever reason the outputs give you
the inverse of whatever stored in that
memory location so you know we're going
to have to end up putting these outputs
through an inverter because you know we
want to store we want to get the same
value out that we stored we don't want
to get the inverse of the value out so
we're gonna have to use some inverter
chips to sort of re inverse these I
guess so we've our inputs or outputs or
address lines and then the only other
pins on here are this CS which is chip
select and that's essentially the enable
so whenever it's an inverse signal so
whenever it's low it's active
which means that when that's lower then
we're going to get data out of our
outputs so in our case we'll just we'll
just high that low all the time and then
we'll use a tri-state buffer like we
have for our other registers and then
write enable and this is also an inverse
logic so when it's low then what it's
reading in from our from our inputs and
writing it to whatever location in
memory is addressed from our address
lines and so that's the basics of how
the 74 LS 189 works and so in the next
video we'll wire this up and play around
with it and and start to build our our
RAM for our computer