How to implement hardware for a 3-number sorter?

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:

How to implement hardware for a 3-number sorter

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.

Subscribe

Enter your email to get updates from us. You might need to check the spam folder for the confirmation email.

Leave a comment