=========================preview======================
(ELEC152)[200x](s)midterm~=plv933^_46293.pdf
Back to ELEC152 Login to download
======================================================
ELEC 152 Sample Midterm George Yuan
ELEC152 Computer Organization
Mid-term Examination
Short Questions:
1.
Imagine you have written a C program. What would be the necessary steps that you should take to run this segment of C codes on a MIPS R2000 processor?(3pts) Imagine you have CPU, memory, hard disk, network card, keyboard. You are asked to organize these devices into a complete computer. Can you think of a reasonable scheme, and draw it in a block diagram?
2.
Imagine you are a computer designer. How can you improve the performance of a computer? Now, you are a computer analyst. What can you do to evaluate the performance of a new computer?
3.
Imagine you read a word from the memory.
0000000100001001,1000000000100000 Please consider the following questions. a) If this word represents an integer in 2s compliment, what would be the decimal
value? What would be the hexdecimal value? b) If this word represents a MIPS instruction, from the instruction table in the appendix, which instruction is it?
4.
For MIPS, what is the value range for integers in 2s compliment? If we assume that IEEE 754 single-precision floating point number is represented, what is the value range for single-precision floating point number?
5.
For the following MIPS assembly segments, please calculate for the required results
0x100 addi $s0, $zero, 4000 0x104 lw $t0, 100($s0) #what is the mem. address for the target
#word? 0x108 beq $t0, $t1, L1 0x10c addi $s0, $s0, 4 0x110 j L2 #what is the offset for L2 in the machine
#instruction? 0x114 L1: addi $s0, $s0, 3 0x118 addi $s0, $s0, 2 0x11c L2: addi $s0, $s0, 1
6. Please convert the following C code into MIPS assembly codes. (5pts)
x=0;
for(i=9;i--;i>0)
{
x=x+i*2;
}
Long Questions:
1. An ISA includes 5 instruction classes. A processor implementation X of the ISA is shown in the following table. Processor X runs at 1GHz. Program is the main task for this processor. After compilation, it includes 109 instructions. Its composition is shown in the table.
Class A Class B Class C Class D Class E
CPI 1 2 3 4 5
Program 10% 10% 20% 20% 40%
a) What is the execution time of the program?
b) What is the weighted average CPI for processor X?
c) Now, you are required to re-design processor X into processor X so that the execution time of program is halved. Assume that, among the 5 instruction classes, only the implementation of one class can be re-designed. What is your re-design plan? (Which class do you choose to redesign? What is the CPI you have to design for it?) Assume instruction count does not change.
2. Please read the following MIPS code segment, and answer the questions
0x100 addi $t0, $zero, 14 #the target number is stored in t0 0x104 la $s1, array #the array that contains the number
0x108 L1: lw $t1, 0($s1) #read an element
0x10c beq $t1, $t0, exit #find the element, exit
0x110 a