Re: mux4way16 selector only accept 0 or 1 ?

Posted by pwolf on
URL: http://nand2tetris-questions-and-answers-forum.52.s1.nabble.com/mux4way16-selector-only-accept-0-or-1-tp4027771p4027778.html

I think i have my solution but im confused when writing the hdl for it. I want to have a dmux that filters the input to either the dmux for a and b or the dmux for c and d,  using sel[1]. THen using sel[0] as the sel for both 2nd layer dmuxs, choose between a or b and c or d.

So far i have written :

CHIP DMux4Way {
    IN in, sel[2];
    OUT a, b, c, d;

    PARTS:
    // Put your code here:
        DMux(in = in , sel = sel[1], a = a, b = b );
        DMux(in = in, sel = sel[0], a = a, b = b );
        DMux(in = in, sel = sel[0], a = c, b = d );


i have no idea how to use the dmux, before the outputs have always just been output , im struggling to get my head around it