|
jmce - 1_02 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjmce.sim.AbstractHardware
jmce.sim.AbstractPeripheral
jmce.sim.memory.AbstractMemory
public abstract class AbstractMemory
Abstract implementation of Memory.
All method not relative to set/get memory operation are implemented from this class. Also implements helper to make simple add virtual memory features this make the class a little bit more complex but do not change the performance on critical operation. All subclass must remember to call the method setSize() to allocate space for listener and names.
Field Summary | |
---|---|
protected int |
size
Size of this memory |
protected FastArray<AbstractMemory> |
vms
Array with all virtual memory |
Fields inherited from class jmce.sim.AbstractPeripheral |
---|
cpu |
Constructor Summary | |
---|---|
AbstractMemory()
|
|
AbstractMemory(java.lang.String name)
|
Method Summary | |
---|---|
void |
addHardwareMemory(Memory m)
Add a new memory and also add to the hardware list. |
void |
addMemory(Memory v)
Add virtual memory to the actual list. |
void |
addMemoryReadListener(int a,
MemoryReadListener l)
|
void |
addMemoryReadListener(MemoryReadListener l)
|
void |
addMemoryWriteListener(int a,
MemoryWriteListener l)
Add a specific MemoryWriteListener. |
void |
addMemoryWriteListener(MemoryWriteListener l)
Add a global MemoryWriteListener. |
void |
clrBit(int a,
int mask)
|
protected abstract int |
get(int a)
Get memory. |
int |
getMemory(int add)
Get a location of memory. |
protected AbstractMemory |
getMemoryAt(int i)
Return the specified memory |
protected int |
getMemoryCount()
Return the number of virtual memory |
java.lang.String |
getMemoryName(int a)
|
MemoryReadListener |
getMemoryReadListenerAt(int i)
|
MemoryReadListener |
getMemoryReadListenerAt(int a,
int i)
|
int |
getMemoryReadListenerCount()
|
int |
getMemoryReadListenerCount(int a)
|
MemoryWriteListener |
getMemoryWriteListenerAt(int i)
|
MemoryWriteListener |
getMemoryWriteListenerAt(int a,
int i)
|
int |
getMemoryWriteListenerCount()
Return the number of global memory write listener installed. |
int |
getMemoryWriteListenerCount(int a)
Return the number of specific memory write listener installed at the specified affress. |
boolean |
getReadOnly(int add)
Check if a speficied location is read only. |
int |
getSize()
Return the size of the memory in byte. |
boolean |
isBit(int a,
int mask)
|
protected int |
mapAddress(int a)
Map address for virtual memory. |
protected Memory |
mapMemory(int a)
Map memory for virtual memory. |
void |
removeMemoryReadListener(int a,
MemoryReadListener l)
|
void |
removeMemoryReadListener(MemoryReadListener l)
|
void |
removeMemoryWriteListener(int a,
MemoryWriteListener l)
Remove a previus specific installed memory write listener. |
void |
removeMemoryWriteListener(MemoryWriteListener l)
Remove a previous global installed memory write listener. |
protected abstract void |
set(int a,
int v)
Set memory. |
void |
setBit(int a,
int mask)
|
void |
setMemory(int add,
int v)
Set a location of memory. |
void |
setMemoryName(int a,
java.lang.String name)
|
void |
setReadOnly()
Set the flag read only for all the memory |
void |
setReadOnly(int add)
Set the flag read only for a single address. |
void |
setReadOnly(int a,
int len)
Set the flag read only for the specified range |
void |
setSize(int newSize)
Set the size of the memory. |
java.lang.String |
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, init, 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, init, initSwing, removeHardware, removeHardware, reset, setHardware, setHardware, setName |
Field Detail |
---|
protected FastArray<AbstractMemory> vms
protected int size
Constructor Detail |
---|
public AbstractMemory()
public AbstractMemory(java.lang.String name)
Method Detail |
---|
protected abstract void set(int a, int v)
Used by subclass to implement the phisical memory.
protected abstract int get(int a)
Used by subclass to implement the phisical memory.
public final boolean getReadOnly(int add)
Memory
getReadOnly
in interface Memory
public final void setReadOnly()
Memory
setReadOnly
in interface Memory
public final void setReadOnly(int a, int len)
Memory
setReadOnly
in interface Memory
public final void setReadOnly(int add)
Memory
setReadOnly
in interface Memory
public final void addMemoryWriteListener(MemoryWriteListener l)
Memory
The listener will be called when any location of the memory is writed.
addMemoryWriteListener
in interface Memory
l
- - Memory write listener called when the memory is
writed.public final void removeMemoryWriteListener(MemoryWriteListener l)
Memory
removeMemoryWriteListener
in interface Memory
public final void addMemoryWriteListener(int a, MemoryWriteListener l)
Memory
The listener will be called when the specified memory location is written.
addMemoryWriteListener
in interface Memory
a
- - Address where to install the listener.l
- - Memory write listener called when the memory is
writed.public void removeMemoryWriteListener(int a, MemoryWriteListener l)
Memory
removeMemoryWriteListener
in interface Memory
public void addMemoryReadListener(MemoryReadListener l)
addMemoryReadListener
in interface Memory
public void removeMemoryReadListener(MemoryReadListener l)
removeMemoryReadListener
in interface Memory
public void removeMemoryReadListener(int a, MemoryReadListener l)
removeMemoryReadListener
in interface Memory
public void addMemoryReadListener(int a, MemoryReadListener l)
addMemoryReadListener
in interface Memory
public int getMemoryWriteListenerCount()
Memory
getMemoryWriteListenerCount
in interface Memory
public int getMemoryWriteListenerCount(int a)
Memory
getMemoryWriteListenerCount
in interface Memory
public int getMemoryReadListenerCount()
getMemoryReadListenerCount
in interface Memory
public int getMemoryReadListenerCount(int a)
getMemoryReadListenerCount
in interface Memory
public MemoryWriteListener getMemoryWriteListenerAt(int i)
getMemoryWriteListenerAt
in interface Memory
public MemoryReadListener getMemoryReadListenerAt(int i)
getMemoryReadListenerAt
in interface Memory
public MemoryWriteListener getMemoryWriteListenerAt(int a, int i)
getMemoryWriteListenerAt
in interface Memory
public MemoryReadListener getMemoryReadListenerAt(int a, int i)
getMemoryReadListenerAt
in interface Memory
public void setSize(int newSize)
Memory
setSize
in interface Memory
public int getSize()
Memory
getSize
in interface Memory
public final void setMemoryName(int a, java.lang.String name)
setMemoryName
in interface Memory
public final java.lang.String getMemoryName(int a)
getMemoryName
in interface Memory
public void addHardwareMemory(Memory m)
m
- - Memory to add.public void addMemory(Memory v)
protected int getMemoryCount()
protected AbstractMemory getMemoryAt(int i)
public boolean isBit(int a, int mask) throws MemoryException
isBit
in interface Memory
MemoryException
public void setBit(int a, int mask) throws SIMException
setBit
in interface Memory
SIMException
public void clrBit(int a, int mask) throws SIMException
clrBit
in interface Memory
SIMException
public final int getMemory(int add) throws SIMException
Memory
getMemory
in interface Memory
add
- - Location
SIMException
public final void setMemory(int add, int v) throws SIMException
Memory
setMemory
in interface Memory
add
- - Memory addressv
- - Value to set only 8 bit are used
SIMException
protected Memory mapMemory(int a)
This method must be overriden from virtual memory sub class.
protected int mapAddress(int a)
This method must be overridden from virtual memory sub class.
public java.lang.String toString()
toString
in class AbstractHardware
|
jmce - 1_02 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |