# Ideal less-than-or-equal circuit for multiple inputs?

I'm interested in what the best way is to design a circuit that takes multiple values as input, and then outputs which value is the lowest. If multiple values are the lowest, it outputs "true" for each of them. Does anyone know an ideal design? For example, are there any classical "text-book examples" of one (or if someone has their own, it is also great. )

# My own effort

I came up with a circuit myself, but it is hard to know if it is actually a good design or just something "that works" but might be very inoptimal. It finds the lowest value by that each candidate submits bits only as long as they win for each bit (from highest to lowest) and "stay in the game". It then simply NANDs the bits submitted (for each bit height) to see if everyone had a one or if someone had a zero. Each candidate then checks if their value was higher than the submitted lowest value, and they will remove themselves from the game if they were (via the AND gates that flow from the OR:ed result of the NANDs. ) Each candidate that is the lowest value (also if there are multiple candidates with that value) will output true at "winner".

The schematic below shows it for four inputs each with four bit values.

This question is similar to a previous question I asked but focuses on the less-than-or-equal circuit while the other one was broader about interrupt controllers. Often better to ask precise, easy to answer questions. The schematic is also edited for this question, removing the "interrupt pending" option that was fed into the other schematic.

I asked previously about circuits here a year ago and got really good answers showing that my design was far from optimal, and learnt a lot. So doing another try here. I'm very interested in an answer, so that I can get better at circuit design.

• I would not call this operator "less-than-or-equal", but rather "minimum" or "is-minimum".
– user16034
Jul 26, 2023 at 13:46
• might be a better term for it, good point Jul 26, 2023 at 16:25
• Besides an ad-hoc circuit, you can form a cascade of pairwise minimum operators, and after you have computed the global minimum, perform comparison for equality of all input numbers.
– user16034
Jul 26, 2023 at 16:44
• on a processor you mean? otherwise seems like it would require a lot more parts than my design. my interest in this is how modern interrupt controllers sort interrupts by priority, and I've assumed they use an ad hoc circuit for that and not a processor/software (why I tried to come up with how they might design it) but I could be wrong, really don't know where to search to find out if I am or not, probably because these things are usually proprietary Jul 26, 2023 at 17:06
• could be it uses microcode program when an interrupt occurs, and does the priority check. both work I guess. thanks for your feedback. Jul 26, 2023 at 17:17