I have to subtract two binary numbers, each two bits long.
so the numbers are x0x1 and y0y1. the result z0z1 has to be the absolute value.
At my disposal are: a two bit subtractor (ie it subtracts two numbers of two bits each and puts out two bits which is the result)
I also have a magnitude comparator for two number each two bits.
The magnitude comparator has three outputs: x > y, x = y, x < y
I also have 4 xor gates.
I figured the best way to approach this problem is to let the subtractor do the subtraction and if y0y1 > x0x1 then swap the inputs to the subtractor.
I'm thinking that I have to somehow use the 4 xor gates and the magnitude comparator to do the switching if the case above is true. but I can't figure out how.