4way16Mux

Posted by zdog629 on
URL: http://nand2tetris-questions-and-answers-forum.52.s1.nabble.com/4way16Mux-tp4025681.html

Well I have been working on this problem for a couple days now.
My initial idea was to compare the 16 bit Mux chips to one another in a fashion similar to the 8WayOr gate. The tiered approach. But I cannot seem to sort them properly using the inputs of sel.

CHIP Mux4Way16 {


    IN a[16], b[16], c[16], d[16], sel[2];

    OUT out[16];

    PARTS:
    Mux16 ( a = a[0..15],
                        b = a[0..15],
                        sel = sel[0],
                        out = outa);
    Mux16 ( a = b[0..15],
                        b = b[0..15],
                        sel = sel[0],
                        out = outb);
    Mux16 ( a = c[0..15],
                        b = c[0..15],
                        sel = sel[1],
                        out = outc);
        Mux16 ( a = d[0..15],
                        b = d[0..15],
                        sel = sel[1],
                        out = outd);
        Not  ( in = sel[0], out = notsel0);
        Not     ( in = sel[1], out = notsel1);
        And    ( a = notsel0,
                        b = notsel1,
                        out = x);
        And   ( a = x,
                        b = outa,
                        out = out);
       
       
}

I am aware that outa is a 16 bit input and And only supports 1 bit input. This is where I have hit a roadblock.