jmce - 1_02

jmce.sim.memory
Class BankedMemory

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.BankedMemory
All Implemented Interfaces:
Hardware, Memory, Peripheral
Direct Known Subclasses:
Memory, Memory, Memory

public class BankedMemory
extends PlainMemory


Field Summary
 
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
BankedMemory()
          Default constructor
BankedMemory(java.lang.String name, int bankSize, int numBank, int numPage, int pageSize)
          Constructor with all parameter.
 
Method Summary
protected  int get(int a)
          Get memory.
 int getBank()
          Return the current bank
 int getNumBank()
          Return the number of bank
 int getNumPage()
          Return the number of page in each bank.
 int getPageMap(int bank, int page)
          Return the mapping for one page.
 int getPageSize()
          Return the size of the page.
 int getSharedSize()
          Return the size of the shared area.
 int getSharedStart()
          Return the start of the shared area in pages.
protected  void initMmu()
          Initialize the MMU.
 boolean isMmuInitialized()
          Return true if the MMU is initialized and the memory operate as banked.
 void reset()
          Reset the memory to initial state.
protected  void set(int a, int v)
          Set memory.
 void setBank(int n)
          Set the current bank.
 void setNumBank(int n)
          Set the number of bank
 void setNumPage(int n)
          Set the number of page in each bank.
 void setPageMap(int bank, int page, int p)
          Map a page of memory.
 void setPageSize(int n)
          Set the size of each page in byte.
 void setSharedSize(int n)
          Set the lenght of the shared area in page
 void setSharedStart(int n)
          Set the start address of the shared area in page.
 void showMemory()
          Show using log the configuration of memory.
 java.lang.String toString()
           
 
Methods inherited from class jmce.sim.memory.PlainMemory
allocMemory, copyMemory, 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, mapAddress, mapMemory, 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
 

Constructor Detail

BankedMemory

public BankedMemory()
Default constructor


BankedMemory

public BankedMemory(java.lang.String name,
                    int bankSize,
                    int numBank,
                    int numPage,
                    int pageSize)
Constructor with all parameter.

Method Detail

setPageSize

public final void setPageSize(int n)
Set the size of each page in byte.


getPageSize

public final int getPageSize()
Return the size of the page.


setNumPage

public final void setNumPage(int n)
Set the number of page in each bank.


getNumPage

public final int getNumPage()
Return the number of page in each bank.


setNumBank

public final void setNumBank(int n)
Set the number of bank


getNumBank

public final int getNumBank()
Return the number of bank


initMmu

protected final void initMmu()
Initialize the MMU.

Till this method is not called the memory operate like a standard memory. After the MMU initialization the content of the memory for each bank is the same of the content of the standard memory before the initialization.


setSharedStart

public final void setSharedStart(int n)
Set the start address of the shared area in page.


setSharedSize

public final void setSharedSize(int n)
Set the lenght of the shared area in page


getSharedSize

public final int getSharedSize()
Return the size of the shared area.


getSharedStart

public final int getSharedStart()
Return the start of the shared area in pages.


getBank

public final int getBank()
Return the current bank


setBank

public final void setBank(int n)
Set the current bank.


get

protected final int get(int a)
Description copied from class: AbstractMemory
Get memory.

Used by subclass to implement the phisical memory.

Overrides:
get in class PlainMemory

set

protected final void set(int a,
                         int v)
Description copied from class: AbstractMemory
Set memory.

Used by subclass to implement the phisical memory.

Overrides:
set in class PlainMemory

reset

public void reset()
           throws SIMException
Description copied from class: PlainMemory
Reset the memory to initial state. Fill the memory with 0xff

Specified by:
reset in interface Hardware
Overrides:
reset in class PlainMemory
Throws:
SIMException

isMmuInitialized

public boolean isMmuInitialized()
Return true if the MMU is initialized and the memory operate as banked.


showMemory

public void showMemory()
Show using log the configuration of memory.


setPageMap

public final void setPageMap(int bank,
                             int page,
                             int p)
Map a page of memory.

Parameters:
bank - - Bank number.
page - - Logical page.
p - - Phisical page.
Since:
1.01

getPageMap

public final int getPageMap(int bank,
                            int page)
Return the mapping for one page.

Parameters:
bank - - Bank number.
page - - Logical page.
Returns:
the Phisical page.
Since:
1.01

toString

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

jmce - 1_02