CompSci

profilekhalidru
pp05.pdf

Lab 5 Instruction

Assume that a system has a 32-bit virtual address with a 4-KB page size (12bits). Write a program that is passed a virtual address (in decimal) via the attached txt file (5pts) and have it output the page number and offset for the given address in the command line (5pts). The program should mask page number and offset from an unsigned 32-bit address. (5pts)

A memory reference appears as:

|------------|-----|

31 12 11 0

As an example, your program would run as follows:

./mm input.txt

Number of Translated Addresses: 456

Address PageNumber Offset

16916 4 532

62493 15 1053

…..

printf("***DONE***\n");

Submission Instruction:

1.  Test your code. 2.  Take a screenshot of the first and last page of your output and save them

in a PDF file as YourCSUNID_YourLastName.pdf. 3.  Upload your source code in one file. The source code file should be named

as yourCSUNID_1.c and submitted here in Moodle.