Explain how overlapped register window can be implemented for procedure calls. Explain the process of parameter passing for the subroutine call on this machine? – IGNOU MCA Assignment 2014 – 15

By | October 12, 2014

Course Code : MCS-012
Course Title : Computer Organisation and Assembly Language Programming
Assignment Number : MCA (2)/012/Assign /2014-15
Maximum Marks : 100
Weightage : 25%

Assume that a RISC machine has 64 registers out of which 16 registers are reserved for the Global variables. This machine has been designed to have 8 registers for storing two input parameters, two output parameters and four local variables for a single function. Explain with the help of a diagram, how the overlapped register window can be implemented in this machine for procedure calls. Explain the process of parameter passing for the subroutine call on this machine.



Register file contains 64 registers. Let them be called by register number 0 – 63.

The table shows the use of registers: when there is call to function A (fA) which calls function B (fB) and function B calls function C (fC).



Registers Nos. Used for

0 – 15

(16 Registers)

Global variables required by fA, fB, and fC Function A Function B Function C

16 – 21

(6 Registers)

Used by parameters of fC that may be passed to next call Temporary variables of function C

22 – 29

(8 Registers)

Used for local variable of fC Local variables offunction C

30 – 35

(6 Registers)

Used by parameters that were passed from fB à fC Temporary variables of function B Parameters of function C

36 – 43

(8 Registers)

Local variables of fB Local variables of function B

44 – 49

(6 Registers)

Parameters that were passed from fA to fB Temporary variables of function A Parameters of function B

50 – 57

(8 Registers)

Local variable of fA Local variables of function A

58 – 63

(6 Registers)

Parameter passed to fA Parameters of function A

This window consists of:

  • Global registers which are shareable by all functions.
  • Parameters registers for holding parameters passed from the previous function to the current function. They also hold the results that are to be passed back.
  • Local registers that hold the local variables, as assigned by the compiler.
  • Temporary registers: They are physically the same as the parameter registers at the next level. This overlap permits parameter passing without the actual movement of data.

The register buffer is filled as function A called function B, function B called function C, function C called function D. The function D is the current function. The current window pointer (CWP) points to the register window of the most recent function (i.e. D). Any register references by a machine instruction is added with the contents of this pointer to determine the actual physical registers. On the other hand the saved window pointer identifies the window most recently saved in memory. This action will be needed if a further call is made and there is no space for that call. If function D now calls function E arguments for function E are placed in D’s temporary registers indicated by D temp and the CWP is advanced by one window.


If function E now makes a call to function F, the call cannot be made with the current status of the buffer, unless we free space equivalent to exactly one window. This condition can easily be determined as current window pointer on incrementing will be equal to saved window pointer.  Now, we need to create space. The simplest way will be to swap FA register to memory and use that space. Thus, an N window register file can support N –1 level of function calls.