I'm trying to construct a greater than or equal to operation by adding some logic gates or building blocks (i.e. multiplexor and decoder) to my current 32-bit ALU

I'm not quite sure how to do this and nothing on google comes up for this operation from what I could tell.

ALU Design:

enter image description here

Question: How do I add a greater than or equal to operation to the current ALU? Also can you explain the changes you make so I can understand what's going on, thank you!

  • 3
    $\begingroup$ Sorry but "please design a circuit for me" is essentially the same question as "please write a program for me" and such questions are off-topic, here. Probably, you want to use $x\geq y \Leftrightarrow x-y\geq 0$. $\endgroup$ – David Richerby Oct 10 '17 at 8:45

David Richerby's comment is right, in that the typical way it's "done" is to perform a subtraction and examine the "carry out" bit.

But I think it's worth stepping back for a moment and making a general comment about modern ALU design which may help you.

Thanks to Moore's Law, the number of transistors (and hence gates) required to implement a functional unit is not a serious limitation. Moreover, integer ALUs are not even close to the most power-hungry components of a modern CPU. So the main thing that needs to be conserved in a modern integer ALU design is propagation delay.

For essentially-single-cycle operations such as logic and add/subtract arithmetic, many modern integer ALUs are designed so that all potential operations are performed in parallel, and the "correct" one is selected with a multiplexer. This has the advantage that some of the multiplexer logic can be performed in parallel with the ALU operation, which again saves on propagation delay.

The same technique is used in floating point, incidentally. When performing a IEEE-754 floating point operation, the typical final step is that the result needs to be rounded correctly, using some logic which involves testing the answer and the FPU's current rounding mode. Many "real" FPUs essentially duplicate circuitry for some of the operation, performing three versions in parallel ("round up", "round down", and "pass through") and using a final multiplexer stage to decide which one to keep.

Of course, in real CPUs, ALUs typically aren't designed at the gate level these days, they are designed at the transistor level. So, for example, the multiplexer stage is probably achieved with high-impedance outputs followed by an amplifier stage to clean up the signal.

| cite | improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.