If sorting of 3 numbers must complete in 1 cycle, then the optimal solution is to use 3 comparators. The diagram below shows the implementation:

This design can easily be pipelined, if timing becomes an issue.
If it is not required to get the array sorted in a single cycle, then the above implementation can be further optimized. Assuming the array must be sorted in 3 or more cycles, then we can span the sorting stages into multiple cycles, and eventually, a single sorter is enough.
The solution we discussed above is highly customized for this particular problem. What if we want to implement a 4-number sorter? What to do for an 8-number sorter? We strongly recommend interviewees to check out our “Hardware Array Sorting” blog series for more information.

Leave a comment