=========================preview======================
(ELEC152)[200X](s)midterm~cckei^_89475.pdf
Back to ELEC152 Login to download
======================================================
ELEC 152 Sample Midterm
George Yuan
ELEC152 Computer Organization
Mid-term Examination
Short Questions: 35pts, 5pts/each
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?(2pts)
2.
Imagine you are a computer designer. How can you improve the performance of a computer?(3pts) Now, you are a computer analyst. What can you do to evaluate the performance of a new computer?(2pts)
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? (3pts)
b)
If this word represents a MIPS instruction, from the instruction table in the appendix, which instruction is it? (2pts)
4.
For MIPS, what is the value range for integers in 2s compliment?(3pt) If we assume that single-precision floating point number is represented with the formula in the appendix, what is the value range for single-precision floating point number?(2pts)
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?(1pt)
0x108 beq $t0, $t1, L1 #what is the offset for L1 in the machine
#instruction?(2pt)
0x10c addi $s0, $s0, 4
0x110 j L2 #what is the offset for L2 in the machine
#instruction?(2pt)
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;
}
7.
A single-cycle processor is given in the appendix. For arithmetic-logical instructions, such as add, the datapath related to the register file and the ALU is plotted below. Please draw the timing diagram for the execution of these instructions.(2pts) Without considering the delay tc-to-q, and the clock skew. Please give out the total execution delay for this type of instructions.(2pts) On the diagram, please indicate the moment that the calculated result from the ALU is written back into the register file.(1pts)
Long Questions: 65pts
1.
(15pts)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