My submission says my ALU failed but when I test it on my side it passes?

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

My submission says my ALU failed but when I test it on my side it passes?

MichaelJohnOB
This post was updated on .
Screen_Shot_2023-12-01_at_5.png

The above is a screenshot of it passing on my side. Then when I go to submit it, I get this error:


Any help would be great!
Reply | Threaded
Open this post in threaded view
|

Re: My submission says my ALU failed but when I test it on my side it passes?

MichaelJohnOB
The below is a screenshot of the failure message

Screen_Shot_2023-12-01_at_5.png
Reply | Threaded
Open this post in threaded view
|

Re: My submission says my ALU failed but when I test it on my side it passes?

WBahn
Administrator
In reply to this post by MichaelJohnOB
But that screenshot says that it passed.

Why are you thinking that it failed?
Reply | Threaded
Open this post in threaded view
|

Re: My submission says my ALU failed but when I test it on my side it passes?

MichaelJohnOB
Screen_Shot_2023-12-01_at_9.png

Here is a screenshot of my submission. It says that it fails at line 3. But when I run it on my side, it works just fine.

Here is my code if it helps:

    //FOR X

    Mux16(a=x, b=false, sel= zx, out=outx);

    Not16(in=outx, out=notfinalx);

    Mux16(a=outx, b=notfinalx, sel= nx, out=outfinalx);

    //FOR Y

    Mux16(a=y, b=false, sel= zy, out=outy);

    Not16(in=outy, out=notfinaly);

    //select between x and notx based on zx

    Mux16(a=outy, b=notfinaly, sel= ny, out=outfinaly);

    //For F

    And16(a=outfinalx, b=outfinaly, out=andfinalxy);

    Add16(a=outfinalx, b=outfinaly, out=addfinalxy);

    Mux16(a=andfinalxy, b=addfinalxy, sel= f, out=outxy);

    //For no

    Not16(in=outxy, out=notxandy);

    Mux16(a=outxy, b=notxandy, sel= no, out=out, out=out1);

    //For zr

    And16(a=out1, b=false, out[0..7]=finalout1, out[8..15]=finalout2);

    Or8Way(in=finalout1, out=orout1);

    Or8Way(in=finalout2, out=orout2);

    Or(a=orout1, b=orout2, out=finalorout);

    Mux(a=true, b=false, sel= finalorout, out=zr);

    //For ng

    Mux(a=false, b=true, sel= finalorout, out=ng);
Reply | Threaded
Open this post in threaded view
|

Re: My submission says my ALU failed but when I test it on my side it passes?

WBahn
Administrator
Okay, so by "submission" you are talking about submitting it to some website. Is this the Coursera course?

They are apparently using a different test script than the one on the N2T site. That makes it harder use the reported error to track down the bug since you can't look at the test script to see what the inputs were and what the expected output was.

If it is the Coursera course, I'll pass along to the authors the suggestion that they spend some time providing targeted feedback when errors happen.

When I look at your code, I definitely see issues.

Walk through your code and assume that the input is x=0, y=-1 and all six of the control bits are set (i.e., are 1).

What should the outputs be?

What are they?

Reply | Threaded
Open this post in threaded view
|

Re: My submission says my ALU failed but when I test it on my side it passes?

WBahn
Administrator
In reply to this post by MichaelJohnOB
I just copied your code into an HDL file and ran it against the test script and I got a comparison error on Line 3.

So the problem appears to be with your test script. Where did you get it (or, perhaps more relevant, when did you get it)?

Here's a copy of the one I have.

ALU.tst

EDIT: Accidentally uploaded the wrong file.
Reply | Threaded
Open this post in threaded view
|

Re: My submission says my ALU failed but when I test it on my side it passes?

MichaelJohnOB
In reply to this post by WBahn
Thank you! It turns out I was using the wrong test script. It was labeled, "ALU-basic.tst" I was able to solve the issue and figure out the errors. Again, incredibly helpful.
Reply | Threaded
Open this post in threaded view
|

Re: My submission says my ALU failed but when I test it on my side it passes?

WBahn
Administrator
Glad to hear it. Enjoy the next steps.