problemset6solutions - Department of Electrical and...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Department of Electrical and Computer Engineering The University of Texas at Austin EE 306, Fall 2006 Problem Set 6 Solutions 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 Samanta 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. 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 stack machine supplemental handout for help on this problem. a. 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. b. PUSH V c. PUSH W d. PUSH X e. PUSH Y f. MUL g. ADD h. PUSH Z i. SUB j. DIV k. POP U
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Minimum number of memory locations: 4 u = v/((w+(x*y))-z) l. Write the assembly language code for a zero-address machine (using the same type of instructions from part a) for calculating the expression below. The values a, b, c, d, and e are stored in memory locations A, B, C, D, and E. e = ((a * ((b - c) + d))/(a + c)) m. PUSH A n. PUSH B o. PUSH C p. SUB q. PUSH D r. ADD s. MUL t. PUSH A u. PUSH C v. ADD w. DIV x. POP E 2. Do Problem 9.13 on page 244 in the textbook. The problem is that subroutine A calls subroutine B which destroys the linkage back to the original program. Subroutine A needs to save R7 and then load it back before it returns.
Background image of page 2
3. Do Problem 6.16 on page 175 in the textbook. 4.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/26/2009 for the course EE 302 taught by Professor Mccann during the Fall '06 term at University of Texas at Austin.

Page1 / 8

problemset6solutions - Department of Electrical and...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online