I need to implement a datapath for the following problem: "Design a combinational logic device that will take as input three unsigned numbers x, y, and z, and output the sum of the largest of the two. You may use any of our combinational datapath components in your design: MUXes, decoders, adder/subtractors, comparators, and individual logic gates as the need arises. Do not use sequential logic devices such as registers or flip flops."
I am having trouble with this because I feel like no matter which way I compare I will get the largest of the three twice and the answer will be wrong. For instance if x = 1, y = 3, and z = 2, then the sum should be 5 because 3 and 2 are the largest two. But if we use a comparator to get x and y, we will get 3 since 3 is larger, and if we use another comparator to compare y and z, we will also get 3 which gives us 6 as our total sum. Do we need to compare x and z as well to get the second largest? In that case we will get the largest integer twice and the second largest once. so we will get 3, 3, and 2. Should I use another comparator then and compare 3 and 3 and just pass through 3, but also have another comparator that checks to see which number is LESS than the other? So for instance we already have one 3 passing through, so compare the other 3 with the 2 and since 2 is less than 3, pass 2 through and add the remaining 3 and 2? Along with these comparators we will have MUX's that will let the appropriate input pass through based on the select input from the comparator.
Is this correct?