Yale Patt, Instructor

TAs: Asad Bawa, Linda Bigelow, Mustafa Erwa, Lester Guillory, Kevin Major,

Tanay Shah, Moinuddin Qureshi, Paroma Sen, Santhosh Srinath,

Matt Starolis, David Thompson, Vikrant Venkateshwar

Problem Set #4

Due: Monday, October 7, 2002 before class

0. Problem No.9 from PS #3.

1. Problem No. 4.5 ( Page 87) from the textbook.

2. For the opcodes: 0001, 0010, 0000; write what operations occur in each phase of the instruction cycle.

3. Consider the following machine language program:

X3000 0101010010100000

X3001 0001001001111111

X3002 0001001001111111

X3003 0001001001111111

X3004 0000100000000111

X3005 0001010010100001

X3006 0000111000000001

X3007 1111000000100101

a) What are the possible intial values of R1 that cause the final value in R2 to be 3. ?

b) In less than ten words, what does this program do?

4. Problem No. 4.7 ( Page 88) from the textbook.

5. Problem No. 5.2 ( Page 114) from the textbook.

6. Problem No. 5.3 ( Page 114) from the textbook.

7. Problem No. 5.9 ( Page 115) from the textbook.

Note: This problem is intended to stretch your mind. Do not be disappointed (or surprised) if each part makes you think.

8. Problem No. 5.10 ( Page 115) from the textbook.

9. For this question, assume that all data memory is initialized to x1000 more than its address. So for example, Address 0x8000 will have have the value 0x9000.

Now, execute the following LC-2 machine language program and write the values stored in all the registers(R0-R7).

Initially, all the registers have the value 0 stored in them. Also PC=0x3000 to start with.

0x3000:

1110000100000000

0010001100000000

1010010100000000

0110011001100100

10. Suppose we build a machine in the old style that requires each instruction to complete (store its result) before the next instruction can start (fetch the instruction). This was the way things were in the old days before we came up with a lot of techniques that you will learn about in 360N, if you take it. Suppose on the average, instructions take 1.2 cycles to FETCH, 1 cycle to decode, 1 cycle to figure out the addresses of the operands, 1.8 cycle to get the operands, 2 cycles to execute, and 1 cycle to store the result. How many instructions can a 2.5 GHz computer of this ilk process in one second.