0

When I run ALU-nostat.tst, the code executes perfectly. However, when I run ALU.tst, the code stops on line 1. If I then click the forward arrow again and allow it to test out the following test cases, it seems to work. I compared the output file generated with the compare file and I think that everything matches. The error seems to be before the cases are tested out because the output file is empty (only with the input and output column headers) before I click the forward arrow again.

set x %B0000000000000000,  // x = 0

^ is the line where the test script stops. It is strange because it does not stop here:

set x %B0000000000000000,

on the no-stat script.

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);`

Even after commenting out all of the new lines for the zr and ng output pins, it is still giving me a comparison failure on line 1.

It is not a problem with ALU.tst as I re-downloaded it and it still does not work. I do not understand what the error is.

Many thanks!!!!

1 Answers1

0

This is just a wild guess, but I noticed that the set y line in alu.tst ends in a ; while the one in alu-nostat.tst ends in a ,

Same goes for the other set y later in the file.

I would change those ;'s to ,'s and see if it fixes the issue.

If it doesn't, it may be that your ALU isn't generating the zr and ng values correctly so it's really failing on the first eval but for some reason you're getting a misleading error message pointing you to the wrong line. I would suggest you single-step through the tests and manually check to the ALU is responding correctly.

Good luck!

MadOverlord
  • 1,034
  • 6
  • 11
  • Thank you so much for the reply! I will try this and let you know how it goes. – CuriousCoder Mar 29 '22 at 12:30
  • When I go through step by step, the error is on the first line (set x %B0000000000000000, // x = 0). I tried changing the punctuation in the ALU.tst file to no avail. I also tried running the solution on the internet and used their test file and hdl file. I still got the same error. (Note that the solution on the internet was from 2016, and the book has been updated, but I don't know why that would matter). I don't know what to try next. My compare file is identical to the alu.cmp file. Do you have any suggestions? – CuriousCoder Apr 08 '22 at 03:09
  • I ran your chip design on my computer (Mac, using Hardware Simulator 2.5). It appears to work correctly. I do not get the error you get. My best guess is that you have some weird problem with your computer or with the text files (my files are UTF-8 and use Windows CRLF to denote the EOL character). I would suggest you do a clean install on a different computer and see if the behavior is different. – MadOverlord Apr 11 '22 at 09:43
  • Thank you! I am going to do a clean install. – CuriousCoder Apr 12 '22 at 13:21