CSCI 370 Computer Architecture: Homework 1

Due date: On or before Tuesday, February 13, 2025
Absolutely no copying others’ works
Name: ____Professor Hu____

  1. (60% total) Consider two different implementations of the same instruction set architecture. The instructions can be divided into three classes according to their CPI (class A, B, and C). The clock rate and CPI of each implementation are given in the following table:

      Clock rate CPI Class A CPI Class B CPI Class C
    P1 3.0 GHz 3 2 2
    P2 3.5 GHz 4 3 2

    1. (30%) Given a program with a dynamic instruction count of 105 instructions divided into classes as follows: 30% class A, 40% class B, and 30% Class C, which implementation is faster?
      Hint: You have to find the execution times.
      Ans>
        P1 is faster because of the following calculation:
      • number of instructionsA = 105 instructions × 30% = 3×104 instructions
      • number of instructionsB = 105 instructions × 40% = 4×104 instructions
      • number of instructionsC = 105 instructions × 30% = 3×104 instructions

      • time = number of instructions × CPI ÷ clock rate
      • P1:
        • timeA = (3×104 instructions) × (3 cycles/instruction) ÷ (3.0×109 cycles/second) = 3.00×10-5 seconds
        • timeB = (4×104 instructions) × (2 cycles/instruction) ÷ (3.0×109 cycles/second) = 2.67×10-5 seconds
        • timeC = (3×104 instructions) × (2 cycles/instruction) ÷ (3.0×109 cycles/second) = 2.00×10-5 seconds
        • total timeP1 = 3.00×10-5 + 2.67×10-5 + 2.00×10-5 = 7.67×10-5 seconds
      • P2:
        • timeA = (3×104 instructions) × (4 cycles/instruction) ÷ (3.5×109 cycles/second) = 3.43×10-5 seconds
        • timeB = (4×104 instructions) × (3 cycles/instruction) ÷ (3.5×109 cycles/second) = 3.43×10-5 seconds
        • timeC = (3×104 instructions) × (2 cycles/instruction) ÷ (3.5×109 cycles/second) = 1.71×10-5 seconds
        • total timeP2 = 3.43×10-5 + 3.43×10-5 + 1.71×10-5 = 8.57×10-5 seconds

    2. (15%) What is the global CPI for each implementation?
      Hint: global CPI = execution time × clock rate ÷ number of instructions, where the execution time can be found from the solution of the previous question.
      Ans>
        CPI = time × clock rate ÷ number of instructions
      • CPIP1
        = (7.67×10-5 seconds) × (3.0×109 cycles/second) ÷ (105 instructions)
        = 2.30 cycles/instruction
      • CPIP2
        = (8.57×10-5 seconds) × (3.5×109 cycles/second) ÷ (105 instructions)
        = 3.00 cycles/instruction

    3. (15%) Find the clock cycles required in both cases.
      Ans>
      • clock cyclesP1
        = (3×104 instructions × 3 cycles/instruction) + (4×104 instructions × 2 cycles/instruction) + (3×104 instructions × 2 cycles/instruction)
        = 2.3×105 cycles
      • clock cyclesP2
        = (3×104 instructions × 4 cycles/instruction) + (4×104 instructions × 3 cycles/instruction) + (3×104 instructions × 2 cycles/instruction)
        = 3.0×105 cycles

  2. (40% total) The following table shows the results of the SPEC CPU2006 bzip2 benchmark running on an AMD Barcelona:

    Instruction Count×109 Execution Time (seconds) Reference Time (seconds)
    1800 600 5000

    1. (15%) Find the CPI if the clock cycle time is 0.25 ns.
      Ans>
        CPI = Clock rate × CPU time ÷ Instruction count
      
        Clock rate = 1 ÷ Cycle time = 1 ÷ (0.25×10-9 seconds/cycle) 
                   = 4.0×109 cycles/second = 5.0 GHz
      
        CPI = (4.0×109 cycles/second) × (600 seconds) ÷ (1800×09 instructions)
            = 1.33 cycles/instruction
    2. (10%) Find the SPECratio.
      Ans>
        SPECratio = Reference time ÷ Execution time
        SPECratio = 5000 / 600 = 8.33
    3. (15%) Find the increase in CPU time if the number of instructions of the benchmark is increased by 20% without affecting the CPI.
      Ans>
          [(CPU timeafter - CPU Timebefore) ÷ CPU timebefore] × 100%
        = [(Instruction countafter × CPIafter ÷ Clock rateafterInstruction countbefore × CPIbefore ÷ Clock ratebefore) ÷
           (Instruction countbefore × CPIbefore ÷ Clock ratebefore)] × 100%
      = [(1.20×Instruction countbefore × CPIbefore ÷ Clock ratebeforeInstruction countbefore × CPIbefore ÷ Clock ratebefore) ÷ (Instruction countbefore × CPIbefore ÷ Clock ratebefore)] × 100% = 20%
      Therefore, the increase in CPU time is 600 seconds × 20% = 120 seconds.