Another Mux4Way16 question (sorry)

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

Another Mux4Way16 question (sorry)

HighSchoolerWhoAsksHowTooMuch
Hi everybody. I have been loving going through this process of building a computer from Nand chips.

My Mux4Way16 chip is implemented as such:

Mux16(a=a[0..15],b=d[0..15],sel=sel[0], out=q);
    Mux16(a=c[0..15],b=b[0..15],sel=sel[1], out=z);
    Xor(a=sel[0],b=sel[1],out=h);
    Mux16(a=q, b=z, sel=h, out = out[0..15]);

However, I get a comparison failure at line seven. Here is the error:

My chips .out:
a| 0001001000110100 b| 1001100001110110 c| 1010101010101010 d| 0101010101010101 sel|  01  out| 1010101010101010 |

Actual .out:
a| 0001001000110100 b| 1001100001110110 c| 1010101010101010 d| 0101010101010101 sel|  01  out| 1001100001110110

I don't understand why an input of 0 0 1 0 with a sel of 01 would output 1, as it does in the third "column" of my input.
Reply | Threaded
Open this post in threaded view
|

Re: Another Mux4Way16 question (sorry)

HighSchoolerWhoAsksHowTooMuch
Changing the second line to

Mux16(a=b[0..15],b=c[0..15],sel=sel[1], out=z);

fixes the problem. I do not understand why.