Fordham, New York City's Jesuit University
back Back to course home page
Fordham College Lincoln Center Computer Organization
Dept. of Computer and Info. Science Spring, 2005

Homework Assignment 7
Due date: April 7

[10] $<$§3.2$>$ Two friends, Harry and David, are arguing. Harry says, ``all integers greater than zero and exactly divisible by six have exactly two 1s in their binary representation.'' David disagrees. He says, ``No, but all such numbers have an even number of 1s in their representation.'' Do you agree with Harry or with David, or with neither? (Hint: look for counterexamples.) If you agree with one or the other, provide a proof.

[15] $<$§3.2$>$ Monica chimes in: ``Look. All such integers must be divisible by both 2 and 3. You can tell if a binary number is divisible by 2 if it has a 0 as the least-significant bit. You can tell it is divisible by 3 if the sum of successive pairs of bits of the number, each viewed as a two-bit integer, is divisible by 3.''

Sketch out the circuitry that would be required to test a 32-bit unsigned binary integer for divisibility by 6 based on Monica's observations, using small binary adders and minor amounts of additional gates. (That is, do not perform actual division by 3 or 6 anywhere.) If the binary adders are constructed from full-adders, how many full-adders are required for the complete design?

For 10 points extra credit: Prove that Monica's method for testing divisibility by 3 works. (Hint: the method is summing the digits in base 4.)

[5] $<$§5.4$>$ Suppose the MIPS designers wished to include a new instruction
swap $a, $b
which would interchange the contents of registers $a and $b. Explain why it would not be possible to modify the single-cycle implementation to perform the swap instruction without modifying the design of the register file.

Robert Moniot 2005-03-31