0% found this document useful (0 votes)
9 views18 pages

RISC Processor Register Windows Explained

The document discusses RISC performance and register windows. RISC processors use a large number of registers to optimize operand references and minimize register-to-register operations. Register windows provide overlapping registers between procedures to pass parameters without saving and restoring registers. The register file is organized as a circular buffer of overlapping windows pointed to by counters.

Uploaded by

pinkgirl2519
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views18 pages

RISC Processor Register Windows Explained

The document discusses RISC performance and register windows. RISC processors use a large number of registers to optimize operand references and minimize register-to-register operations. Register windows provide overlapping registers between procedures to pass parameters without saving and restoring registers. The register file is organized as a circular buffer of overlapping windows pointed to by counters.

Uploaded by

pinkgirl2519
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Advanced Computer Architecture

(0630561)

Lecture 3

RISC Performance
Prof. Kasim M. Al-Aubidy
Computer Eng. Dept.
ACA- Lecture
RISC Performance:
• A large number of registers is useful for storing
intermediate results and for optimizing operand
references.
• The advantage of register storage as opposed to
memory storage is that registers can transfer
information to other registers much faster than the
transfer of information to and from memory.
• Register-to-register operations can be minimized
by keeping the most frequent accessed operands
in registers. For this reason, a large number of
registers in the processing unit are associated with
RISC processors.
ACA- Lecture
Example:

ACA- Lecture
Register to Register Operation

* ACA- Lecture
Register to Register Operation

+ ACA- Lecture
R to R and M to M Approaches:

, ACA- Lecture
Register Windows:
• Procedure CALL and RETURN occurs in HL
programming languages. When translated into
machine language, a procedure CALL produces a
sequence of instructions that:
- Save register values.
- Pass parameters needed for the procedure.
- Call a subroutine to execute the body of the procedure.
• After a procedure RETURN, the program will:
– Restore the old register values,
– Pass results to the calling program,
– Return from the subroutine.

- ACA- Lecture
Register Windows:
• Saving and restoring registers and passing parameters
and results involve time-consuming operations. To
overcome this, one of the following techniques must be
used:
1. Using multiple-register banks: each procedure is allocated
its own bank of registers. This will eliminate the need for
saving and storing register values.
2. Using the memory stack to store the parameters that are
needed by the procedure, but this requires a memory
access every time the stack is accessed.
3. Using overlapped register windows (RISC processors) to
provide the passing of parameters and avoid the need for
saving and restoring register values.

7 ACA- Lecture
Register Windows:
For overlapped register windows:
• Each procedure CALL results in the allocation of a new
window consisting of a set from the register file for use by
the new procedure.
• Each procedure CALL activates a new register window by
incrementing a pointer, while the RETURN statement
decrements the pointer and causes the activation of the
previous window.
• Windows for adjacent procedures have overlapping
registers that are shared to provide the passing of
parameters and results.

< ACA- Lecture


Register Windows:

> ACA- Lecture


• At any time only one window of registers is visible and is
addressable.
• The window is divided into three fixed-size areas:
1. Parameter registers: hold parameters passed down from the
procedure that called the current procedure and hold results to be
passed back up.
2. Local registers: used for local variables.
3. Temporary registers: used to exchange parameters and results
with the next lower level.
• The temporary registers at one level are physically the
same as the parameter registers at the next lower level.
• The register windows can be used to hold the few most
recent procedure activations. Older activations must be
saved in memory and later restored when the nesting
depth decreases. Thus, the actual organization of the
register file is as a circular buffer of overlapping windows.

ACA- Lecture
Circular Buffer Organization of Overlapped Windows:

ACA- Lecture
• A circular buffer of 6 windows. The buffer is
filled to a depth of 4 (A called B, B called C, C
called D) with procedure D active.
• CWP points to the window of the currently
active procedure. Reg references are offset by
CWP to determine the actual physical reg.
• SWP identifies the window most recently saved
in memory.

If procedure D now calls procedure E, arguments for E are placed in D’s


temporary regs (overlap between w3 & w4), and CWP is advanced by one
window.
If procedure E then calls procedure F, the call cannot be made with the current
status of the buffer. This is because window F overlaps window A.
If F begins to load its temporary registers, it will overwrite the parameter
registers of A (A-in). Thus, when CWP is incremented (modulo 6) so that it
becomes equal to SWP, an interrupt occurs, and window A is saved. Only the
first two portions (A-in & A-loc) need to saved. Then, the SWP is incremented
and the call to F proceeds.
ACA- Lecture
Example:
The system has 74 registers:
R0-R9: Ten hold parameters shared by all procedures.
R10-R73: Sixty four registers are divided into FOUR windows to
accommodate procedures A, B, C & D.
• Each register window consists of 10 local registers and
TWO sets of 6 registers common to adjacent windows.
• Local Registers: used for local variables.
• Common Registers: used for exchange of parameters and
results between adjacent procedures.
• Each procedure has 32 registers when it is active, these
are;
global regs + local regs + overlapping regs
10+10+6+6= 32 Registers

