Stage 8 - Page translation questions

65 views
Skip to first unread message

jeremy

unread,
Nov 19, 2022, 6:10:06 PM11/19/22
to XOS Users
Hello, I am a little confused with the mechanism for address translation.

the values given are the following : 
- IP 3000
- PTBR 29696

The operation given to get the logical page is : 
IP / 512
The operation given to get the location of physical page number : 
logical page * 2 + PTBR

so I get the following results : 
3000 / 512 = 5
5 * 2 + 29696 = 29706

But the answers given are 29714. 
I do not understand where I am making an error so as to not get the proper results.
thanks for your help.

jeremy

unread,
Nov 19, 2022, 6:17:24 PM11/19/22
to XOS Users
Same goes for the rest of the operations : 

The operation give to get offset : 
IP % page size
3000 % 512 = 440 

The operation given to get physical address is :
physical page number * page size + offset
35 * 512 + 440 = 18360

The answer given in stage 8 is 18313

Is there an error in the doc or is there an error in my process. Thanks again for your help.

Arun Joseph

unread,
Nov 19, 2022, 9:58:10 PM11/19/22
to XOS Users
The question is about where the return address will be stored before transferring control to the timer. So, the SP value of 5000 should be used for the calculation instead of the IP as the return address is added on top of the stack.

jeremy

unread,
Nov 20, 2022, 8:35:40 AM11/20/22
to XOS Users
ooooh I see, I had completely misunderstood the question. Thanks for the fast answer.

jeremy

unread,
Nov 20, 2022, 10:21:00 AM11/20/22
to XOS Users
I have another question, I am not getting the same result for the physical address calculated where the instruction will be stored : 

The result I get is 18312
35 * 512 + 392

but the answer given is 18313.
Is it because the address 18312 of the stack already has a value in it, therefore the next address is used?

jeremy

unread,
Nov 20, 2022, 10:24:05 AM11/20/22
to XOS Users
I got it, I had forgotten that 1 was added to SP before the process of translation was done.
Reply all
Reply to author
Forward
0 new messages