it runs correctly, but when the test script run the following inputs:
set a %B0001001000110100,
set b %B1001100001110110,
set c %B1010101010101010,
set d %B0101010101010101,
it stops at "set sel 2", giving me a "Comparison failure at line 7". This line should output c (1010101010101010, which I think is 43690 in decimal), but it outputs -21846 (which is kind of similar to the d value 0101010101010101, in decimal 21845).
Again, I don't know what I did wrong. I think that the design of the gate is ok
Re: Mux4Way16 not working, can someone help me please?
Look at Line 7 in the .cmp file and you will see that, for this test, sel = 01, meaning that sel = 0 and sel = 0. The output for this line should be 'b'. But you are outputting 'c'.
Remember that values that start with a 1 are negative numbers.
So look at what your logic is doing for the case that is failing, namely when sel = 1, meaning that sel = 0 and sel = 1.
With sel = 1, the 'x' signal is 'c' and the 'y' signal is 'd'. That right there means that the final output cannot be 'b', it must either be 'c' or 'd'. With sel = 0, the 'x' signal is chosen, so the final output is therefore 'c'.
Let's see if this agrees with what you are observing.
c = B1010101010101010
This is a negative number in 2's complement and is equal to -21,846.