* ACA- Lecture
+ ACA- Lecture
Register Window Size:
G: No. of global registers.
L: No. of local registers in each window.
C: No. of registers common to two windows
W: No. of windows.
• Window size (S): No. of registers available for each
window.
Window Size= S= L+2C+G
• Register file (F): Total no. of registers needed in the
processor.
Register File= F= (L+C)W+G
For the given example:
G=10, L=10, C=6 and W=4, then
S= L+2C+G= 32 regs, and F= (L+C)W+G= 74 regs
, ACA- Lecture
Large Register File versus Cache:
• The register file, organized into windows, acts as a small,
fast buffer for holding a subset of all variables.
• The register file acts much like a cache memory.
• The window-based register file holds all the local scalar
variables of most recent procedure activations. The cache
holds a selection of recently used scalar variables. The
following table compares characteristics of two approaches:

- ACA- Lecture
It should be clear that the even the cache memory is as fast as the register
file, the access time will be considerably longer.

7 ACA- Lecture

Common questions

Powered by AI

Register windows in RISC architectures have the advantage of reducing the need to constantly save and restore register values during function calls, thereby increasing efficiency. They enable parameter passing without significant overhead by using overlapping windows that allow sharing of registers between procedures . However, a disadvantage arises when the nested procedure call depth exceeds the available register windows, necessitating the saving of registers to memory, which can lead to performance degradation .

In register window architecture, parameter, local, and temporary registers serve distinct roles to optimize subroutine execution. Parameter registers are used to hold values passed from calling procedures and results to be returned . Local registers store variables uniquely needed by each active subroutine, isolating them from other procedures . Temporary registers facilitate parameter and result exchange between adjacent procedures, as they overlap with the parameter registers of the next lower procedure level, ensuring seamless continuation of function calls without additional memory interaction .

Register files and cache memory both serve as fast storage for scalar variables, but they differ in scope and operation. Register files in RISC architectures act like a small, fast buffer specifically organized to hold local scalar variables from the most recent procedure activations through register windows, providing a tightly integrated and high-speed storage approach . Cache memory, on the other hand, stores a broader selection of recently used scalar variables, offering quick access to data that is not limited to recent procedure microsessions but involves a larger and slower data pool compared to register files .

The introduction of multiple-register banks addresses the challenge of time-consuming operations involved in saving and restoring registers during subroutine calls and returns. By assigning a separate register bank to each procedure, these operations are eliminated as each procedure uses its dedicated register set . An alternative solution to mitigate the same issue is using memory stacks to store parameters, although this incurs memory access penalties . Overlapped register windows serve as another alternative by avoiding the need for explicit saving/restoring through shared registers between procedures, thus enhancing performance .

RISC processors leverage a large number of registers to optimize performance by storing intermediate results directly in registers, minimizing the need for memory storage. Registers can transfer information to one another much faster than to and from memory, which greatly enhances processing speed . By keeping frequently accessed operands in registers, register-to-register operations are reduced, aligning with RISC processor characteristics .

The total number of registers needed in a RISC processor is calculated using the formula: Register File (F) = (L + C)W + G. Here, L represents the number of local registers in each window, C is the number of registers common to two adjoining windows, W denotes the number of windows, and G is the number of global registers . This formula accounts for the allocation of registers across multiple register windows and includes global registers that are always accessible, ensuring that enough registers are available for efficient execution and procedure handling.

A circular buffer is employed within RISC architectures to manage register windows dynamically. It acts as a limited-sized buffer where register windows are organized in a circular fashion, allowing new procedure activations to use the next available window. This structure allows handling multiple active procedures without overwriting critical data. However, when the buffer becomes full (i.e., more nested calls occur than the buffer can hold), it triggers an interrupt to save older register values to memory, preventing data corruption . This mechanism ensures efficient use of registers while avoiding unnecessary memory accesses unless absolutely necessary.

Register windowing in RISC processors streamlines subroutine management by allocating a separate set of registers (windows) for each active subroutine. Each CALL instruction assigns a new window, automatically handling parameter passing and reducing the need to save & restore registers to memory . Overlapping register windows further facilitate parameter exchange between subroutines by sharing registers physically between caller and callee procedures . This method minimizes time-consuming register save-and-restore operations, significantly boosting efficiency in handling nested subroutine calls .

The primary limitation of register windows arises when the depth of nested procedure calls exceeds the number of available windows, leading to overwriting of register values from previous procedures. This issue is managed by employing a circular buffer mechanism, which moves older windows to memory when the buffer is full . When the Current Window Pointer (CWP) matches the Saved Window Pointer (SWP), it triggers the saving of the oldest window to memory, freeing space for new procedures and preventing data loss or overwriting .

In a system with 74 registers, configured in register windows for procedures, each window consists of 32 registers: 10 global registers, 10 local registers, and two overlapping sets of 6 registers used as common registers for parameter exchange between adjacent procedures . With 4 windows accommodating procedures A, B, C, and D, the allocation ensures that each active procedure utilizes its own set of registers along with shared registers for efficient data exchange during function calls . This arrangement optimizes the retrieval and storage of procedure-specific data while reducing memory accesses.

You might also like