unsigned int f( unsigned int i, j ) { if (i > (j + 1)) { return i; } else if (j > (i + 1)) { return j; } else { return (i + j) >> 1; } }
Part A: How can you use hardware to compare the magnitude of two unsigned numbers? (Hint: subtraction is involved!)
Part B: Given a mechanism that solves part A, suggest a register-transfer level realization of the above function. Adders, incrementers, multiplexors, comparators and shifters are appropriate primitive components for this design.
Historical note: The PDP-8 was sold between 1965 and approximately 1990; the original version used discrete transistors while the final version marketed used a monolithic microprocessor implementation of the CPU (the Intersil/Harris 61xx processor family). In the 1960's, this was the most successful minicomputer on the market. The final family member to be sold was the DECmate III+ word processor.