## Assignment One

### 1.(8 marks)  计算机组织与体系结构作业代写

Suppose that the following clock cycles per instruction, and frequencies of usage by a particular program, have been determined for the four instruction types of a system with a clock rate of 2 GHz.

 Instruction type Clock cycles per instruction Frequency A 3 20% B 1 40% C 2 30% D 4 10%

(a)What MIPS rating is achieved is achieved for this program on thissystem?

(b)Suppose that 500 x 106 instructions are executed in total. What is the CPU execution time?

(c)Suppose it was possible to replace particular pairs of type C instructions with single type A Would the MIPS rating increase, or decrease, with thischange?

(d)If it were possible to replace 2/3 of the type C instructions in the manner described in part (c), by what percentage would CPU execution timedecrease?

2.(6 marks) You are going to enhance a computer, and there are two possible improvements: either make multiply instructions run four times faster than before, or makememory access instructions run two times faster than  The computer is used for a program that takes 100 seconds to execute. Of this time, 20% is used for multiplication, 50% for memory access instructions, and 30% for other tasks.

(a)What will the speedup (ratio of old to new execution time) be if only multiplication isimproved?

(b)What will the speedup be if only memory access isimproved?

(c)What will the speedup be if both improvements aremade?

### 3.(2 marks)  计算机组织与体系结构作业代写

Consider a system with only two types of machine language instructions Aand B, with CPIA = 4 and CPIB = 8. Suppose that through a hardware modification CPIA could be deceased to 2, without any change to CPIB, at the cost of increasing the clock cycle time by 20%. For what range of values of the fraction fA of executed instructions  of type A would the program execution time decrease?

4.(2 marks) Suppose that a SPEC benchmark suite contains 4 benchmarks, with running times on a system A of 1, 6, 1.5, and 60 seconds, respectively, and running times on a system B of 4, 12, 6, and 30 seconds, respectively. Which system would have a better (i.e. larger) SPEC rating, and by whatfactor?

### 5.(10 marks)  计算机组织与体系结构作业代写

Write, and test using spim, an assembly language program that inputs a positive integer N from the user, followed by N Your program should output how many of the N integers have value greater than 496 but less than or equal to 8128.

6.(10 marks) Write, and test using spim, an assembly language program that accepts as input a sequence of 10 integers. These numbers should be stored in an array in memory, in the order in which they were input. Then,  your program should prompt the user  for an integer input and search the array to find the first occurrence (if any) of this integer.  If found, output its position in the array as an integer between 1 and 10. Again, you need only find the first Your program should then prompt the user for another integer input, and repeat. Once the input integer is NOT found in the array, your program shouldterminate.  计算机组织与体系结构作业代写

7.(10 marks) Write, and test using spim, an assembly language program that inputs a character string from the user (you can assume that the string will be at most 20 characters, not including the zero byte delimiter), forms a new string that contains the characters of the input string, but in reverse order, and then outputs the new string.