hades.models.mips.memory
Class BreakPointMemory

java.lang.Object
  extended byhades.models.mips.memory.BreakPointMemory
All Implemented Interfaces:
Memory
Direct Known Subclasses:
Registers, TinyBPMemory

public class BreakPointMemory
extends java.lang.Object
implements Memory

Memories can be fitted with breakpoints.


Field Summary
static int BP_IDLE
           
static int BP_READALL
           
static int BP_READVAL
           
static int BP_WRITEALL
           
static int BP_WRITEVAL
           
protected  BreakPointHandler bpHandler
           
protected  boolean bpHandlerInstalled
           
protected  boolean debug
           
protected  BaseMemory mem
           
protected  BaseMemory readBP
           
protected  BaseMemory readVal
           
protected  BaseMemory writeBP
           
protected  BaseMemory writeVal
           
 
Constructor Summary
BreakPointMemory(int newSize, int newBits)
           
 
Method Summary
 boolean getLog()
          Get debug mode
 Memory getMemory()
          For access without breakpoints
 int getMemorySize()
          Capacity of the memory in words
 Memory getReadBPMemory()
          For access to read breakpoint memory
 Memory getReadValMemory()
          For access to read breakpoint value memory
 int getWordWidth()
          Witdh of one word in bits
 Memory getWriteBPMemory()
          For access to write breakpoint memory
 Memory getWriteValMemory()
          For access to write breakpoint value memory
 void installBreakPointHandler(BreakPointHandler newBreakPointHandler)
          The BreakPointHandler will be called if a breakpoint occurs
 void installEntryHandler(EntryHandler entryHandler)
          setEntry() calles this EntryHandler
 int readMemory(int address)
          Read a word from the memory
 void setEntry(int entry, int globalPointer)
          Set the entry address if memory contains a executable program
 void setLog(boolean newDebug)
          Enable or disable logging output
 void setReadBP(boolean isBreakPoint, boolean hasValue, int adr, int value)
          Set or unset read breakpoint.
 void setWriteBP(boolean isBreakPoint, boolean hasValue, int adr, int value)
          Set or unset write breakpoint.
 void writeMemory(int address, int word)
          Write a word into the memory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BP_IDLE

public static final int BP_IDLE
See Also:
Constant Field Values

BP_READALL

public static final int BP_READALL
See Also:
Constant Field Values

BP_READVAL

public static final int BP_READVAL
See Also:
Constant Field Values

BP_WRITEALL

public static final int BP_WRITEALL
See Also:
Constant Field Values

BP_WRITEVAL

public static final int BP_WRITEVAL
See Also:
Constant Field Values

mem

protected BaseMemory mem

readBP

protected BaseMemory readBP

writeBP

protected BaseMemory writeBP

readVal

protected BaseMemory readVal

writeVal

protected BaseMemory writeVal

bpHandler

protected BreakPointHandler bpHandler

bpHandlerInstalled

protected boolean bpHandlerInstalled

debug

protected boolean debug
Constructor Detail

BreakPointMemory

public BreakPointMemory(int newSize,
                        int newBits)
Method Detail

setReadBP

public void setReadBP(boolean isBreakPoint,
                      boolean hasValue,
                      int adr,
                      int value)
Set or unset read breakpoint. if (hasValue) readVal[adr] = value; That means, if hasValue is true, a breakpoint will only be raised when the memory contains the value


setWriteBP

public void setWriteBP(boolean isBreakPoint,
                       boolean hasValue,
                       int adr,
                       int value)
Set or unset write breakpoint. if (hasValue) writeVal[adr] = value; That means, if hasValue is true, a breakpoint will only be raised when value has been written to memory


getMemory

public Memory getMemory()
For access without breakpoints


getReadBPMemory

public Memory getReadBPMemory()
For access to read breakpoint memory


getReadValMemory

public Memory getReadValMemory()
For access to read breakpoint value memory


getWriteBPMemory

public Memory getWriteBPMemory()
For access to write breakpoint memory


getWriteValMemory

public Memory getWriteValMemory()
For access to write breakpoint value memory


installBreakPointHandler

public void installBreakPointHandler(BreakPointHandler newBreakPointHandler)
The BreakPointHandler will be called if a breakpoint occurs


getWordWidth

public int getWordWidth()
Witdh of one word in bits

Specified by:
getWordWidth in interface Memory

getMemorySize

public int getMemorySize()
Capacity of the memory in words

Specified by:
getMemorySize in interface Memory

readMemory

public int readMemory(int address)
Read a word from the memory

Specified by:
readMemory in interface Memory

writeMemory

public void writeMemory(int address,
                        int word)
Write a word into the memory

Specified by:
writeMemory in interface Memory

setEntry

public void setEntry(int entry,
                     int globalPointer)
Set the entry address if memory contains a executable program

Specified by:
setEntry in interface Memory

installEntryHandler

public void installEntryHandler(EntryHandler entryHandler)
setEntry() calles this EntryHandler

Specified by:
installEntryHandler in interface Memory

setLog

public void setLog(boolean newDebug)
Description copied from interface: Memory
Enable or disable logging output

Specified by:
setLog in interface Memory

getLog

public boolean getLog()
Description copied from interface: Memory
Get debug mode

Specified by:
getLog in interface Memory