Department of Electrical and Computer Engineering
University of Texas at Austin
EE 379K
Fall 2000
Y. N. Patt, Instructor
TAs: Kathy Buchheit, Laura Funderburg, Chandresh Jain, Onur Mutlu,
Danny Nold, Kameswar Subramanian, Francis Tseng, Brian Ward
Solutions to Exam 2
Problem 1
Part 1
Both instructions are noops (they do *essentially* nothing)
Difference: B sets the condition codes.
Part 2
128 locations on a page, 8 pages
Part 4
largest address for current LDR : x323F
largest address for modified LDR : x321F
smallest address for modified LDR : x31E0
Problem 2
A
Opcode: TRAP
Function: Carries the trapvector, which is used to find the starting address of the system call.
B
Opcode: LDR, STR, JSRR (one is enough)
Function: Carries the contents of the base register.
C
Opcode: ADD, AND (one is enough)
Function: Selects whether an immediate operand or a value from a register will be used (Bit 5).
Problem 3
Part B
Whether the instruction sets the condition codes.
Problem 4
Problem 5
1111 0000 00100111
No. Because GETC and OUT overwrite R7 linkage to main program will be lost.
Problem 6
Outputs the input characters in reverse order.
Problem 7
Filled blanks in order:
ADD R1, R1, #-1
LDR R4, R1, #0
ADD R0, R0, #1
ADD R1, R1, #-1
BRnzp LOOP
Problem 8
Part A
Sets the Interrupt Enable bit of KBSR and continually outputs 2.
Part B
Echoes the input character and halts.
Part C
A number of 2's followed by the key struck by the user.