so the last video we ought mented our
16-byte ram module with an address
register a 4-bit address register that
we can then switch between the address
register and our programming mode which
allows us to set the address with these
dip switches and we can see the address
here and we can see the memory contents
here in this video what I want to do is
do something similar for the the actual
data that we're storing in memory so
right now we have these 8 bits which
right now I've just connected down here
to looks like they're all set to ones
but instead we want to connect these two
to some sort of input that's either
going to take the data to store off the
bus or take it from dip switches so very
similar to this and so again we're going
to use the 74 LS 157 s to switch between
the dip switches and the bus for the
data that we're storing in memory and so
again we want to give ourselves a little
bit more room so I'm going to use
another breadboard here and I'm going to
connect it right here because we're
going to do this right below here
actually I'm also going to connect below
this the instruction register which we
built in a previous video and we're not
really going to be using the instruction
register at all for this but just when
we put the final computer together this
is a good place for it so we'll just
we'll just have that there so like I
said what we want is we want some dip
switches here when we're in programming
mode we'll be able to set the address
here we'll be able to set the data here
to write data into memory and that's how
we get our program into memory before we
actually start running things on the
computer and then to switch between
using the switches to program the
computer and actually being able to let
the computer put things in its memory on
its own from the bus we want to use
those 74 LS 157 chips that we that we
looked at in the last video so it has
these a and B inputs and a Y output and
you select between a and B using the
Select pin here since we have eight bits
here instead of the four instead of
using one of these chips we'll we'll
need to and we'll start of course by
hooking up the power and ground for each
of these chips and then just as we did
up here we have this
pin 15 which is the strobe input
connected to ground and that's
essentially just kind of an enable line
for the whole chip so whenever that's
low the chip is enabled so go ahead and
connect pin 15 here to ground and this
one's going to be a little bit tricky
because I have these LEDs in the way but
let me pull this out for a moment and we
can kind of slide that in and put the
LED back in there hopefully in the right
place okay so that's hooked up and then
next what I'm going to do is I'm going
to connect the outputs got four lines on
each of these we have total of eight
lines that we're selecting between
either the dip switches or will it be
the bus that we end up connecting into
the the B inputs here but first I'll
start with connecting the outputs of
these into the the data inputs of our
memory so that whichever source we're
selecting from the output is going to go
into our memory so we're writing that
debt byte into memory
okay so I think that is everything so we
can pull these out and now all of the
outputs of our of our selectors should
be going to the data inputs of our
memory so we should be able able to well
once we hook up our dip switches and our
bus we should either either be able to
program the memory from the dip switches
or you know data coming in from the bus
should be able to find its way into the
memory so now to hook up the dip
switches it's going to be very similar
to what we did up here which is we're
going to be using the dip switches to
connect the implore the a inputs on both
of these to ground when the switch is on
so for example this will connect the a
input of this first this first bit or
the sort of the most significant bit
here to ground when the switch is on and
of course for that to work I need to
connect this side of it to ground so
when that's on then it connects ground
to input and then when it's off it's
disconnected which means that the inputs
going to default to high because all of
the inputs on these on these have
pull-up resistors built into these chips
if it's not connected the input will be
high and again just like we did here
because it's kind of unintuitive for the
switch to be down meaning high and up
meaning zero or so down as a1 up as a
zero I'm going to just flip this switch
upside down
so that way when the switches are down
they're on and then when we flip the
switch up the switch turns off and so
when it's off it's not connected to
ground which means it's going to be a1
and when it's on when it's down it is
connected to ground and it's a zero so
go ahead and connect the the rest of
these
and of course for these inputs up here
then I'll just connect the connect them
through the switch the other way and
connect the grounds down here and then
they just connect up into these pins up
here and then turn around the wires back
and forth okay and that should be
connecting our dip switches up to the a
inputs of the 74 LS 157th now the B
inputs of the 74 LS 157 s so the a
inputs are when we're in programming
mode so in programming mode we set our
address here we set our our data value
here and then we can write using this
signal and we'll hook up a push-button
for this in a moment
use this signal to put whatever value we
set here into the address that we set
here and that's how we program the
computer it's how we put data into the
into the memory before we start the
computer when we go into run mode then
when we want to write data into the
memory it's going to be coming from the
bus and the bus and then when we want to
read data from memory it goes out to the
bus through these tri-state buffers but
to get data in from the bus we want to
bring that down into the B inputs of our
74 LS 157 our selectors here I'm going
to go ahead and hook that up now
okay so that now connects the bus which
which is going to be connected here on
these eight bits that that extends that
bus into the selectors here so that'll
be the normal run mode but then when
we're in program mode instead of reading
data from the bus will be reading data
from our dip switches here and so the
way the programming will work is will
will switch over to program mode set the
address we want a program here set the
data that we want to put in that address
here and then we want to toggle our
write of course to do that it would be
nice to have a little push button switch
so I've got that here stick that in
there and so this will just be a little
button that we can push to write the
data so once we put the address that we
want to write it to and put the data
here push that button and it'll write it
to 2 there but of course again we want
to be able to switch between using this
button to write to memory and the
computer being able to have a control
signal that's going to come from the
control logic of the computer to tell it
that we want to write data into the
memory so this this write signal that's
going into the memory now has to be
switched depending on whether we're in
program mode or not so of course to do
that we're going to use another 74 LS
157 which I'll put right here so this
right signal is going to come from the
output of one of the one of the
selectors in this 150 in the 74 LS 157
actually should have maybe connected our
power here first get that underneath
there's a power and course ground and
then again pin 15 of this 74 LS 127 is
the essentially the enable signal so if
we want to set that low so that the chip
is enabled it a low active low signal
there so that that's that and so when
we're in program mode we want the this
push button to to essentially take the
program sit or the write signal here low
whenever we push it so we'll connect
the switch from from ground through the
switch and then into the the a input of
our 74 LS 157 so the a input is is the
input that we'll be using when we're in
program mode and then when we're in run
mode this could be a little bit
different in run mode we want to
essentially take the signal from from
the control logic so the control logic
in the computer which we'll get to in
future videos at some point while
programs are executing it's going to say
hey I want to write to memory so it'll
it'll set this right signal but we don't
want it to necessarily write immediately
when the right signal gets set because
we want the right signal to say okay on
the next clock cycle we're going to
write to memory but then we have want to
wait for that clock cycle so really we
want the right signal to be a
combination of the the right signal from
the control logic as well as the clock
signal and actually specifically the
rising edge of the clock so what I'm
going to do is essentially and together
using a NAND gate the clock signal and
the control signals saying that we want
to write to memory so I'm going to use a
74 LS 0 0 which which actually is not a
NAND gate it's a NAND gate and the
reason I want two NAND gate is because
this is an active low so a NAND gate is
going to say when the write signal is
high and the clock signal is high then
output a zero and the zero is the thing
that tells the the memory the 74 LS 189
s in this case to actually you know take
the data from the bus and write it so
first let me hook up the power for the
74 LS 0 0 the NAND gate we're just going
to use one of the NAND gates on here's
the pin out is pin 1 and pin 2 or the
inputs and pin 3 is the output so I'm
going to hook pin 3 here over here to
the B input of our selector so hook that
to
be input of our of our selector so
whenever this NAND gate is outputting a
zero and we're in run mode then the
selector will will feed that zero on
through to the memory and we'll will end
up writing whatever whatever data is
coming in so one of these inputs is
going to be the control signal that's
coming from our our control logic which
will you know touch on in a verbal we'll
build it in a future video and go into
it so when that's low then we're not
writing and then if that goes high then
we will be writing something into memory
so we'll have that low the other input
is going to be from our clock go ahead
and connect this up to our our clock
signal just kind of bring that bring
that back down here and so this is
saying when the clock is high and our
our write signal is high then this goes
low which then is passed through I think
we can go ahead and test this out and
see see what happens if we power it up
as we can see our clock is running there
and we see of course we have some random
random data here if we go into write
mode we can set our address so if we set
the address 0 this should write whatever
value we have on our dips which is here
so we have all zeroes we hit that
nothing happens hmm oh of course so we
don't we're not actually selecting here
I neglected to to connect the actual
select pins so remember these 74 or less
157 s we want to select whether we're
programming or writing and of course we
have this hooked up pin 1 is the Select
pin you can see pin 1 here is connected
over to this red LED which goes low when
we go into into write mode we need to
bring that that signal down here so that
when we switch to write mode these guys
are also selected in write modes let me
disconnect power and go ahead and do
that
and so that should tie all of our
selects for all four of the 74 LS 157 so
three down here and the one up here
to the same switch years and so I think
that should be almost everything for the
RAM module so I'll go ahead and pause
here and in the next video we'll power
it up and test things out a little bit
more thoroughly