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 2015 – 16

By | August 20, 2015

MASTER OF COMPUTER APPLICATIONS


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

 

Assume that a RISC machine has 128 registers out of which 16 registers are reserved for the Global variables and 16 for Instruction related tasks. This machine has been designed to have 12 registers for storing four input parameters, four output parameters and four local variables for a subroutine call. Explain with the help of a diagram, how the overlapped register window can be implemented in this machine for procedure calls. You must explain how the parameters will be passed, if a subroutine calls another subroutine.

 

Assumptions:

Register file contains 128 registers. Let them be called by register number 0 – 127.

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-31

Unused

32 – 43

(12 Registers)

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

44 – 59

(16 Registers)

Used for local variable of fC Local variables offunction C

60 – 71

(12 Registers)

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

72 – 87

(16 Registers)

Local variables of fB Local variables of function B

88 – 99

(12 Registers)

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

100 – 115

(16 Registers)

Local variable of fA Local variables of function A

116 – 127

(12 Registers)

Parameter passed to fA Parameters of function A

 

Risc_Machine_01

 

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.

Circular_Buffer_window

Figure:-  circular overlapping windows

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.

 

d. How does a Micro-programmed control Unit will control the execution of an instruction? Explain with the help of an addition instruction.

Solved program can be found on this link http://cssimplified.com/assignments/what-will-be-the-values-of-select-inputs-carry-in-input-and-result-of-operation-if-the-following-micro-operations-are-performed-ignou-mca-assignment-2014-15

 

e. Explain with the help of a diagram how RISC Instruction pipelining work does. Also explain how RISC instruction pipeline can be optimised.

Solved program can be found on this link http://cssimplified.com/computer-organisation-and-assembly-language-programming/explain-the-working-of-the-instruction-pipelining-with-the-help-of-a-diagram-5m-dec2005