RAM4K would'nt load on my simulator. HELP!!

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

RAM4K would'nt load on my simulator. HELP!!

thatwillchaiguy
This post was updated on .
Hi all,

My RAM512, DMux8Way, and Mux8Way16 are all working fine. However, when I try to load RAM4K, it does not work. Here is the HDL:

 
// This file is part of www.nand2tetris.org
// and the book "The Elements of Computing Systems"
// by Nisan and Schocken, MIT Press.
// File name: projects/03/b/RAM4K.hdl

/**
 * Memory of 4K registers, each 16 bit-wide. Out hold the value
 * stored at the memory location specified by address. If load=1, then
 * the in value is loaded into the memory location specified by address
 * (the loaded value will be emitted to out after the next time step.)
 */

CHIP RAM4K {
    IN in[16], load, address[12];
    OUT out[16];

    PARTS:
    DMux8Way(in=load,sel=address[9..11],a=load0,b=load1,c=load2,d=load3,e=load4,f=load5,g=load6,h=load7);
    RAM512(in=in,load=load0,address=address[0..8],out=out0);
    RAM512(in=in,load=load1,address=address[0..8],out=out1);
    RAM512(in=in,load=load2,address=address[0..8],out=out2);
    RAM512(in=in,load=load3,address=address[0..8],out=out3);
    RAM512(in=in,load=load4,address=address[0..8],out=out4);
    RAM512(in=in,load=load5,address=address[0..8],out=out5);
    RAM512(in=in,load=load6,address=address[0..8],out=out6);
    RAM512(in=in,load=load7,address=address[0..8],out=out7);
    Mux8Way16(a=out0,b=out1,c=out2,d=out3,e=out4,f=out5,g=out6,h=out7,sel=address[9..11],out=out);
}








Reply | Threaded
Open this post in threaded view
|

Re: RAM4K would'nt load on my simulator. HELP!!

WBahn
Administrator
Are you sure the parts you are using have their HDL files in the same directly as this part?
Reply | Threaded
Open this post in threaded view
|

Re: RAM4K would'nt load on my simulator. HELP!!

