






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







Department of Electrical and Computer Engineering The University of Texas at Austin
EE 306, Fall, 2006 Yale Patt, Instructor TAs: Aseem Bathla, Cameron Davison, Lisa de la Fuente, Phillip Duran, Jose Joao, Jasveen Kaur, Rustam Miftakhutdinov, Veynu Narasiman, Nady Obeid, Poorna Samanta. Final Exam, December 13, 2006
Name:
Problem 1 (15 points):
Problem 2 (10 points):
Problem 3 (10 points):
Problem 4 (10 points):
Problem 5 (10 points):
Problem 6 (10 points):
Problem 7 (10 points):
Problem 8 (10 points):
Problem 9 (15 points):
Total (100 points):
Note: Please be sure that your answers to all questions (and all supporting work that is required) are contained in the space provided.
Note: Please be sure your name is written legibly on each sheet of the exam.
I will not cheat on this exam.
Signature
Problem 1 (15 points)
Part a (5 points): Here is a list of the 16 opcodes. Circle the ones that write to a general purpose register (R0 to R7) at some point during the instruction cycle.
ADD AND BR JMP JSR LD LEA LDI
LDR NOT RTI ST STI STR TRAP reserved
Part b (5 points): Program A running at priority level 0 starts running on the LC-3 at the start of time unit
x: interrupt occurs at end of time unit 6. Priority 4. X needs 3 time units. y: interrupt occurs at end of time unit 8. Priority 8. Y needs 5 time units. z: interrupt occurs at end of time unit 9. Priority 5. Z needs 2 time units.
In the boxes below, write the letter (A, X, Y, or Z) of the program or service routine running during that time unit.
Note: We have inserted the answer for time units 1,2, and 3.
Part c (5 points): Label the gate inputs to each of the 8 transistors in the figure below so that the operation of the transistor circuit behaves as specified in the truth table below. You can label each gate input as A, A¯, B, or B¯.
A OUT 0 0 0 0
1
1 1 1
B 0 1 0 1?
??
?
?
?
?
?
A A
B B
A
B
OUT
Problem 3 (10 points)
The 8 general purpose registers of the LC-3 (R0 to R7) make up the Register File. To write a value to a register, the LC-3 control unit must supply 16 bits of data (BUS[15:0]), a destination register (DR[2:0]), and a write enable signal (LD.REG) to load a register. The Combinational Logic Block below shows in- puts BUS[15:0], DR[2:0], and LD.REG and outputs DinR0[15:0], DinR1[15:0], DinR2[15:0], ... DinR7[15:0], LD.R0, LD.R1, LD.R2, ... LD.R7.
Your job: Add wires, logic gates, and standard logic blocks as necessary to complete the Combinational Logic Block. Note: If you use a standard logic block, it is not necessary to show the individual gates. However, it is necessary to identify the logic block specifically (e.g., “16-to-1 mux”), along with labels for each relevant input or output, according to its function.
R
R
R
R
R
R
R
R
16
DR[1]
DR[2]
DR[0]
LD.REG
Combinational Logic
BUS[15:0]
LD.R
LD.R
LD.R
LD.R
LD.R
LD.R
LD.R
LD.R
DinR7 16
DinR6 16
DinR5 16
DinR4 16
DinR3 16
DinR2 16
DinR1 16
DinR0 16
Problem 4 (10 points)
The table below shows part of the state of the LC-3 (the contents of the eight registers, the PC, the condi- tion codes, and memory locations x2000 through x2007) at a particular instant in time (the column labeled Before). Then the LC-3 was single-stepped twice (i.e., two LC-3 instructions were executed), producing the state of the machine indicated by the column labeled After.
Your job: Fill in the five missing entries in the table indicated by question marks (?). Note: We have supplied the high order hex digit for the contents of memory location x2006.
Before After R0 x0505 x R1 x1FFF x1FFF R2 x3006 x R3 x2100 x R4 x4567 x R5 xFFFF xFFFF R6 x2002 x R7 x3010 x PC x2006 x N 0? Z 0? P 1? M[x2000] x20A M[x2001] x M[x2002] x M[x2003] x M[x2004] x601A M[x2005] x M[x2006]? x M[x2007]? x
Problem 6 (10 points)
A program (part of which is shown below) uses a stack to store values that the program operates on. The stack is implemented in memory locations x5FF8 (MAX) to x5FFF (BASE). At the time the instruction stored at the label AGAIN is executed, the Stack Pointer (R6) contains x5FF8.
Your job is to show the contents of the stack after the program has executed. Also, show the final contents of the Stack Pointer.
You can assume that the PUSH and POP routines have been written for you and that they behave EXACTLY as described in class. Recall that success (0) and failure (1) information is passed back to the calling program through R5, and if the stack operation failed, R0 and R6 remained unchanged.
BRp DONE JSR PUSH BRnzp AGAIN DONE JSR PUSH HALT
R6: x5FF
x5FF x5FF x5FFA x5FFB x5FFC x5FFD x5FFE x5FFF
Problem 7 (10 points)
The statement of this problem is identical to problem 9 on Problem Set 6; only the values and the instruction you have to work out are different.
The figure below shows the part of the LC-3 data path that deals with memory and I/O. Note the signals labeled A through F. A is the memory enable signal; if it is 1, memory is enabled, if it is 0, memory is disabled. B, C, and D are the load enable signals for the Device Registers that can be written to. If the load enable signal is 1, the corresponding register is loaded with a value, otherwise it is not. E[15:0] is the 16-bit output of INMUX. F[1:0] are the two select lines for INMUX.
The initial values of some of the processor registers and the I/O registers, and some memory locations are as follows:
R0 = xFE00 KBSR = x8000 M[x3009] = xFE R1 = x0039 KBDR = x0061 M[x300A] = xFE PC = x3000 DSR = x8000 M[x300B] = xFE DDR = x0031 M[x300C] = xFE
As you know, during one complete instruction cycle, memory-I/O is accessed either one, two, or three times. Your job in this problem is to specify all the memory-I/O accesses associated with processing the instruction STI R1,#11.
Complete the table with the values of each control signal and register at the end of each cycle in which a memory-I/O access occurs. If the value of a signal does not matter in a cycle, put an X in the corresponding entry in that row. If the instruction does not require three memory-I/O accesses, draw a line through each unnecessary row in the table.
PC Instruction Access MAR A B C D E[15:0] F[1] F[0] MDR x3000 STI R1,#11 1
2
3
Problem 9 (15 points)
A program encounters a breakpoint and halts. The computer operator does not change the state of the computer in any way, but immediately presses the run button to resume execution.
The table below shows the contents of MAR and MDR for the first nine memory accesses that the LC- performs after resuming execution.
Your job: Fill in the missing entries.
1st:
2nd:
3rd:
4th:
5th:
6th:
7th:
8th:
9th:
x
xF0F
x2000 x020A
x040A
x61FE
xC1C
x4002 xF
Some information you might find useful...
The Stack Protocol
01 ; Subroutine for carrying out the PUSH and POP functions. This 02 ; program works with a stack consisting of memory locations BASE 03 ; through MAX. R6 is the stack pointer. R0 contains the data. 04 ; 05 PUSH ST R1,SaveR1 ; R1 is needed by PUSH routine 06 LD R1,FULL ; FULL contains -(MAX) 07 ADD R1,R1,R 08 BRz Fail_exit ; SP=MAX (no room on the stack) 09 ; 0A ADD R6,R6,#- 0B STR R0,R6,#0 ; R0 gets PUSHed onto the stack 0C BR Success_exit 0D ; 0E POP ST R1,SaveR1 ; R1 is needed by POP routine 0F LD R1,EMPTY ; EMPTY contains -(BASE+1) 10 ADD R1,R1,R 11 BRz Fail_exit ; SP=(BASE+1) (nothing on the stack) 12 ; 13 LDR R0,R6,#0 ; Top of stack gets POPped to R 14 ADD R6,R6,# 15 ; 16 Success_exit AND R5,R5,#0 ; Success code: R5= 17 LD R1,SaveR 18 RET 19 Fail_exit AND R5,R5,# 1A ADD R5,R5,#1 ; Fail code: R5= 1B LD R1,SaveR 1C RET 1D FULL .FILL -MAX 1E EMPTY .FILL -(BASE+1) 1F SaveR1 .BLKW 1
The PSR register
15 10 8 2 0
Privilege 0: Supervisor 1: User
Priority (0 − 7)