hicosim.components.backend.processor
Class Memory

java.lang.Object
  extended by hicosim.components.backend.processor.Memory
All Implemented Interfaces:
IMemory

public class Memory
extends java.lang.Object
implements IMemory

Class which represents the memory.

Author:
Michael Wager, Luca Calchera,Weber 16th May 2009

Constructor Summary
Memory(Engine engine)
          Constructor - set up TreeMap
 
Method Summary
 void delWatchPoint(int adr)
           
 int getAddressOfLabel(java.lang.String label)
          This method is used to get the address of a label.
 java.util.Set<java.lang.Integer> getAllUsedAddresses()
          This method returns all addresses of the memory.
 java.util.HashSet<java.lang.Integer> getAllWatchPoints()
           
 java.lang.String getDisassembledInstructionAt(int address)
           
 Disassembler getDisassembler()
          This method returns the disassembler reference.
 java.lang.String getLabelAt(int address)
          This method is used to get the label at the given address.
 Labels getLabels()
          This method returns the labels.
 IPluginManager getPluginManager()
           
 boolean isWatchPoint(int adr)
           
 java.lang.String loadObjectfile(java.lang.String PATH)
          This method reads in the objectfile and sets up all the relevant information, like memory, processor, progCounter, Labels
 int readValueAt(int address)
          This method is used to read the value at the given address in decimal.
 void resetMemory()
           
 void setWatchPoint(int adr)
           
 java.lang.String toString()
          String representation of the memory.
 void writeTo(int address, int value)
          This method is used to write the value at the given address.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Memory

public Memory(Engine engine)
Constructor - set up TreeMap

Parameters:
- - Engine reference
Method Detail

resetMemory

public void resetMemory()
Specified by:
resetMemory in interface IMemory

readValueAt

public int readValueAt(int address)
This method is used to read the value at the given address in decimal.

Specified by:
readValueAt in interface IMemory

getDisassembledInstructionAt

public java.lang.String getDisassembledInstructionAt(int address)
                                              throws java.lang.Exception
Throws:
java.lang.Exception

writeTo

public void writeTo(int address,
                    int value)
This method is used to write the value at the given address.

Specified by:
writeTo in interface IMemory

loadObjectfile

public java.lang.String loadObjectfile(java.lang.String PATH)
                                throws java.lang.Exception
This method reads in the objectfile and sets up all the relevant information, like memory, processor, progCounter, Labels

Specified by:
loadObjectfile in interface IMemory
Parameters:
PATH - - PATH to the objectFile
Returns:
- InfoString == "" if everything is OK.
Throws:
java.lang.Exception

getDisassembler

public Disassembler getDisassembler()
This method returns the disassembler reference.

Specified by:
getDisassembler in interface IMemory

getAllUsedAddresses

public java.util.Set<java.lang.Integer> getAllUsedAddresses()
This method returns all addresses of the memory.

Specified by:
getAllUsedAddresses in interface IMemory

toString

public java.lang.String toString()
String representation of the memory.

Specified by:
toString in interface IMemory
Overrides:
toString in class java.lang.Object

getLabels

public Labels getLabels()
This method returns the labels.

Specified by:
getLabels in interface IMemory

getLabelAt

public java.lang.String getLabelAt(int address)
This method is used to get the label at the given address.

Specified by:
getLabelAt in interface IMemory

getAddressOfLabel

public int getAddressOfLabel(java.lang.String label)
This method is used to get the address of a label.

Specified by:
getAddressOfLabel in interface IMemory

setWatchPoint

public void setWatchPoint(int adr)
Specified by:
setWatchPoint in interface IMemory

delWatchPoint

public void delWatchPoint(int adr)
Specified by:
delWatchPoint in interface IMemory

isWatchPoint

public boolean isWatchPoint(int adr)
Specified by:
isWatchPoint in interface IMemory

getAllWatchPoints

public java.util.HashSet<java.lang.Integer> getAllWatchPoints()
Specified by:
getAllWatchPoints in interface IMemory

getPluginManager

public IPluginManager getPluginManager()
Specified by:
getPluginManager in interface IMemory