# Homework 2

## CMSC 411 / Olano, Spring 2012

- Find SPECint and SPECfloat results for two systems by different manufacturers on the SPEC benchmark page (SPECint: www.spec.org/cpu2006/results/cint2006.html, SPECfloat: www.spec.org/cpu2006/results/cfp2006.html). Compare the speedup for a workloads with varying ratios of gcc (in SPECint) and povray (in SPECfloat): 100% gcc, 75% gcc / 25% povray, 50% gcc / 50% povray, 25% gcc / 75% povray, or 100% povray. Be sure to say exactly which systems you compared, and the relevant SPEC numbers for each.
- Write a C program to simulate the "refined version of the multiplier" in Figure 3.6. Use only C constructs equivalent to the blocks in the figure, and print the multiplier, multiplicand and product at each cycle. Include a check that your final result matches the result computed by the built-in multiply.

Note: in C, the 64-bit integer type is "long long". The printf format is %llx (for hex) or %lld (for decimal).

**Assume unsigned only!** (signed for extra credit)
- Write a C program to simulate the "improved version of the division hardware" in Figure 3.12. Once again, use only C instructions equivalent to blocks in the figure, and print the divisor, quotient and remainder at each cycle.

**Assume unsigned only!**
(signed for extra credit)
- Simulate a 32-bit floating point add in C, using only integer operations. You need not deal with the exceptional cases (infinity, NaN or denormalized floats).

**Do allow signed for this one!**
- Extra credit: A naive ray tracing algorithm spends 95% of its time doing ray intersection computation, and negligible time traversing data structures. A smarter ray tracer may avoid unnecessary ray intersection computations by using more complex data structures, spending 60% of its time traversing data structures and 10% on ray intersections. What is the speedup of the smarter ray tracer relative to the naïve one? If the original algorithm took N seconds, what is the breakdown for each part of the execution of both algorithms?

(For the programming parts of this assignment, work on the UMBC GL unix sysems, and submit your work to the class CVS repository following the directions on www.umbc.edu/~olano/cvs/submit.html. Submit the written parts in class.)