# DMUX4WAY

13 messages
Open this post in threaded view
|

## DMUX4WAY

 Wondering if someone can explain to me what the number IN square brackets represents? For example below is the parts list I came up with for DMUX4WAY. I could not get it to work when I had originally used sel=sel[0]  , sel=sel[1] sel=sel[1] in place of what is below for the selectors. When I get DMUX8WAY to work the architecture seems different again for the DMUX4WAY used to build it. sel[0]=sel[0] etc.... Thanks DMUX4WAY PARTS:     // Put your code here:     DMux(in=in, sel=sel[1], a=c1, b=c2);     DMux(in=c1, sel=sel[0], a=a, b=b);     DMux(in=c2, sel=sel[0], a=c, b=d); DMUX8WAY PARTS:     // Put your code here: DMux(in=in, sel=sel[2], a=c1, b=c2); DMux4Way(in=c1, sel[0]=sel[0], sel[1]=sel[1], a=a, b=b, c=c, d=d); DMux4Way(in=c2, sel[0]=sel[0], sel[1]=sel[1], a=e, b=f, c=g, d=h);
Open this post in threaded view
|

## Re: DMUX4WAY

 Administrator The number in square brackets on the DMUX4WAY means the same thing that it did on the other multi-bit and multi-way gates that came before it. Go back and revisit those and make sure you understand them. Reread sections 1.2.3 and 1.2.4 very carefully.
Open this post in threaded view
|

## Re: DMUX4WAY

 I have read and re-read but it doesn't make sense to me why the selector has to begin with 1 in the first Dmux. Let me explain what I think I understand and maybe you can tell me where I am going wrong. I understand that there are 3 selectors as per the 3 Dmux chips we are using here to build the Dmux4Way(each of my Dmux chips have 2 inputs being in,and sel as well as 1 output). I would figure we could call/label the Dmux`s selectors  "sel" and then assign them numbers 0,1,and 2 being that there are 3 selectors.If I did name them as such I would do so in order and end up with something like; Dmux(in=in, sel[0]=sel[0], a=c1, b=c2); Dmux(in=c1, sel[1]=sel[1], a=a, b=b); Dmux(in=c2, sel[2]=sel[1], a=c, b=d);
Open this post in threaded view
|

## Re: DMUX4WAY

 Administrator jayjay wrote I have read and re-read but it doesn't make sense to me why the selector has to begin with 1 in the first Dmux. Let me explain what I think I understand and maybe you can tell me where I am going wrong. I understand that there are 3 selectors as per the 3 Dmux chips we are using here to build the Dmux4Way(each of my Dmux chips have 2 inputs being in,and sel as well as 1 output). I would figure we could call/label the Dmux`s selectors  "sel" and then assign them numbers 0,1,and 2 being that there are 3 selectors.If I did name them as such I would do so in order and end up with something like; Dmux(in=in, sel[0]=sel[0], a=c1, b=c2); Dmux(in=c1, sel[1]=sel[1], a=a, b=b); Dmux(in=c2, sel[2]=sel[1], a=c, b=d); Look at the interface for the Dmux chip. It only has a 1-bit sel signal. The four signals for the Dmux chip are {in, sel, a, b}, so those are the exact signal names you have to use when you hook it up. So your part instantiation needs to be Dmux(in=, sel=, a=, b=); The  is the name of the wire connecting the parts together. Look back at the diagram in Figure 1.6. In each of the part instantiations, the name on the left side of the equals sign is the name of one of the ports for that part, while the name on the right is the name of a wire in the schematic at the top of the diagram. Draw out your schematic for how you want to hook up the parts and put them in a box that has the inputs and outputs of the chip you are building crossing it. After you have it wired like you want it, give each wire a unique name (the wires connected to the pins on the box already have a name -- the name of the box pin). Then just use those names to connect the parts in your HDL netlist.
Open this post in threaded view
|

## Re: DMUX4WAY

 In reply to this post by jayjay I am stuck at this too. It was already hard for me to wrap my head around DMux in the first place,  because of the two outputs.  This one has two sel inputs and four outputs. The only tip given in the book about multiway gates is "Think forks". It worked wonderfully for Mux but I have no idea how to do it for DMux. Can someone please give me another tip, so hopefully I can at least get a foothold in and solve this? I can't wait to get to the next chapter. Thanks in advance.
Open this post in threaded view
|

## Re: DMUX4WAY

Open this post in threaded view
|

## Re: DMUX4WAY

 This post was updated on . I spent an embarassing amount of time on this one, but I came up short. I found DMux4Way (eureka moment came at 4am while I was trying to sleep, it is a bit of an abomination but it works.) but couldn't really do it with DMux8Way. I don't think my iq points were quite up to the task for this one. I read some old posts here, apparently it's possible to do it with 3 DMux4ways, even though most solutions I saw on github used a lot of Dmuxs.
Open this post in threaded view
|

## Re: DMUX4WAY

 Administrator There are several ways to do it. Think of the road example again. If we put a fence around the forks in the road described above, I have one road going in to the fenced area and four roads coming out of it with two lights on my dash telling me what to do at both decision points that I have to make. Sounds a lot like a DMux4Way, right? Now what if the first thing that happens is I come across there is a fork in the road and I have a third light on my dash telling me to go left or right. Whichever way I go I encounter a fenced in area like the one above. How many total lights do I have on my dash? How many total eventual road options are available to me? You don't need 3 DMux4Ways, just two plus a normal DMux (and three Not gates).
Open this post in threaded view
|

## Re: DMUX4WAY

 This post was updated on . Recently I have been doing a lot of programming/learning to program, so I tend to think a lot about conditionals, which I think prevents me from finding an answer. My thought process tends to go like this: There are 8 total outputs: a, b, c, d, e, f, g, h. If sel[0]=0, we are left with 4 outputs: a, b, c, d. And then if sel[1]= 0, we eleminate the last two, and left with a, b. And finally if sel[2]=0, then in=a. I just keep thinking this way but I don't know exactly how to translate it into the script. (I don't even know if it's the correct way to think about it.) Thank you  for the tip, I will give this one a shot and try to do it with 2 DMux4ways, 1 DMux and 3 Not gates and see if I can come up with a solution of my own.
Open this post in threaded view
|

## Re: DMUX4WAY

 Administrator Your diagram is EXACTLY what you are looking for. And I was overlooking something in my mind -- you don't need the Not gates at all -- they are already built into the DMux parts. Do see the fences. What's inside each fence? Wires connect parts the same way that roads connect fenced areas.
Open this post in threaded view
|

## Re: DMUX4WAY

 (I used lightshot to avoid giving away the solution to people who may not want it.) In a futile attempt to translate the diagram into a script, I came up with this. This did not work so I gave a shot to this. And it worked. What the hell? All this time (over a week) spent scratching my head and it was because of the order of sels? Anyway, I also came up with a more elegant solution. I think this is the best it's going to get. Time to get to the next chapter. (so much for one week per chapter thing.) Thank you so much for taking the time to help. In retrospect I should have asked for help earlier, that way I wouldn't have second guessed myself all the time and come up with a solution much faster. (I tried the solution I posted first here like 100 times because it made sense in my head but it just wouldn't work.) Really appreciate it.