Building block to sort two numbers The 2 number sorter is a basic building block used for sorting higher number of inputs The building block of two number sorter is as shown It has two inputs and two outputs The two inputs A and B are sorted and are given out as a high number H and low number L 2 number sorter A B H L
Sorting four numbers using the 2 number sorter Four numbers are sorted using the 2 number sorter as shown 2 number sorter A B C D H1 L1 H2 L2 HH LL HL LH
Eval component eval A B C z x A2 eval A4 A3 A1 A0 Y An evaluator component is as shown It takes three integer inputs A, B, C and gives one integer output Z Z = A * B + C Implementing the function given with the eval components Y = A0 + A1 * X1 + A2 * X2 + A3 * X3 + A4 * X4 or Y = ( ( (A4 * X + A3 ) * X + A2 ) * X + A1 ) * X + A0 eval A B C z x A2 eval A4 A3 A1 A0 Y