Re: 4way 16 bit multiplexer

Posted by cadet1620 on
URL: http://nand2tetris-questions-and-answers-forum.52.s1.nabble.com/4way-16-bit-multiplexer-tp4025015p4025016.html

Your Mux4Way16 is a correct solution; it passes on my system.

Usually, when a correct part fails its test it is due to a problem in one of the underlying parts that it uses in its implementation.

Note that if you just loaded the built-in Mux4Way16 into the simulator and reran the test, the first thing the test does is reload your HDL so you would still be seeing the result of testing your Mux4Way16.

The way to track this down is to create a test subdirectory under your project 1 directory and copy Mux4Way16.tst and Mux4Way16.cmp into the test directory.  Don't copy any of your HDLs yet.

Run Mux4Way16.tst; it will use the built-in part and should pass.

Copy your Mux4Way16.hdl into the test directory and rerun the test; it should still pass.

Copy your Mux16.hdl into the test directory and rerun the Mux4Way16 test.  If the test fails, there is a problem in Mux16 that the Mux16 test didn't catch.  If it passes, the problem must be in one of the parts that Mux16 uses.

Keep copying HDL files one at a time into the test directory and rerunning the Mux4Way16 test until you find the defective part.

My guess is that one of your Xxx16 parts has a typo in one of the [] indexes that didn't get caught by the Xxx16 test script.

--Mark