Department of Electrical and Computer Engineering
The University of Texas at Austin
EE 306, Fall 2006
Problem Set 6
Due: Not to be turned in
Yale N. Patt, Instructor
TAs: Aseem Bathla, Cameron Davison, Lisa de la Fuente, Phillip Duran, Jose Joao,
Jasveen Kaur, Rustam Miftakhutdinov, Veynu Narasiman, Nady Obeid, Poorna
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.
A zero-address machine is a stack-based machine where all operations are done
by using values stored on the operand stack. For this problem, you may assume
that the ISA allows the following operations:
PUSH M - pushes the value stored at memory location M onto the operand stack.
POP M - pops the operand stack and stores the value into memory location M.
OP - Pops two values off the operand stack and performs the binary operation OP
on the two values. The result is pushed back onto the operand stack.
Note: OP can be ADD, SUB, MUL, or DIV for parts a and b of this problem.
Note: See the
supplemental handout for help on this problem.
Draw a picture of the stack after each of the instructions below are
executed. What is the minimum number of memory locations that have to
be used on the stack for the purposes of this program? Also write an
arithmetic equation expressing u in terms of v, w, x, y, and z. The values
u, v, w, x, y, and z are stored in memory locations U, V, W, X, W, and Z.