Hello everybody, and thanks for the help!

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

Re: sorry i forget about mux16

WBahn
Administrator
michael1978 wrote
i mean, i have to use for ALU a lot of MUX IC components, and he use only 8 MUX IC 74LS157, me i have to use 24 MUX IC 74LS157, i dont know what to do
Again, how can we help you determine what you could do different when we don't know what you did in the first place? This would be like me asking on a car repair forum why it took me six hours to tune up my car when it only took some guy on YouTube two hours, but not providing ANY details about how I went about tuning up my car. How could I expect anyone to give me a useful answer?

You have his design. Do you understand how it works? If so, then start looking at where your design is the same as his and then at where it is different. If not, then perhaps figuring that out is a better place to start.

Since you seem primarily concerned about the muxes, try listing what each of the muxes does in your design and then identify what each of the muxes does in his design. Then look at one of the muxes in your design that doesn't correspond to mux in his and figure out how he accomplished the task that you used a mux for without using one.

Taking a step further back, have you successfully implemented and tested your design within the Nand2Tetris framework (i.e., using those parts and their simulator and their test files)?
Reply | Threaded
Open this post in threaded view
|

Re: sorry i forget about mux16

michael1978
This post was updated on .
hello
yes i simulate, is working perfect
here my HDL
CHIP ALU {
    IN  
        x[16], y[16],  // 16-bit inputs        
        zx, // zero the x input?
        nx, // negate the x input?
        zy, // zero the y input?
        ny, // negate the y input?
        f,  // compute  out = x + y (if f == 1) or out = x & y (if == 0)
        no; // negate the out output?

    OUT
        out[16], // 16-bit output
        zr, // 1 if (out == 0), 0 otherwise
        ng; // 1 if (out < 0),  0 otherwise

    PARTS:
        // code snipped by admin (it served its purpose)
}

so here i use 6 MUX
Reply | Threaded
Open this post in threaded view
|

Re: sorry i forget about mux16

WBahn
Administrator
michael1978 wrote
hello
yes i simulate, is working perfect
here my HDL
CHIP ALU {
    IN  
        x[16], y[16],  // 16-bit inputs        
        zx, // zero the x input?
        nx, // negate the x input?
        zy, // zero the y input?
        ny, // negate the y input?
        f,  // compute  out = x + y (if f == 1) or out = x & y (if == 0)
        no; // negate the out output?

    OUT
        out[16], // 16-bit output
        zr, // 1 if (out == 0), 0 otherwise
        ng; // 1 if (out < 0),  0 otherwise

    PARTS:
       // code snipped
}

so here i use 6 MUX
It's perfectly reasonable to use 6 Muxes here. It's not necessary and an actual implementation likely wouldn't, but especially for this project where matching the implementation to the conceptual model has value, it's perfectly legitimate.

In practice, if you want to either pass a signal or zero it you simply pass it through an AND gate with a control signal going to the other input. If you want to either pass or invert it, you simply pass it through an XOR gate with a control signal going to the other input.
Reply | Threaded
Open this post in threaded view
|

Re: sorry i forget about mux16

michael1978
hello....thnx for answer
but i dont understand you so good
is here posibble to reduce use of mux ic?
Reply | Threaded
Open this post in threaded view
|

Re: sorry i forget about mux16

WBahn
Administrator
michael1978 wrote
hello....thnx for answer
but i dont understand you so good
is here posibble to reduce use of mux ic?
It's always possible to reduce the use of the Mux part -- If nothing else, you can always implement it using nothing but two-input Nand gates.

There are usually multiple ways to accomplish any task (unless it's super simple) and there are likely more than one that are perfectly reasonable.

In this case, let's look at just the portion where we want to use the zx signal to either pass the X input to the next part or pass a LO signal on all sixteen bits. Conceptually, using the zx signal as the channel-select input to a Mux that chooses either the X-input or a static LO is perfectly reasonable since it matches the goal we are trying to achieve extremely well.

But let's consider an alternative. Take just the lsb of the X-input and apply it to one input of an And gate. Now take the zx signal and complement it (pass it through a Not gate) to get a signal (let's call it zxb) and apply that to the other input of the And gate. Notice that if zx is LO (making zxb HI) then the output of the And gate is the same as the lsb of the X-input; but if zx if HI (making zxb LO) then the output of the And gate is LO regardless of the value of the lsb of the X-input. Now just do the same thing for each of the sixteen bits of the X-input (applying each bit to one input of an And gate and applying the same zxb signal to the other).

Can you see how you can do something similar to implement the nx functionality using Xor gates instead.
 
Reply | Threaded
Open this post in threaded view
|

Re: sorry i forget about mux16

michael1978
hello sir, thanks and i did in logisim, the zx but again i have to use 4 AND gat and 4 NOT gate, you know, why i say because cadet1620 he use LESS IC, how he did it, i dont know,
Reply | Threaded
Open this post in threaded view
|

Re: sorry i forget about mux16

WBahn
Administrator
michael1978 wrote
hello sir, thanks and i did in logisim, the zx but again i have to use 4 AND gat and 4 NOT gate, you know, why i say because cadet1620 he use LESS IC, how he did it, i dont know,
WHERE in the design are you talking about????

If you are talking about inside the ALU, then keep in mind that cadet1620's schematic (in Post #2 of this thread) shows the entire ALU as a single chip, so you can't see how many gates he used for it. If you are referring to a design he has for the ALU in some other thread, then please include a link to the post containing the schematic. I'm not a mind reader.

Also keep in mind that the ICs he used are multi-gate packages. Each 74LS08 contains four 2-input AND gates while a 74LS10 contains three 3-input NAND gates.

If you want to understand his design for the CPU, then start by identifying the main functional components. The ALU is easy to spot. Next identify the A register and the D register. Then identify the program counter. Then identify the Mux that controls which data gets sent to the A register and the Mux that controls which data gets sent to the Y-input of the ALU. Pretty much everything that is left is the instruction decode logic.

Reply | Threaded
Open this post in threaded view
|

Re: sorry i forget about mux16

michael1978
ooh soryy my frind, cadet1620's schematic (in Post #2 of this thread) i thougt is ALU, BUT NOW I SEE is CPU i use also the same,

have a nice day thankssss
12