Department of Electrical and Computer Engineering
The University of Texas at Austin
EE 306, Fall 2009
Problem Set 6
Due: Not to be turned in
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
Note: This problem set is unusually long, and is not to be turned in. We have put it together and handed it out
to give you some challenging examples to help you prepare for the final exam.
1. (Adapted from 10.9) The input stream of a stack is a list of all the elements we pushed onto the stack,
in the order that we pushed them. The input stream from Excercise 10.8 from page 284 of the book
for example is ABCDEFGHIJKLM
The output stream is a list of all the elements that are popped off the stack in the order that they are
a. If the input stream is ZYXWVUTSR, create a sequence of pushes and pops such that the output
stream is YXVUWZSRT.
b. If the input stream is ZYXW, how many different output streams can be created.
2. Do Problem 6.16 on page 175 in the textbook.
3. (Adapted from 10.6) Rewrite the PUSH and POP routines such that the stack on which they operate
holds elements that take up two memory locations each.
4. Consider the following LC-3 assembly language program. Assumming that the memory locations
DATA get filled before the program executes, what is the relationship between the final values at
DATA and the initial values at DATA?
R1, R1, #0
R1, R1, #9
R2, R0, #0
R3, R1, #0
R4, R4, #0
R2, R2, #1
R3, R3, #-1
R1, R1, #-1
R5, R2, #0
R5, R5, #1
R6, R2, #1
R4, R5, R6