hades.models.mips.memory
Class BaseMemory

java.lang.Object
  extended byhades.models.mips.memory.BaseMemory
All Implemented Interfaces:
Memory
Direct Known Subclasses:
TinyMemory

public class BaseMemory
extends java.lang.Object
implements Memory

Straight forward implementation of the memory interface to be extended by classes that provide further functionality


Field Summary
protected  int adrMask
           
protected  int bitMask
           
protected  int bits
           
protected  boolean debug
           
protected  EntryHandler entryHandler
           
protected  boolean entryHandlerInstalled
           
protected  int[] mem
           
protected  int size
           
 
Constructor Summary
BaseMemory(int newSize, int newBits)
           
 
Method Summary
 boolean getLog()
          Get debug mode
 int getMemorySize()
          Capacity of the memory in words
 int getWordWidth()
          Witdh of one word in bits
 void installEntryHandler(EntryHandler newEntryHandler)
          Set the entry handler
 int readMemory(int address)
          Read a word from the memory
 void setEntry(int entry, int globalPointer)
          Call the entry handler in order to set the entry
 void setLog(boolean newDebug)
          Enable or disable logging output
 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

mem

protected int[] mem

size

protected int size

adrMask

protected int adrMask

bits

protected int bits

bitMask

protected int bitMask

entryHandler

protected EntryHandler entryHandler

entryHandlerInstalled

protected boolean entryHandlerInstalled

debug

protected boolean debug
Constructor Detail

BaseMemory

public BaseMemory(int newSize,
                  int newBits)
Method Detail

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)
Call the entry handler in order to set the entry

Specified by:
setEntry in interface Memory

installEntryHandler

public void installEntryHandler(EntryHandler newEntryHandler)
Set the entry handler

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