Department of Electrical and Computer Engineering

The University of Texas at Austin

EE 306, Fall 2004
Problem Set 6 (Optional)

Not Due

Yale N. Patt, Instructor
Siddharth Balwani, Linda Bigelow, Tommy Buell, Jeremy Carrillo, Aamir Hasan,
Danny Lynch, Rustam Miftakhutdinov, Veynu Narasiman, Vishal Parikh, Basit Sheikh, TAs

Questions

 

  1. Refer to Problem 9.13 on page 244 in the textbook.

 

  1. Refer to Problem 9.18 on page 247 in the textbook.

 

 

  1. What the defining characteristics of a stack? Give two implementations of a stack and describe their differences.

 

  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 its 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 or MUL for the purposes of this problem.

1. Write the assembly language code for calculating the expression:
���������� ���� x = (A * ( ( B * C ) + D ) )

      • In a zero-address machine
      • In a three-address machine like the LC-3b, but which can do memory to memory operations and also has a MUL instruction.

2. Give an advantage and a disadvantage of each of these machines.

  1. Refer to Problem 10.9 on page 284 in the textbook. Only do parts (b) and (c).

 

  1. Consider the following possibilities for saving the return address of a subroutine:
    • In a processor register.
    • In a memory location associated with the subroutine. A different memory location is used for each different subroutine.
    • On a stack.

Which of these possibilities supports subroutine nesting, and which supports subroutine recursion (that is, a subroutine that calls itself)?

 

  1. During the initiation of the interrupt service routine, the N, Z, and P condition codes are saved on the stack. By means of a simple example show how incorrect results would be generated if the condition codes were not saved. Also, clearly describe the steps required for properly handling an interrupt.

 

  1. Refer to Problem 10.12 on page 285 in the textbook.