Re: ALU working except for comparison failure at line 1.
Posted by HighSchoolerWhoAsksHowTooMuch on
URL: http://nand2tetris-questions-and-answers-forum.52.s1.nabble.com/ALU-working-except-for-comparison-failure-at-line-1-tp4036695p4036707.html
In case it helps, the code is below.
PARTS:
Mux16(a=x[0..15],b[0..15]=false,sel=zx,out=x1);
Not16(in=x1,out=maybex);
Mux16(a=x1,b=maybex,sel=nx,out=x2);
Mux16(a=y[0..15],b[0..15]=false,sel=zy,out=y1);
Not16(in=y1,out=maybey);
Mux16(a=y1,b=maybey,sel=ny,out=y2);
And16(a=x2,b=y2,out=output1);//I dont know what is wrong here
Add16(a=x2,b=y2,out=output2);
Mux16(a=output1,b=output2,sel=f,out=output3);
Not16(in=output3,out=almost);
Mux16(a=output3,b=almost,sel=no,out=out);
Mux16(a=output3,b=almost,sel=no,out[15]=pt2);
Mux16(a=output3,b=almost,sel=no,out=pt3);
And(a=pt2,b=true,out=ngtest);
Add16(a=pt3,b[0..15]=true,out[15]=pinname);
Mux(a=pinname,b=false,sel=ngtest,out=zr);
And(a=pt2,b=true,out=ng);