SPARC Registers - mbits-mirafra/computerArchitectureCourse GitHub Wiki

Welcome to the SPARC_ARCHITECTURE wiki!

SPARC Registers

Screenshot from 2024-02-08 20-32-41

  • The most interesting feature which was brought out by SPARC architecture was the concept of register windows. what they have is there is a large number of registers which could be as much as 128 to 256 or even more; in different implementations actually the size differs but a program sees only 32 registers at a time so to say it has a window of 32 registers at any time which can move up or down as you go from one context to other context.

  • If you have a larger requirement then you need to do lot of transfers to memory, save them and restore them. So it is this problem which is addressed by register windows that when you make a call to a procedure or function you get a fresh set of registers so that the caller and the callee can work independently on their own set of registers.

  • But this is another extreme; you also want some linkages some flow of data between caller and callee in terms of parameters.

  • So therefore the two windows are not totally disjoint they are overlapping and overlap is in a very regular fashion.

  • For example, suppose you are in the main program you will see total of 32 registers and these are divided into four parts: input, local, output, global.

  • So as the windows change the global registers eight of them remain unchanged so you see same eight registers which are let us say out of array of 256 registers and the first eight are always part of the window and local are those which are totally exclusive to a given context whereas in and out are overlapping.

  • So when, for example, from this context you make a call to another function then the set of eight registers which was out here become in for that.

  • Essentially this is a way you pass parameters. Whatever information up to eight values which you want to pass on you can load into these eight registers and then when you make a call the window slides, you get these 24 registers, the global remains the same and what was out has not become in because these are the registers which have carried information into it and what appears as out will become in for the next level. So out of these 24 registers 8 are used for getting information..... 8 are purely local, 8 are used for getting information out to the next level.

  • Once you have got some values in registers you can use them for local usage also. So at any given time you have these 24 or some other 24 registers and 8 global registers.

  • Now, to keep track of current window you need a current window pointer or CWP. Suppose CWP or the window pointer is pointing to this window next it will point to that window, when return occurs it gets back to the same thing.

  • so suppose you have 128 or 256 whatever be the number there is a finite set of windows which are possible and if depth of calls become more than that then actually windows act like, this set of registers acts like a cyclic buffer.

  • So we can keep on going deeper and the window keeps on sliding but of course as it loops back the old window the first one will have to be saved in memory otherwise it will be overwritten.

  • So that saving and restoring has to be done but when we go to a depth of let us say 8 or so then we will have to worry about saving or restoring.

  • For most practical purposes the depth would typically not be more than 4, 5 or 6 and often these windows are fives so it is only in rare cases that you need to spend time and effort in saving and restoring the windows.

  • Otherwise call to a procedure is speeded up by this facility.