Simulator crashes when loading chip
Posted by dave on
URL: http://nand2tetris-questions-and-answers-forum.52.s1.nabble.com/Simulator-crashes-when-loading-chip-tp3289029.html
I am trying to build a 32-bit register out of two 16-bit registers as follows:
CHIP Register32 {
IN in[32], load;
OUT out[32];
PARTS:
Register(in=in[0..15], out=out[0..15], load=load);
Register(in=in[16..31], out=out[16..31], load=load);
}
However, loading this chip crashes the hardware simulator with this exception:
Exception in thread "Thread-35" java.lang.ArrayIndexOutOfBoundsException: 16
at Hack.Gates.PinInfo.isInitialized(Unknown Source)
at Hack.Gates.CompositeGateClass.addConnection(Unknown Source)
at Hack.Gates.CompositeGateClass.readPinNames(Unknown Source)
at Hack.Gates.CompositeGateClass.readParts(Unknown Source)
at Hack.Gates.CompositeGateClass.<init>(Unknown Source)
at Hack.Gates.GateClass.readHDL(Unknown Source)
at Hack.Gates.GateClass.getGateClass(Unknown Source)
at Hack.HardwareSimulator.HardwareSimulator.loadGate(Unknown Source)
at Hack.HardwareSimulator.HardwareSimulatorController$LoadChipTask.run(Unknown Source)
at java.lang.Thread.run(Thread.java:680)
Is this a bug in the simulator or am I not seeing an indexing mistake in my code?
Thanks in advance.