Mux4Way16 question

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

Mux4Way16 question

billjg0
This post was updated on .
edited:  got my answer
Reply | Threaded
Open this post in threaded view
|

Re: Mux4Way16 question

cadet1620
Administrator
billjg0 wrote
I accidentally got the solution by trial and error but I don't understand why this works

[Working version]

and this doesn't

[Non-working version]

from this:
out = a if sel == 00
        b if sel == 01
        c if sel == 10
        d if sel == 11
sel[1] looks perfect to me as that is the element that varies (for a vs b and c vs d).  what am I missing here?
Hardware bits are numbered from RIGHT to LEFT, so it is sel[0] that is changing between a/b and c/d.

When you start working with binary numbers in chapter 2, you'll see that this makes sense because then bit[n] on a bus is the 2^n bit of the binary number.

Please edit your post to remove the HDL. We don't want working code to remain on the forum.

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

Re: Mux4Way16 question

billjg0
makes sense now.  thanks