jmce - 1_02

jmce.sim.memory
Class PersistentMemory

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.PersistentMemory
All Implemented Interfaces:
Hardware, Memory, MemoryWriteListener, Peripheral, ResetListener, TimerListener
Direct Known Subclasses:
AT24C16

public class PersistentMemory
extends PlainMemory
implements TimerListener, MemoryWriteListener, ResetListener


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
PersistentMemory()
           
PersistentMemory(java.lang.String name, java.lang.String filename, int size)
           
 
Method Summary
protected  java.lang.String filename()
          Return the filename used for read/write memory.
 java.lang.String getFilename()
           
 void init(Hardware parent)
          Initialize the hardware.
protected  void load()
           
 void registerCPU(CPU cpu)
          Register a parent CPU for future reference.
 void reset(CPU cpu)
           
 void setFilename(java.lang.String filename)
           
 void timerExpired()
          Timer called at regular interval.
 void writeMemory(Memory m, int a, int v, int o)
          Called when a memory write event occours.
 
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, mapAddress, mapMemory, removeMemoryReadListener, removeMemoryReadListener, removeMemoryWriteListener, removeMemoryWriteListener, setBit, setMemory, setMemoryName, setReadOnly, setReadOnly, setReadOnly, toString
 
Methods inherited from class jmce.sim.AbstractPeripheral
idle, 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, 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
 
Methods inherited from interface jmce.sim.Hardware
addHardware, destroy, getHardware, getHardware, getHardware, getHardware, getHardwareCount, getHardwareInstances, getHardwareTree, getName, getParent, initSwing, removeHardware, removeHardware, setHardware, setHardware, setName
 

Constructor Detail

PersistentMemory

public PersistentMemory()

PersistentMemory

public PersistentMemory(java.lang.String name,
                        java.lang.String filename,
                        int size)
Method Detail

writeMemory

public void writeMemory(Memory m,
                        int a,
                        int v,
                        int o)
Description copied from interface: MemoryWriteListener
Called when a memory write event occours.

This method is called when a memory write operation occours in the specified memory.

Specified by:
writeMemory in interface MemoryWriteListener
Parameters:
m - - Memory involved in the write operation.
a - - Address written.
v - - Value written.
o - - Old value of this memory location.

setFilename

public void setFilename(java.lang.String filename)

getFilename

public java.lang.String getFilename()

registerCPU

public void registerCPU(CPU cpu)
                 throws SIMException
Description copied from interface: Peripheral
Register a parent CPU for future reference.

Specified by:
registerCPU in interface Peripheral
Overrides:
registerCPU in class AbstractPeripheral
Throws:
SIMException

reset

public void reset(CPU cpu)
           throws SIMException
Specified by:
reset in interface ResetListener
Throws:
SIMException

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

timerExpired

public void timerExpired()
Timer called at regular interval. Check if the memory is changed and than write the memory to one file if necessary.

Specified by:
timerExpired in interface TimerListener

filename

protected java.lang.String filename()
Return the filename used for read/write memory.


load

protected void load()
             throws SIMException
Throws:
SIMException

jmce - 1_02