Assignment 6, due Mar 23
Part of
the homework for 22C:60 (CS:2630), Spring 2012
|
On every assignment, write your name legibly as it appears on your University ID card! Homework is due on paper at the start of class on the day indicated (usually Friday). Exceptions will be made only by advance arrangement (excepting "acts of God"). Late work must be turned in to the TA's mailbox (ask the CS receptionist in 14 MLH for help). Never push homework under someone's door!
unsigned int timespi( unsigned int i ) { return (i * 333)/106; }
Note that, to 64 bits of precision in hex, 1/106 = 0.026A439F656F1826
a) Write the fastest SMAL Hawk instruction sequence you can find to multiply by 333, using the tricks discussed in Chapter 9 of the notes and Chapter 14 of the Hawk manual. (0.5 points)
b) Write the fastest SMAL Hawk instruction sequence you can find to divide by 106, using all the tricks. (0.5 points)
a) Shifting the value 1 place left. (0.2 points)
b) Shifting the value 6 places left. Strong hint: Yes, 6 repetitions of the code from part a) will work, but the problem can be solved in half as many instructions. (0.8 points)
a) Explain the most important difference between the two. Your explanation must be concise and at a high level. (0.4 points)
b) Modify the code from Section 14.3 so it computes the 64-bit product of two unsigned 32-bit operands. (Hint: the modification required involves changing exactly one instruction.) (0.6 points)