Class MMU

java.lang.Object
  |
  +--MMU

public class MMU
extends java.lang.Object

The MMU class represents the memory management unit hardware in a computer system.


Field Summary
static int FRAME_COUNT
          MMU.FRAME_COUNT is the number of page frames in physical memory.
static int MEMORY_SIZE
          MMU.MEMORY_SIZE is the number of bytes in physical memory.
static int NONE
          MMU.NONE is the int code for disallowing all access.
static int OFFSET_BITS
          MMU.OFFSET_BITS is the number of page offset bits in a memory address.
static int PAGE_SIZE
          MMU.PAGE_SIZE is the size of a memory page.
static int READ
          MMU.READ is the int code for read access.
static int RO
          MMU.RO is the int code for allowing read-only access.
static int RW
          MMU.RW is the int code for allowing read-write access.
static int WRITE
          MMU.WRITE is the int code for write access.
 
Method Summary
static int getAdjustedSize(int sz)
          MMU.getAdjustedSize(sz) returns the smallest integer multiple of MMU.PAGE_SIZE that is greater than or equal to sz.
static Page getPage(int frameNum)
          MMU.getPage(frameNum) returns the contents of the frame numbered frameNum.
static void putPage(int frameNum, Page pg)
          MMU.putPage(frameNum, pg) puts the contents of pg into the frame numbered frameNum.
static void read(int addr)
          MMU.read(addr) simulates a memory read at address addr.
static void setPTBR(PageTable pt)
          MMU.setPTBR(pt) sets the page table base register to point to pt.
static void write(int addr)
          MMU.write(addr) simulates a memory write at address addr.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OFFSET_BITS

public static final int OFFSET_BITS
MMU.OFFSET_BITS is the number of page offset bits in a memory address.

See Also:
Constant Field Values

PAGE_SIZE

public static final int PAGE_SIZE
MMU.PAGE_SIZE is the size of a memory page.

This definition should not be changed. To change the page size, change the OFFSET_BITS definition.

See Also:
Constant Field Values

MEMORY_SIZE

public static final int MEMORY_SIZE
MMU.MEMORY_SIZE is the number of bytes in physical memory.

See Also:
Constant Field Values

FRAME_COUNT

public static final int FRAME_COUNT
MMU.FRAME_COUNT is the number of page frames in physical memory.

This definition should not be changed. To change the number of pages, change the MEMORY_SIZE definition or the PAGE_SIZE definition.

See Also:
Constant Field Values

READ

public static final int READ
MMU.READ is the int code for read access.

See Also:
Constant Field Values

WRITE

public static final int WRITE
MMU.WRITE is the int code for write access.

See Also:
Constant Field Values

NONE

public static final int NONE
MMU.NONE is the int code for disallowing all access.

See Also:
Constant Field Values

RO

public static final int RO
MMU.RO is the int code for allowing read-only access.

See Also:
Constant Field Values

RW

public static final int RW
MMU.RW is the int code for allowing read-write access.

See Also:
Constant Field Values
Method Detail

getAdjustedSize

public static int getAdjustedSize(int sz)
MMU.getAdjustedSize(sz) returns the smallest integer multiple of MMU.PAGE_SIZE that is greater than or equal to sz. string.


setPTBR

public static void setPTBR(PageTable pt)
MMU.setPTBR(pt) sets the page table base register to point to pt.


read

public static void read(int addr)
MMU.read(addr) simulates a memory read at address addr.


write

public static void write(int addr)
MMU.write(addr) simulates a memory write at address addr.


putPage

public static void putPage(int frameNum,
                           Page pg)
MMU.putPage(frameNum, pg) puts the contents of pg into the frame numbered frameNum.


getPage

public static Page getPage(int frameNum)
MMU.getPage(frameNum) returns the contents of the frame numbered frameNum.