Sie sind auf Seite 1von 2

Homework 1

Total 100 points

Due Date: Mar 29 th , Tuesday (5PM), submit to the homework collection box of your lab session

1. [5 points] What is the type of computer we are learning in this class? Can you name the other types of computers, which exist in the past and may replace today’s computers in future?

2. [5 points] Please draw a diagram to show the hardware-software view of a computer.

3. [5 points] Please draw a diagram to illustrate the typical software development flow which starting from algorithm.

4. [5 points] In the snippet of MIPS assembler code below, how many times is the main memory accessed? (Count only accesses to memory, not registers.)


$a1, 0($t0)


$a0, $a0, 1


$a1, $a0, $a1


$a1, 0($t1)


$t0, $t1, 1

5. [5 points] Write the following sequence of code into MIPS assembly. p = p + q ( r + s ) ; Assume that p, q, r, s are stored in registers $s0, $s1, $s2, and $s3 respectively.

6. [10 points] Please convert the following IEEE 754 single precision floating point numbers into base-10 numbers. Show details in your calculation. [Answer to 4 decimal places as necessary.]

a) 00111101110101000000000000000000

b) 01000000101010000000000000000000

7. [10 points] Just like we defined MIPS rating, we can also define something called the MFLOPS rating which stands for Millions of Floating Point operations per Second. If Machine A has a lower MIPS rating than that of Machine B, then does Machine A necessarily have a lower MFLOPS rating in comparison to Machine B?

8. [15 points] In MIPS assembly, write an assembly language version of the following C code segment. At the beginning of this code segment, the only values in registers are the base address of arrays A and B in registers $a0 and $a1, the starting index of 1 in register $t4, and the loop bound 50 in register $t5. Please add comments on each line of your code to explain its function. (The multiplication instructions are unnecessary.)

int A[50], B[50]; for (i=1; i < 50; i++) { A[i-1] = B[i] - B[i-1];


9. [20 points] Suppose you have a machine which executes a program consisting of 40% floating point multiply, 40% floating point divide, and the remaining 20% are from other instructions.

a) Management wants the machine to run 2 times faster. You can make the multiply run at most 8 times faster and the divide run at most 5 times faster. Can you meet management’s goal by making only one improvement, and which one?

b) If you make both the multiply and divide improvements, what is the speed of the improved machine relative to the original machine? [Answer to 2 decimal places.]

10. [20 points]

a) If processor A has a higher clock rate than processor B, and processor A also has a

higher MIPS rating than processor B, explain whether processor A will always execute faster than processor B.

b) Suppose that there are two implementations of the same instruction set architecture. Machine A has a clock period of 40ns and an effective CPI of 1.6 for some program, and machine B has a clock period of 50ns and an effective CPI of 1.2 for the same program. Which machine is faster for this program, and by how much? [Answer to 2 decimal places.]