Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

20. We are studying two implementations of a machine, one with and one without s

ID: 3666234 • Letter: 2

Question

20. We are studying two implementations of a machine, one with and one without special floating-point hardware. Consider a program P with the following mix of operations Floating-point multiply Floating-point add Floating-point divide Integer instructions I 5% 5% 70% Machine MFP (Machine with Floating-point) has floating-point hardware and can therefore implement the floating-point operations directly. It requires the following number of clock cycles for each instruction class Floating point Multiply Floating point Add Floating point Divide Integer instructions 6 cycles 4 cycles 20 cycles 2 cycles Machine MNFP (Machine with No Floating Point) has no floating-point hardware and so must emulate the floating-point operations using integer instructions. Each integer instruction on MNFP takes 2 clock cycles (so its CPI is 2). The number of integer instructions needed to implement each of the floating-point operations on MNFP is as follows Floating point multiply Floating point add Floating point divide 30 integer instructions 20 integer instructions 50 integer instructions Both machines have a clock rate of 1000 MHz (a) Find the MIPS rating for both MFP and MNFP (b) If the MFP machine needs 300 million instructions for the program P, how many integer instructions are needed on the MNFP machine for the same program P? (c) What is the execution time in seconds for program P on MFP and MNFP, assuming the instruction count from part (b)?

Explanation / Answer

a)First, we need to find the number of cycles per instruction for each machine.

Given the data, this is caculated as:

MFP(cpi) = (6 x 0.10) + (4 x 0.15) + (20 x 0.05) + (2 x 0.70) = 3.6 CPI
MNFP(cpi) = (30 x 0.10) + (20 x 0.15) + (50 x 0.05) + (2 x 0.70) = 9.9 CPI

Multiplying by the clock speed, we have:

MFP = 1 GHz / 3.6 CPI = 278 MIPS
MNFP = 1 GHz / 9.9 CPI = 101 MIPS

b)

It really doesn't matter which machine is running the program. Although each machine has a different architecture, they execute the same instruction set and therefore 300,000 instructions on one machine is the same as 300, 000 instructions on the other. They do, however, different cycle requirements. Using the data from above on M2 300,000 instructions means that:

300,000 x 0.10 x 30 = 900,000 cycles are used for multiplication,
300,000 x 0.15 x 20 = 900,000 cycles are used for addition,
300,000 x 0.05 x 50 = 750,000 cycles are used for division,
300,000 x 0.70 x 2 = 420,000 cycles are used for other operations.

This gives a total of 2,970,000 cycles to execute the program.

c)MFP = 300,000 instructions / 278 MIPS = 0.00108 seconds
MNFP = 300,000 instructions / 101 MIPS = 0.00297 seconds