Posted by
WBahn on
URL: http://nand2tetris-questions-and-answers-forum.52.s1.nabble.com/Mux4way16-problem-tp4035690p4035694.html
Very often spending the time to find a way to express something we are unsure about has the effect of making a light click on and letting us see some of the key points that are causing us problems in such a way that we might be able to solve it ourselves. Happens very frequency.
I really don't know how you expect us to tell you why your output is producing the error you are getting when you won't show us what your output even is.
You don't have give us the full output, just the part relevant to the error.
For instance, you say you have a comparison failure on line 12. So take the .cmp file and make a copy of it (or bring it into an editor and change it, but don't save it!) and keep the first row and delete all of the lines except line 12 (and perhaps a line or two above it). Then do the same for the .out file (being sure to keep the same lines). Then post both here.
As an example, this might look something like:
Mux8Way16.cmp (last line is line 12)
| a | b | c | d | e | f | g | h | sel | out |
| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 001 | 0010001101000101 |
| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 010 | 0011010001010110 |
Mux8Way16.out (last line is line 12)
| a | b | c | d | e | f | g | h | sel | out |
| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 001 | 0010001101000101 |
| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 010 | 0110011110001001 |
Given this, it can quickly be seen that, with sel='010' that the comparison file is saying that the output should match input 'c' (which is correct), while the output file shows that it is matching input 'f'. But 'f' should be selected only when the sel input is '101'.
Do you see how much more information is available for us to use in trying to help you?
I don't see this as being an absurd thing to ask for, or receive.
You might also ask yourself how many bits the sel input is on a Mux4Way16 and whether or not you are providing sel inputs to it that are the proper width.