Login  Register

Re: can't load chip

Posted by cliverlong on Dec 27, 2022; 5:56pm
URL: http://nand2tetris-questions-and-answers-forum.52.s1.nabble.com/can-t-load-chip-tp4036223p4037000.html

I had the same symptom with Hardware simulator 2.5. The following may help. Check these and see if they help solve your problem

I am running Nand2tetris 2.5 on Windows 10.

1. Every statement, except comment and closing bracket, in HDL file must end with a semi-colon. Check the examples provided.

2. There is a difficult-to-see error message line at the bottom of the Hardware simulator window. In my situation this message line was hidden by the Windows taskbar. This line may contain an explanation of the problem - mine did. I can't get the Hardware simulator window to size well on the Windows desktop.

3. Ensure the name of your chip next to the keyword "CHIP" in the implementation section is the same as the name of your hdl file. So if I have an HDL file:

CRL1.hdl

the CHIP statement must be CRL1 (probably case sensitive).

4. Do not use a Part that is the name of the HDL - e.g. if you are modifying And.HDL do not use "And" within parts. If you try to load such a HDL file  the hardware simulator gives message "Loading CHIP"  in the difficult-to-read message line and never ends - I guess there is some kind of endless loop situation going on where And.HDL is trying to load itself.
It is only possible to have a PARTS that contains a gate that is the same as the HDL file name by using BUILTIN - for example see the definition of XOR in section 1.5.1.

5. If Chip gate2.HDL uses gate1 in PARTS, and gate1.HDL tries to use gate1 in parts (or any recursive call in a "gate hierarchy") then when trying to load the original gate2.HDL, the loading never completes - as in point 4 above.


I know saying there is a bug in software is a very "touchy" subject, but I have two suggestions for the software:

1. Make the (error) message line more clearly visible on a Windows screen (haven't checked on other platforms). Maybe move it from the bottom of the simulator window to somewhere where it can't be hidden. Maybe the sizing of the java windows isn't working quite right in Windows 10/ the java version my machine is running?

2. Add a check that an HDL file can't call itself e.g. And.HDl can't have And( ... ); in PARTS.