ProbSet4_solution - Department of Electrical and Computer...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
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 Instructions: 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 HALT 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
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
ST R3, A HALT A .BLKW 1 3. (Adapted from 6.14) Consider the following machine language program: AND R2, R2, #0 R2 <- 0 LOOP ADD R1, R1, #-3 R1 <- R1-3 BRn END End when R1 is negative ADD R2, R2, #1 R2 <- R2+1 BRnzp LOOP END HALT What are the possible initial values of R1 that cause the final value in R2 to be 3? For R2 to contain the value 3, the BRn must not have intiated a branch for 3 consecutive times.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 8

ProbSet4_solution - Department of Electrical and Computer...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online