EE 306, Fall 2004
Problem Set 4
Due: October 4th, before class
Yale N. Patt, Instructor
Siddharth Balwani, Linda Bigelow, Tommy Buell, Jeremy Carrillo, Aamir Hasan,
Danny Lynch, Rustam Miftakhutdinov, Veynu Narasiman, Vishal Parikh, Basit
Sheikh, TAs
You are encouraged to work on the problem set in groups and turn in one problem set for the entire group. Remember to put all your names on the solution sheet. Also remember to put the name of the TA in whose discussion section you would like the problem set turned back to you
Questions
1. If a computer has a 16-bit MAR and a 32-bit MDR:
a) How many memory locations are available in the memory of this computer?
b) How many bits are stored at each of those locations?
c) What is the total size of the memory (in Bytes)?
2. Classify the LC-3 instructions into Operate, Data Movement, or Control instructions.
3. (5.5 from the TextBook).
a) What is an Addressing Mode?
b) Name three places an instruction�s operand might be located.
c) List the 5 addressing modes of the LC-3, and for each one state where the operand is located (from part b).
d) What addressing mode is used by the ADD instruction shown in section 5.1.2?
4. Which of the two algorithms for multiplying two numbers is preferable and why?
88 * 3 = 88 + 88 + 88 or 3 + 3 + 3 + 3 + ...+ 3?
5. The LC-3 does not have a subtract instruction. Write a LC-3 Machine Language Program that takes the values in R1 and R2 and subtracts them (R1 - R2) and stores the result in R3.
6. The LC-3 does not have an instruction to perform an OR. Write a LC-3 Machine Language Program that takes the values in R1 and R2 and stores the OR of the two operands (R1 OR R2) in R3.
7. Problem No. 5.9 (Page 146) from the Textbook.
8. Problem 6.8 from the Textbook (Page 173).
9.
This problem has been postponed. It will apear on a future Problem
Set.
(Problem 6.14 in the Textbook)
Consider the following machine language program:
X3000 0101 0100 1010 0000
X3001 0001 0010 0111 1111
X3002 0001 0010 0111 1111
X3003 0001 0010 0111 1111
X3004 0000 1000 0000 0010
X3005 0001 0100 1010 0001
X3006 0000 1111 1111 1010
X3007 1111 0000 0010 0101
What are the possible initial values of R1 that cause the final value in R2 to
be 3?
10.
This problem has been postponed. It will apear on a future Problem
The following LC-3 Machine Language program is
supposed to multiply the contents of R1 with R2 and store the result in R3.
The program assumes that both R1 and R2 contain positive integers. However,
there is an error in the program.
0101 0110 1110 0000
0001 0110 1100 0010
0001 0010 0111 1111
0000 0111 1111 1101
1111 0000 0010 0101
a) What is the error?
b) Modify the present program to make it work correctly.