jmce - 1_02

jmce.sim.memory
Class MappedMemory

java.lang.Object
  extended by jmce.sim.AbstractHardware
      extended by jmce.sim.AbstractPeripheral
          extended by jmce.sim.memory.AbstractMemory
              extended by jmce.sim.memory.PlainMemory
                  extended by jmce.sim.memory.MappedMemory
All Implemented Interfaces:
Hardware, Memory, Peripheral

public class MappedMemory
extends PlainMemory

Mapped memory

This Class implement one memory base over other memory mapped to this one. All part of memory not mapped will be redirect to a standard PlainMemory. The memory can be mapped at address and size multiple of the page size.

Version:
1.01
Author:
Mario Viara

Field Summary
protected  int page
          Size of minimum mapped unit in bytes
protected  jmce.sim.memory.MappedMemory.Page[] pages
          Pages of memory
 
Fields inherited from class jmce.sim.memory.PlainMemory
memory, tmpMemory
 
Fields inherited from class jmce.sim.memory.AbstractMemory
size, vms
 
Fields inherited from class jmce.sim.AbstractPeripheral
cpu
 
Constructor Summary
MappedMemory()
          Default constructor
MappedMemory(java.lang.String name, int size)
          Constructor with only name and size.
MappedMemory(java.lang.String name, int size, int page)
          Constructor with all paramater.
 
Method Summary
 int getPage()
           
protected  int mapAddress(int a)
          Map address for virtual memory.
protected  Memory mapMemory(int a)
          Map memory for virtual memory.
 void mapMemory(Memory m, int address, int offset, int size)
           
 void setPage(int page)
           
 java.lang.String toString()
           
 
Methods inherited from class jmce.sim.memory.PlainMemory
allocMemory, copyMemory, get, reset, set, setSize
 
Methods inherited from class jmce.sim.memory.AbstractMemory
addHardwareMemory, addMemory, addMemoryReadListener, addMemoryReadListener, addMemoryWriteListener, addMemoryWriteListener, clrBit, getMemory, getMemoryAt, getMemoryCount, getMemoryName, getMemoryReadListenerAt, getMemoryReadListenerAt, getMemoryReadListenerCount, getMemoryReadListenerCount, getMemoryWriteListenerAt, getMemoryWriteListenerAt, getMemoryWriteListenerCount, getMemoryWriteListenerCount, getReadOnly, getSize, isBit, removeMemoryReadListener, removeMemoryReadListener, removeMemoryWriteListener, removeMemoryWriteListener, setBit, setMemory, setMemoryName, setReadOnly, setReadOnly, setReadOnly
 
Methods inherited from class jmce.sim.AbstractPeripheral
idle, registerCPU, setIdle, setLive
 
Methods inherited from class jmce.sim.AbstractHardware
addHardware, createFrame, destroy, getHardware, getHardware, getHardware, getHardware, getHardware, getHardwareCount, getHardwareForName, getHardwareInstances, getHardwareTree, getName, getParent, init, initSwing, removeHardware, removeHardware, setHardware, setHardware, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jmce.sim.Peripheral
idle, registerCPU
 
Methods inherited from interface jmce.sim.Hardware
addHardware, destroy, getHardware, getHardware, getHardware, getHardware, getHardwareCount, getHardwareInstances, getHardwareTree, getName, getParent, init, initSwing, removeHardware, removeHardware, setHardware, setHardware, setName
 

Field Detail

page

protected int page
Size of minimum mapped unit in bytes


pages

protected jmce.sim.memory.MappedMemory.Page[] pages
Pages of memory

Constructor Detail

MappedMemory

public MappedMemory(java.lang.String name,
                    int size,
                    int page)
Constructor with all paramater.

Parameters:
name - - Name of the memory.
size - - Total size of memory.
page - - Size of each page.

MappedMemory

public MappedMemory(java.lang.String name,
                    int size)
Constructor with only name and size.


MappedMemory

public MappedMemory()
Default constructor

Since:
1.01
Method Detail

getPage

public int getPage()

setPage

public void setPage(int page)

mapMemory

public void mapMemory(Memory m,
                      int address,
                      int offset,
                      int size)
               throws SIMException
Throws:
SIMException

mapMemory

protected Memory mapMemory(int a)
Description copied from class: AbstractMemory
Map memory for virtual memory.

This method must be overriden from virtual memory sub class.

Overrides:
mapMemory in class AbstractMemory

mapAddress

protected int mapAddress(int a)
Description copied from class: AbstractMemory
Map address for virtual memory.

This method must be overridden from virtual memory sub class.

Overrides:
mapAddress in class AbstractMemory

toString

public java.lang.String toString()
Overrides:
toString in class AbstractMemory

jmce - 1_02