Department of Electrical and Computer Engineering
The University of Texas at Austin
EE 306, Fall 2009
Problem Set 4
Due: November 2, before class
Yale N. Patt, Instructor
TAs: Aater Suleman, Chang Joo Lee, Ameya Chaudhari, Antonius Keddis, Arvind Chandrababu, Bhargavi
Narayanasetty, Eshar Ben-dor, Faruk Guvenilir, Marc Kellermann, RJ Harden
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 and the
time for the discussion section you would like the problem set turned back to you. Show your work.
1. (7.2) An LC-3 assembly language program contains the instruction:
ASCII LD R1, ASCII
The symbol table entry for ASCII is x4F08. If this instruction is executed during the running of the
program, what will be contained in R1 immediately after the instruction is executed?
R1 <-- M[ASCII]
R1 = 0010 001 1 1111 1111
LD R1, #-1
2. (7.10) The following program fragment has an error in it. Identify the error and explain how to fix it.
Note: R3 is the only register which should change its value after the program runs.
ADD R3, R3, #30
The immediate value is too large.
ST R3, A
A .BLKW 1
Will this error be detected when this code is assembled or when this code is run on the LC-3?
The error will be detected by the assembler since it will not be able to form the 16 bits of the
instruction which performs the addition.
One possible solution is to seperate the addition to two add instruction with immediate of #15.
ADD R3, R3, #15
ADD R3, R3, #15