jmce - 1_02

jmce.sim.memory
Class ArrayMemory

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

public class ArrayMemory
extends AbstractMemory

Array memory.

This type of memory are implemented using one array of memory and only one can be enabled at time. It look like a BankedMemory but each bank can be a different memory and do not support shared page.

Version:
1.01
Author:
Mario Viara

Field Summary
 
Fields inherited from class jmce.sim.memory.AbstractMemory
size, vms
 
Fields inherited from class jmce.sim.AbstractPeripheral
cpu
 
Constructor Summary
ArrayMemory()
           
 
Method Summary
 void addMemory(Memory v)
          Add virtual memory to the actual list.
protected  int get(int a)
          Get memory.
 int getIndex()
          Return the index of the current selected memory.
 int getSize()
          Return the size of the memory in byte.
 void init(Hardware parent)
          Initialize the hardware.
protected  int mapAddress(int a)
          Map address for virtual memory.
protected  Memory mapMemory(int a)
          Map memory for virtual memory.
protected  void set(int a, int v)
          Set memory.
 void setIndex(int i)
          Set the memory index.
 void setSize(int newSize)
          Set the size of the memory.
 
Methods inherited from class jmce.sim.memory.AbstractMemory
addHardwareMemory, addMemoryReadListener, addMemoryReadListener, addMemoryWriteListener, addMemoryWriteListener, clrBit, getMemory, getMemoryAt, getMemoryCount, getMemoryName, getMemoryReadListenerAt, getMemoryReadListenerAt, getMemoryReadListenerCount, getMemoryReadListenerCount, getMemoryWriteListenerAt, getMemoryWriteListenerAt, getMemoryWriteListenerCount, getMemoryWriteListenerCount, getReadOnly, isBit, removeMemoryReadListener, removeMemoryReadListener, removeMemoryWriteListener, removeMemoryWriteListener, setBit, setMemory, setMemoryName, setReadOnly, setReadOnly, setReadOnly, toString
 
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, initSwing, removeHardware, removeHardware, reset, 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, initSwing, removeHardware, removeHardware, reset, setHardware, setHardware, setName
 

Constructor Detail

ArrayMemory

public ArrayMemory()
Method Detail

set

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

Used by subclass to implement the phisical memory.

Specified by:
set in class AbstractMemory

get

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

Used by subclass to implement the phisical memory.

Specified by:
get in class AbstractMemory

setSize

public void setSize(int newSize)
Description copied from interface: Memory
Set the size of the memory.

Specified by:
setSize in interface Memory
Overrides:
setSize in class AbstractMemory

getSize

public int getSize()
Description copied from interface: Memory
Return the size of the memory in byte.

Specified by:
getSize in interface Memory
Overrides:
getSize in class AbstractMemory

init

public void init(Hardware parent)
          throws SIMException
Description copied from interface: Hardware
Initialize the hardware. This method must be called before any use of the interface. Only set ... / get ... method are allowed to be called before the intialization.

Specified by:
init in interface Hardware
Overrides:
init in class AbstractHardware
Parameters:
parent - Parent of this hardware.
Throws:
SIMException

getIndex

public int getIndex()
Return the index of the current selected memory.


setIndex

public void setIndex(int i)
Set the memory index.


mapMemory

protected final 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 final 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

addMemory

public void addMemory(Memory v)
Add virtual memory to the actual list.

Overrides:
addMemory in class AbstractMemory
Since:
1.02

jmce - 1_02