previous | start | next

Virtual Address Translation

For a virtual address in a segment, its physical address (in bytes) is:

     phys_addr = segment_base_phys_addr + byte_offset

The segment_base_phys_addr is in the mem_map, but it is in clicks instead of bytes.

The byte_offset is equal to the difference between the byte virtual address and the segment_base_virtual_addr (in bytes). The segment_base_virtual_addr is also in the mem_map, but also in clicks instead of bytes.

Putting everything in terms of clicks and the data in the mem_map:



 va: Virtual address in bytes
 csize: Click size
 bva: Segment base virtual address in clicks
 bpa: Segment base physical address in clicks
 pa: Physical Address in bytes
     segment_base_phys_addr = bpa * csize

     byte_offset = va - bva * csize

So

    pa = segment_base_phys_addr + byte_offset 
or
    pa = (bpa * csize) + (va - bva * csize)


previous | start | next