Docsity

Solved Exam 2 for Introduction to Computing - Fall 2006 | E E 306, Exams of Electrical and Electronics Engineering

Toggle sidebar
bg1
Department of Electrical and Computer Engineering
The University of Texas at Austin
EE 306, Fall, 2008
Yale Patt, Instructor
TAs: Jeffrey Allan, Arvind Chandrababu, Eiman Ebrahimi, Aravind Jakkani, Khubaib,
Allison Korczynski, Pratyusha Nidamaluri, Zrinka Puljiz, Che-Chun Su, Christopher Wiley.
Exam 2, November 12th, 2008
Name:
Problem 1 (35 points):
Problem 2 (15 points):
Problem 3 (15 points):
Problem 4 (20 points):
Problem 5 (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
GOOD LUCK!
pf3
pf4
pf5
pf8
pf9

Partial preview of the text

Download Solved Exam 2 for Introduction to Computing - Fall 2006 | E E 306 and more Exams Electrical and Electronics Engineering in PDF only on Docsity!

Department of Electrical and Computer Engineering The University of Texas at Austin

EE 306, Fall, 2008 Yale Patt, Instructor TAs: Jeffrey Allan, Arvind Chandrababu, Eiman Ebrahimi, Aravind Jakkani, Khubaib, Allison Korczynski, Pratyusha Nidamaluri, Zrinka Puljiz, Che-Chun Su, Christopher Wiley. Exam 2, November 12th, 2008

Name:

Problem 1 (35 points):

Problem 2 (15 points):

Problem 3 (15 points):

Problem 4 (20 points):

Problem 5 (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

GOOD LUCK!

Problem 1 (35 points)

Part a (6 points): Perform Pass one of the LC-3 Assembler (create the symbol table) for the following LC- Assembly Language program:

.ORIG x LD R1,A AGAIN BRzp SKIP ADD R0,R1,R TRAP x BRnzp AGAIN HELP .STRINGZ "Hello, Again" A .BLKW # SKIP TRAP x B .FILL x .END

Symbol Address

Part b (6 points): The following assembly language program has at most 3 bugs.

.ORIG x LD R1,A LD R2,B ADD R1,R1,R .FILL x .FILL xD07F TRAP x A .BLKW x B .BLKW x .END

Circle the instructions that have bugs, labeling each circle 1, 2, 3, etc. In the following boxes, one box per bug, state whether the bug will show up at Assemble time, Link time, or Run time, and explain why.

Part e (7 points): The following assembly language program is assembled and then executed.

.ORIG x AGAIN LD R1,A NOT R1,R ST R1,A A .FILL x0FDA BRnzp AGAIN .END

Will this program halt? If yes, explain why. If no, explain why not.

Problem 2 (15 points)

Part a: During one clock cycle of the correct execution of a particular LC-3 instruction, the values of select signals MARMUX, ADDR1MUX, and ADDR2MUX are as shown below, and highlighted on Figure 5.18, which we have provided.

Note: The highlights shown on Figure 5-18 apply only to Part a and are irrelevant to Part b of this problem.

MARMUX: 1 ADDR1MUX: 1 ADDR2MUX: 00

What is the opcode of the instruction being processed?

Part b: A different opcode is LD, which in machine language is 0010. During the execution of a LD in- struction, after the instruction has been decoded, one clock cycle must be devoted to loading MAR with a proper address.

Specify the values of the select signals MARMUX, ADDR1MUX and ADDR2MUX that are necessary to load MAR appropriately.

MARMUX: ADDR1MUX: ADDR2MUX:

Problem 4 (20 points)

The state machine shown below will produce an output sequence if it receives an input sequence. The intial state is S0.

b

S c

S

S a

(^0 )

1

1

0 1

For example, the input sequence 100 produces the output sequence bac. We have written a program that simulates this state machine. Inputs are requested from the keyboard, and the corresponding outputs are shown on the screen. For example, for the input sequence shown above, the monitor would display

INPUT (either 0 or 1): 1 OUTPUT: b INPUT (either 0 or 1): 0 OUTPUT: a INPUT (either 0 or 1): 0 OUTPUT: c

Your job: Complete the program that simulates the state machine, by filling in each blank box with one missing line of LC-3 assembly language code.

Note: You can assume the person at the keyboard can type a 1 or a 0 without error (i.e., you do not have to test for wrong input).

.ORIG x LEA R6, S

Loop

TRAP x TRAP x20 ; inputs a character TRAP x

LD R1, NEGASCII ADD R0, R0, R

LDR R6, R6,#

LD R0, NEWLINE

TRAP x LEA R0, OUTPUT TRAP x

TRAP x LD R0, NEWLINE TRAP x BRnzp LOOP

S0 .FILL S .FILL S .FILL x

S1 .FILL S .FILL S .FILL x

S2 .FILL

.FILL

.FILL

NEGASCII .FILL xFFD0 ; the value - OUTPUT .STRINGZ "OUTPUT:" INPUT .STRINGZ "INPUT (either 0 or 1):" NEWLINE .FILL x000A

.END