Mux4Way16 Problem - Help

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Mux4Way16 Problem - Help

Veneficus
Ok, here is what I have. I have created a separate Mux4, which uses a selector to pick one out of four values. And after that, I am calling it 16 times in the Mux4Way16. However, it only displays 1 when the selector is 11... I have uploaded the files. Could someone please help me?

Thanks.

P.S. The code is commmented.Mux4.hdl Mux4Way16.hdl
Reply | Threaded
Open this post in threaded view
|

Re: Mux4Way16 Problem - Help

albert
Mux4 is not necessary at all. The selector to pick one of the four values already is the chip Mux4Way16.

I'll give you a hint. For implementing the Mux4Way16 chip is only necessary five Mux16 chips.

Regards
Reply | Threaded
Open this post in threaded view
|

Re: Mux4Way16 Problem - Help

cadet1620
Administrator
Albert wrote
I'll give you a hint. For implementing the Mux4Way16 chip is only necessary five Mux16 chips.
Think about it a bit more -- you can do it with 3 Mux16 chips. Think about trees and symmetry.
Mux8Way16 can be made with 3 chips, too.

Re: Veneficus' Mux4Way:
You don't need to make your own 0 and 1; read Appendix A, A.5.2.

    And(a=First, b=Left, out=Left1);
    And(a=Third, b=Left, out=Left2);
    //If it is left, which one?
    And(a=Left1, b=Left2, out=WhichLeft);

Aren't Left1 and Left2 exclusive? Only one of them can be 1 so WhichLeft is always 0.

--Mark
Reply | Threaded
Open this post in threaded view
|

Re: Mux4Way16 Problem - Help

Albert
Yeah, I've got it working with 3 Mux16 chips instead of 5.

Yesterday I did it fast without realizing it was possible to build it with 3. Thanks Mark for the answer and for all the answers you are doing....

Albert
Reply | Threaded
Open this post in threaded view
|

Re: Mux4Way16 Problem - Help

Veneficus
Guys, I thank you very much for your suggestions. Indeed, I have the theory in mind. But here is my problem. I have decided to use a Mux for a and b, and c and d respectively, using the second digit of the selector as the selector.

This gives the following ouput

0 0          a c
0 1          b d
1 0          b c
1 1          b d

After that, I decided to use Mux on the results, using the same selector. Mux(a, c, sel[1]). This will work for only three of them, however. It will work for the first, the third and the last pair. But instead of selecting b in the second one, d will get selected. I cannot work it out... no matter what I use. And, Or, XOR. It is the same. What am I doing wrong? What could be the third HDL line? I am not trying to get the solution for free, since I am working as hard as I can to figure it out.

Reply | Threaded
Open this post in threaded view
|

Re: Mux4Way16 Problem - Help

cadet1620
Administrator
Right idea, but use sel[0] first.

sel[1]sel[0]output
00a
1b
10c
1d

Read the columns right to left and you should see how the three Mux16s work.

Send me mail if you still don't get it and I'll give you more direct help.

--Mark

Reply | Threaded
Open this post in threaded view
|

Re: Mux4Way16 Problem - Help

Veneficus
This is just to inform the others that the problem has been solved. I was confused by the fact that everything starts from the right. So if I have x, y, z in an array called A, then, in order to access z, it's going to be A[0], not A[2], as you would use in C++ or any other modern programming languages and architectures. So if anyone has a confusion about this, know that 0 is the rightmost bit. Problem solved and thank you, Cadet.
Reply | Threaded
Open this post in threaded view
|

Re: Mux4Way16 Problem - Help

cadet1620
Administrator
Mostly correct, but it's helpful to think of HDL as wiring parts together rather than programming.  See this post: Helpful HDL Philosophy.

--Mark