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

SHORT ANSWER: A compiler designer is trying to decide between three code sequenc

ID: 3890367 • Letter: S

Question

SHORT ANSWER:

A compiler designer is trying to decide between three code sequences for a particular machine. Based on the hardware implementation, there are three different classes of instructions: Class A, Class B, and Class C, and they require one, two, and three cycles (respectively).

            Code 1 uses 300 of A, 200 of B, and 200 of C

            Code 2 uses 400 of A, 200 of B, and 100 of C

            Code 3 uses 500 of A, 200 of B, and 100 of C

            Code 4 uses 100 of A, 100 of B, and 300 of C

What is the CPI for code 4 (to one decimal place)?

Explanation / Answer

CPI for code 4:

=>(100*1 )+ (100*2) + (300*3) / 500

=> (100+200+900)/500

=>2.4

Therefore CPI of code 4 = 2.4