# DMux4Way confusion

11 messages
Open this post in threaded view
|

## DMux4Way confusion

 This post was updated on . I have solved DMux4Way twice. Both times, I end up very confused. Solution 1: [Redacted code using And() and Not()] Solution 2: [Redacted code using DMux()] Can anyone help me understand why conditions B and C always feel backwards? Thanks!
Open this post in threaded view
|

## Re: DMux4Way confusion

 Wait... do I have the bit order backwards?
Open this post in threaded view
|

## Re: DMux4Way confusion

 Administrator Look at Fig 1.10 and see what it says. It says that the output should be 'b' if sel[1]=0 and sel[0]=1. What does your logic do under those conditions?
Open this post in threaded view
|

## Re: DMux4Way confusion

 Thanks for the reply! Fig 1.10 seems to indicate that I do indeed have the bit order backwards. Is sel[0] the rightmost bit?
Open this post in threaded view
|

## Re: DMux4Way confusion

 Administrator This post was updated on . Yes. Think of the index in a multibit bus as representing the exponents in a binary representation of a value. Consider our normal base-10 representation. 234 is 2x10^2 + 2x10^1 + 4x10^0 So we could call the individual digits d[2] = 2, d[1] = 3, and d[0] = 4. So if we say d = 234, it is understood that the rightmost digit is d[0] and that the indices then increase as we move to the left. It's the same on a bus representing a binary value. Even if the signals on the bus don't represent a binary value, it is widely customary to number them the same way for consistency.
Open this post in threaded view
|

## Re: DMux4Way confusion

 Administrator BTW, I would agree that the authors didn't make it clear that they are using this convention when they say something like sel = 10 and they really should have.
Open this post in threaded view
|

## Re: DMux4Way confusion

 Got it. Thanks so much for the prompt attention and clear explanation. I will edit my original post to remove the code.
Open this post in threaded view
|

## Re: DMux4Way confusion

 Administrator No problem and thanks for being sensitive to the desire to keep solutions off the board long term. Good luck with the projects as you progress. You should learn a lot!
Open this post in threaded view
|

## Re: DMux4Way confusion

 In reply to this post by WBahn If you use the drop down in the Hardware simulator that says decimal on it, you can change it to binary and see what sel is set to, it's displayed little endian so it'll show the bits from 7-0 left to right.