thatwillchaiguy
Yes, they are. All the .hdl, .tst, and .cmp are in the same directory. All the chips from Not gate all the way to RAM512 work (I've tested). But when I tried to load RAM4K, it just shows "Loading Chip" (as shown in the image from OP). I've also made sure RAM512 is named in upper case and in the RAM4K.hdl .

Virus-free. www.avg.com

On Thu, Apr 23, 2020 at 7:37 PM WBahn [via Nand2Tetris Questions and Answers Forum] <[hidden email]> wrote:
Are you sure the parts you are using have their HDL files in the same directly as this part?



To unsubscribe from RAM4K would'nt load on my simulator. HELP!!, click here.
NAML
Reply | Threaded
Open this post in threaded view
|

Re: RAM4K would'nt load on my simulator. HELP!!

WBahn
Administrator
I copied your code into a file and it loaded fine.

Try copying and pasting the code into a new file. Perhaps there is a non-ASCII character in the file that is causing problems.




From: thatwillchaiguy [via Nand2Tetris Questions and Answers Forum] <ml+[hidden email]>
Sent: Friday, April 24, 2020 12:39 AM
To: William Bahn <[hidden email]>
Subject: Re: RAM4K would'nt load on my simulator. HELP!!
 
Yes, they are. All the .hdl, .tst, and .cmp are in the same directory. All the chips from Not gate all the way to RAM512 work (I've tested). But when I tried to load RAM4K, it just shows "Loading Chip" (as shown in the image from OP). I've also made sure RAM512 is named in upper case and in the RAM4K.hdl .

Virus-free. www.avg.com

On Thu, Apr 23, 2020 at 7:37 PM WBahn [via Nand2Tetris Questions and Answers Forum] <[hidden email]> wrote:
Are you sure the parts you are using have their HDL files in the same directly as this part?



To unsubscribe from RAM4K would'nt load on my simulator. HELP!!, click here.
NAML



To start a new topic under Project 3, email ml+[hidden email]
To unsubscribe from Nand2Tetris Questions and Answers Forum, click here.
NAML
Reply | Threaded
Open this post in threaded view
|

Re: RAM4K would'nt load on my simulator. HELP!!

thatwillchaiguy
So I put the file into the folder where it holds all the built-in chips and then RAM4K load and runs fine. It just would not load when I place it in the folder consists of all the chips I previously built.

I ran and test every single chip before RAM4K and they all work fine!! I watched the video and understand to test the chip we build with built in chips. But then how am I building this if it wont load on top of my layers
Reply | Threaded
Open this post in threaded view
|

Re: RAM4K would'nt load on my simulator. HELP!!

WBahn
Administrator
E-mail me all of your .hdl files that are in that folder and I will take a look and see if I can spot the problem.
Reply | Threaded
Open this post in threaded view
|

Re: RAM4K would'nt load on my simulator. HELP!!

thatwillchaiguy
Thanks in advance for all your help!

Virus-free. www.avg.com

On Fri, May 1, 2020 at 12:44 PM WBahn [via Nand2Tetris Questions and Answers Forum] <[hidden email]> wrote:
E-mail me all of your .hdl files that are in that folder and I will take a look and see if I can spot the problem.



To unsubscribe from RAM4K would'nt load on my simulator. HELP!!, click here.
NAML

Project.zip (70K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: RAM4K would'nt load on my simulator. HELP!!

thatwillchaiguy
In reply to this post by WBahn
Hi WBahn,

So I figured out what I did wrong. I was moving the files out from the original directory. After rewatching the videos (unit 3.5 in particular), I found out that the files need to be in folders as given because the hardware simulator is not designed to test all these chips all at once and therefore chips like RAM4K will crash if loaded that way. By placing RAM512, RAM4K and RAM16K in a separate folder, it forces the simulator to dig in and look for the JAVA implementation of the built in chips.

Thank you so much for your help! I am good to go now! All the best and stay healthy!
Reply | Threaded
Open this post in threaded view
|

Re: RAM4K would'nt load on my simulator. HELP!!

WBahn
Administrator
In reply to this post by WBahn
The problem is that you are doing precisely what the authors cautioned you not to do.

You are trying to simulate the entire RAM16K part all the way down to every last NAND and DFF part. Read the paragraph in Section 3.5 on the directory structure for this project.

They put the RAM512, RAM4K and RAM16K parts in a separate directory specifically because the entire thing  is going to contain tens of thousands (more like hundreds of thousands and almost certainly over a million) parts. That is going to bring the simulator to its knees.

Just change the name of the RAM64 part to _RAM64 (so that the simulator uses the built-in RAM64 part) and you will see that your RAM16K passes with no problems.

You can actually walk this down to see the impact. Restore the RAM64 and rename the RAM8. You may or may not notice a significant increase in the amount of time it takes to run the test. Then restore it and rename Register. You will probably notice a significant increase by this point. My machine took about half a minute to run the tests.
Reply | Threaded
Open this post in threaded view
|

Re: RAM4K would'nt load on my simulator. HELP!!

thatwillchaiguy
Yeah I was too excited to jump into the project and missed some of the stuff. Terrible Idea. I appreciate the explanation you gave above, it helped a lot.

On Fri, May 1, 2020 at 1:24 PM WBahn [via Nand2Tetris Questions and Answers Forum] <[hidden email]> wrote:
The problem is that you are doing precisely what the authors cautioned you not to do.

You are trying to simulate the entire RAM16K part all the way down to every last NAND and DFF part. Read the paragraph in Section 3.5 on the directory structure for this project.

They put the RAM512, RAM4K and RAM16K parts in a separate directory specifically because the entire thing  is going to contain tens of thousands (more like hundreds of thousands and almost certainly over a million) parts. That is going to bring the simulator to its knees.

Just change the name of the RAM64 part to _RAM64 (so that the simulator uses the built-in RAM64 part) and you will see that your RAM16K passes with no problems.

You can actually walk this down to see the impact. Restore the RAM64 and rename the RAM8. You may or may not notice a significant increase in the amount of time it takes to run the test. Then restore it and rename Register. You will probably notice a significant increase by this point. My machine took about half a minute to run the tests.


To unsubscribe from RAM4K would'nt load on my simulator. HELP!!, click here.
NAML