Sorting networks can be visualized as combinatorial circuits where a set of denoted compare-swap (CS) circuits can be connected in accordance to a specific network topology. This way the CS circuit is formed by a full adder configured as a subtractor and a pair of multiplexers, the carry of the subtractor is used for the selection of the multiplexer.
# | Input | Output | Bidirectional |
---|---|---|---|
0 | Number 1 | Highest number | |
1 | Number 2 | Second highest number | |
2 | Number 3 | Third highest number | |
3 | Number 4 | Fourth highest number | |
4 | |||
5 | |||
6 | |||
7 | Control |