Re: DMUX4WAY
Posted by
WBahn on
Apr 12, 2020; 6:42am
URL: http://nand2tetris-questions-and-answers-forum.52.s1.nabble.com/DMUX4WAY-tp4034403p4034406.html
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=<someSignal1>, sel=<someSignal2>, a=<someSignal3>, b=<someSignal4>);
The <someSignaln> 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.