Sid M. answered 02/13/21
Studied Computer Science and Engineering at University of Washington
Computer system with
page size 16 bytes,
virtual memory capacity 1024 bytes,
physical memory capacity 256 bytes.
I need the following answers: size of the virtual address in bits in which I need the bits for the page and for the shifting, the size of the physical address, also with the bits for the page and for the shifting.
From your description, a virtual memory address looks like this:
Since the virtual memory capacity is 1024 bytes, a virtual address must be able to reference all 1024 bytes,; this requires a total of 10 bits. Since a page is 16 bytes, each page offset must be able to reference all 16 bytes; this requires 4 bits. So, for a 10-bit virtual address, the right-most 4 bits are the pages offset, and the left-most 6 bits are the page index. The shift of a virtual address to isolate the page index is 4, and the mask is 0x3F; the mask for the page offset is 0xF.
A physical memory address looks like this:
Since the physical memory capacity is 256 bytes, a physical address must be able to reference all 256 bytes; this requires a total of 8 bits. Since a page is, again, 16 bytes, each page offset must be able to reference all 16 bytes; this (still) requires 4 bits. So, for an 8-bit physical address, the right-most 4 bits are the pages offset, and the left-most 4 bits are the page index. The shift of a physical address to isolate the page index is 4, and the mask is 0xF; the mask for the page offset is (also) 0xF.
The content of part of the page is:
Index: 0, 1, 2, 3, 4, 5, 6
Validity: 2 1, 3 1, 4 0, 1 1, 5 1, 1 0, 71.
I also need the number of the items of the whole table.
Unfortunately, you don't provide enough information to describe what I believe you intended to represent a page table, populated with the physical page mapped from a virtual page (index): e.g.
However, for a page table to be able to represent all virtual pages available, the 6-bit page address implies that there are 64 page entries, with indices 0..63.
And the last answer I need is how will the virtual address 0001000111 be mapped in the physical address.
Since you didn't provide the physical page indices corresponding to the respective virtual pages, I can only give a partial answer:
The 10-bit virtual address (0001000111) is made up of the 6-bit virtual page index (000100, or 4 decimal) and the 4-bit page offset (0111, or 7 decimal). This means that the virtual address is referencing byte #7 (counting from 0, of 16 bytes in the page) byte, of virtual page #4 (also counting from 0, of 64 pages).
From what I've been able to deduce from the description, virtual page #4 is invalid, so there is no correct mapping from this page to a physical page.