Solve RISC CPU Questions - Confirm Answers

  • Thread starter Thread starter fran1942
  • Start date Start date
  • Tags Tags
    cpu
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
2 replies · 6K views
fran1942
Messages
80
Reaction score
0
Hello, I am having some trouble with the following set of questions.
I include them along with my answers.
Would anyone be able to confirm if I am correct here ?
Thanks kindly for any help.

Suppose a RISC machine uses overlapping register windows for passing parameters between procedures. The machine has 298 registers, and each register window has 22 registers, of which 10 are global registers and 10 are local registers. Answer the following:

a) How many registers would be available for use by input parameters?
My attempted answer: 1

b) How many registers would be available for use by output parameters?
My attempted answer: 1

c) How many register windows would be available for use?
My attempted answer: 13

d) By how much would the current window pointer (CWP) be incremented at each procedure call ?
My attempted answer: By 12.
 
Last edited:
Physics news on Phys.org
I'm very rusty but nobody else has answered so...

As I recall with overlapping register windows the output register is at the end of the window so by incrementing the CWP the output resister of one proceedure automatically becomes the input register of the next proceedure. See drawing.

So I think the CWP only needs to be incremented by 11 not 12.

However that would mean the number of windows you can fit into 298 registers isn't a whole number so I'm probably wrong...

298 - 10 global = 288
but
288/11 = 26.18
 

Attachments

  • Registers.png
    Registers.png
    2 KB · Views: 765
  • Like
Likes   Reactions: 1 person
Well I can make the number fit by assuming that the CWP register is one of the 298 registers...

298 - 10 global - 1 CWP = 287

All the windows are 11 registers long except one which is 12 so

287 = 11*n + 12

n = 25 so there are 26 windows in all.
 
  • Like
Likes   Reactions: 1 person