Problem with the stat values zr and ng

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

Problem with the stat values zr and ng

63rrit
Hello,
i managed to pass the ALU-nostat test but i fail to find the errors in my last parts.

the last lines of my ALU (spoiler alert):

CODE_________________________________________________________________________________________________________________________
        Mux16 (a[0..15]=mux3, b[0..15]=mux3not, sel=no, out[0]=ngmux, out[0..7]=finalmux1, out[8..15]=finalmux2, out[0..15]=out[0..15]);
        //last part of the computation (everything until here should be correct because the nostat test was passed)

        Or8Way (in[0..7]=finalmux1, out=zr1);
        Or8Way (in[0..7]=finalmux2, out=zr2);
        Or (a=zr1, b=zr2, out=zror);
        Not (in=zror, out=zr);
        And (a=zror, b=ngmux, out=ng);

CODE_________________________________________________________________________________________________________________________

Reply | Threaded
Open this post in threaded view
|

Re: Problem with the stat values zr and ng

ybakos
Consider the jobs of determining negativity or 0 as two separate tasks - you seem to be mixing them together.

Hint: How do you know a number is negative?

You are wiring the least significant bit, out[0] to ngmux. Instead, what should be simply wired to ng?

Reply | Threaded
Open this post in threaded view
|

Re: Problem with the stat values zr and ng

63rrit
Hey ybakox,

thanks a lot. those mistakes were quite dumb after all.
got it working now.