Login  Register

Re: 16Mux Problems

Posted by linuxford on Mar 18, 2012; 2:47am
URL: http://nand2tetris-questions-and-answers-forum.52.s1.nabble.com/16Mux-Problems-tp2946612p3835757.html

It seems like that there is not a way to code an array of muxes in the PARTS: section of the MUX16 and that I will have to add 16 lines of code there (16 MUX calls), is this correct? With MUX16 it seems like a copy-n-paste problem, not an issue, but what if you had a MUX64. Do people typically script it to modify the hdl code?

It seems my solution will be something like this.

CHIP Mux16 {
    IN a[16], b[16], sel;
    OUT out[16];

    PARTS:
    Mux(fill in details);  // Mux 1
    Mux(fill in details);  // Mux 2
    Mux(fill in details);  // Mux 3
    Mux(fill in details);  // Mux 4
    Mux(fill in details);  // Mux 5
    Mux(fill in details);  // Mux 6
    Mux(fill in details);  // Mux 7
    ...
    Mux(fill in details);  // Mux 16
}

Thanks for the insights and help