got java.lang.StackOverflowError when loading a hdl

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

got java.lang.StackOverflowError when loading a hdl

snakemia
I copy exactly every letter from the tutorial, but I do not get why there is always a stackoverflow problem when that hdl file is loaded.

Here is the hdl file:
// 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/01/Xor.hdl

/**
 * Exclusive-or gate:
 * out = not (a == b)
 */

CHIP Xor {
    IN a, b;
    OUT out;

    PARTS:
    Not(in=a, out=nota);
    Not(in=b, out=notb);
    And(a=a, b=notb, out=w1);
    And(a=nota, b=b, out=w2);
    Or(a=w1, b=w2, out=out);
}

Reply | Threaded
Open this post in threaded view
|

Re: got java.lang.StackOverflowError when loading a hdl

cadet1620
Administrator
I don't have any problems loading your Xor.hdl on my system.

It looks like the simulator is stuck in a recursive loop trying to load the HDL file.

Try putting the Xor.hdl in a folder with no other HDL files in it.  This will tell you if the problem is with the simulator installation or with one of the HDL files that Xor is trying to use.  If the Xor is in an otherwise empty folder, it is forced to use the built-in And, Or and Not chips.

(For example, a common error to make when writing your first HDL is to erroneously have Not.hdl using a Not chip in its PARTS section.  This usually leads to a hang rather than a stack overflow, however.)

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

Re: got java.lang.StackOverflowError when loading a hdl

snakemia
Thanks for answering my question :)
 I have found the reason just after I posted this problem. It was because I wrote Not.hdl in a wrong way :|
Reply | Threaded
Open this post in threaded view
|

Re: got java.lang.StackOverflowError when loading a hdl

abcdexter
In reply to this post by cadet1620
Merci :)