Re: Mux4way16 problem

Posted by WBahn on
URL: http://nand2tetris-questions-and-answers-forum.52.s1.nabble.com/Mux4way16-problem-tp4035690p4035739.html

Idrisadeniyi wrote
Alright. below is the hdl:

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

    PARTS:
    // Put your code here:
        And (a=in, b=in, out=lo);
        DMux (in=in, sel=sel[0], a=a, b=b);
        DMux (in=lo, sel=sel[0], a=x1, b=x2);
        DMux (in=x1, sel=sel[1], a=c, b=z2);
       
       
}
Draw out the circuit. You have the 'in' signal going to both sides of an And gate. Any signal 'And'ed with itself is just the signal. So that And gate does nothing.

You aren't driving the 'd' output at all.

You are producing this 'x2' signal and doing nothing with it.

Think about what you are trying to do in terms of a car going down a road into a forest and at the other side of the forest are four roads coming out. In the forest are some forks and each fork has a light next to it. If the light is off, the car takes the left fork but if it is on the car takes the right fork. The forks are the Mux gates and the lights are controlled by the 'sel' input. Can you connect a few of these forks with roads in order to get the car to the desired exit road but using two switches to control the lights at the forks?