Confused in the implementation of Memory.hdl

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Confused in the implementation of Memory.hdl

Thorvald
I am lost in the implementation of the Memory.hdl chip. There are several things for which I am lost.

(Taking figure 5.7)
First thing: in does it correspond to input from Keyboard or it's just some other thing we would like to store in
memory?

Second thing: Screen has an out parameter, is this the same out as in the out --/--> arrow?

I am also confused in that if the output of the keyboard do I have to redirect it to the screen, if no, then where this memory address goes?

Actually, I do not understand why do you need address[15]. Since the RAM16 take address[14], Screen[13], this will give me intuitively the last bit of the address[15] to decide if I would access to the RAM or to the Screen, but leaving out the Keyboard.
Reply | Threaded
Open this post in threaded view
|

Re: Confused in the implementation of Memory.hdl

ybakos
The Memory chip is very similar to the other memory chips you built in the earlier project. You are provided a Screen chip and a Keyboard chip. These are really smaller memory chips that you will use to build Memory. Screen has an out that should be wired, somehow to the out of Memory. Keyboard has no input, because you need to imagine that it is wired directly to a physical keyboard.

Here's a hint. Look at the diagram for Memory with addresses. What are these numbers in binary? Can you notice a significant (hint) part of the addresses that helps you distinguish between whether or not input/output addresses indicate whether or not RAM16K, Screen or Keyboard is being addressed?

Reply | Threaded
Open this post in threaded view
|

Re: Confused in the implementation of Memory.hdl

Thorvald
In reply to this post by Thorvald
Actually my implementation so far is:

    DMux(in=load, sel=address[14], a=id0, b=id1);
    RAM16K(in=in, load=id0, address=address[0..13], out=outRAM);
    //Keyboard(out=keyout);
    Screen(in=in, load=id1, address=address[0..12], out=outSCREEN);
    Mux16(a=outRAM, b=outSCREEN, sel=address[14], out=out);

but I don't know where to fit the Keyboard. I mean, what is exactly the output parameter of it? Does it go to the Screen, or to the out --/--> part?

Reply | Threaded
Open this post in threaded view
|

Re: Confused in the implementation of Memory.hdl

ybakos
Look at figure 5.7, write down the binary representations of the addresses you see, and I bet you'll see what you need to do.
Reply | Threaded
Open this post in threaded view
|

Re: Confused in the implementation of Memory.hdl

Thorvald
Thank you so much, I have ran the test and succeeded it.

So at the end the out amounts for the three different outputs from the RAM, Screen and Memory. It is the same as when one constructs the RAM's, except for this "nasty" trick at the end of it:

Mux4Way16(a=outRAM, b=outRAM, c=outSCREEN, d=keyout, sel=address[13..14], out=out);
Reply | Threaded
Open this post in threaded view
|

Re: Confused in the implementation of Memory.hdl

Nick Lee
Hey Thorvald, I too got stuck on the implementation of Memory.hdl. I am curious what you meant by the "nasty" trick at the end of it. Would appreciate if you (or anyone else) could elaborate on that?
Reply | Threaded
Open this post in threaded view
|

Re: Confused in the implementation of Memory.hdl

cadet1620
Administrator
What the output mux is doing is selecting which internal part's output is returned based on the memory address:
a[14] a[13]    Part
----------------------
  0     0     RAM16K
  0     1     RAM16K
  1     0     Screen
  1     1     Keyboard
Because RAM16K is twice as big as Screen, it connects to both 'a' and 'b' inputs.

Because there are no other devices in the memory address space above Keyboard, it is OK to return Keyboard for all of those addresses.

--Mark
Reply | Threaded
Open this post in threaded view
|

Re: Confused in the implementation of Memory.hdl

l3hu4l1
this helped my understanding a ton, thanks!