ALU working except for comparison failure at line 1.

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

ALU working except for comparison failure at line 1.

HighSchoolerWhoAsksHowTooMuch
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.
Reply | Threaded
Open this post in threaded view
|

Re: ALU working except for comparison failure at line 1.

HighSchoolerWhoAsksHowTooMuch
The strange thing is that ALU-nostat.tst does work even though the first line is identical.
Reply | Threaded
Open this post in threaded view
|

Re: ALU working except for comparison failure at line 1.

HighSchoolerWhoAsksHowTooMuch
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);
Reply | Threaded
Open this post in threaded view
|

Re: ALU working except for comparison failure at line 1.

HighSchoolerWhoAsksHowTooMuch
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.
Reply | Threaded
Open this post in threaded view
|

Re: ALU working except for comparison failure at line 1.

HighSchoolerWhoAsksHowTooMuch
Should I move on to chapter 3?
Reply | Threaded
Open this post in threaded view
|

Re: ALU working except for comparison failure at line 1.

WBahn
Administrator
Since it stops running and comparing as soon as it finds the first failure, seeing a failure at Line 1 does not bode well.
Reply | Threaded
Open this post in threaded view
|

Re: ALU working except for comparison failure at line 1.

HighSchoolerWhoAsksHowTooMuch
But if I then click run afterward it works without failure. So lines two onwards work.
Reply | Threaded
Open this post in threaded view
|

Re: ALU working except for comparison failure at line 1.

HighSchoolerWhoAsksHowTooMuch
In reply to this post by WBahn
In my ALU.test file, I don't have the Compute ~x block. I saw that on github in 2014, somebody's ALU.test did have this line. Mine has a !x line instead.
Reply | Threaded
Open this post in threaded view
|

Re: ALU working except for comparison failure at line 1.

HighSchoolerWhoAsksHowTooMuch
In reply to this post by WBahn
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.
Reply | Threaded
Open this post in threaded view
|

Re: ALU working except for comparison failure at line 1.

HighSchoolerWhoAsksHowTooMuch
In reply to this post by WBahn
Should I try to redownload the simulator?
Reply | Threaded
Open this post in threaded view
|

Re: ALU working except for comparison failure at line 1.

HighSchoolerWhoAsksHowTooMuch
In reply to this post by WBahn
I have tried changing out the test file and the hdl file with a solution on the internet to no avail. If I post my hdl file, could somebody run it on their computer to see if the error is with my simulator? Many thanks!


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