hades.models.mips.mipsmemory
Class AccessMemory

java.lang.Object
  extended byhades.models.mips.mipsmemory.AccessMemory
All Implemented Interfaces:
Memory, Resetable
Direct Known Subclasses:
FastAccessMemory

public class AccessMemory
extends java.lang.Object
implements Resetable, Memory

Handle memory and cache accesses with one class which dispatches the different requests to the different MipsMemories Tasks performed by this class: - static address translation - call of dynamic address translation - decision wether and which caches should be used - modify partial word accesses to word accesses - provide Memory interface to give access to the full virtual address space


Field Summary
protected  boolean bigEndian
           
protected  int[] byteReadMask
           
protected  int[] byteWriteMask
           
protected  int data
           
 Cache dataCache
           
protected  int dataMask
           
protected  int dataShift
           
 MipsMemory dcache
           
static int DCACHE_SIZE
           
protected  MipsMemory[] dcacheSelection
           
protected  boolean debug
           
 MemoryDispatcher dispatcher
           
protected  int[] halfwordReadMask
           
protected  int[] halfwordWriteMask
           
 MipsMemory icache
           
static int ICACHE_SIZE
           
protected  MipsMemory[] icacheSelection
           
protected  int instr
           
 Cache instrCache
           
 MipsMemory lastdcache
           
 MipsMemory lasticache
           
 MipsMemory mem
           
static int MEMORY_SIZE
           
protected  MemoryManagementUnit mmu
           
protected  PartHandler partHandler
           
protected  boolean partWordByte
           
protected  boolean partWordFirst
           
protected  boolean partWordTriple
           
protected  boolean partWordWrite
           
protected  int physicalDataAdr
           
protected  int physicalInstrAdr
           
 DataCache realDataCache
           
 InstrCache realInstrCache
           
 TinyBPMemory stack
           
static int STACK_SIZE
           
 TinyBPMemory tinyMemory
           
protected  boolean[] translateable
           
protected  int[] translation
           
protected  int[] triplebyteReadMask
           
protected  int[] triplebyteWriteMask
           
protected  int virtualDataAdr
           
protected  int virtualInstrAdr
           
 
Constructor Summary
AccessMemory(PartHandler newPartHandler)
           
 
Method Summary
 boolean beginCycle()
          Cycle
 void endCycle()
           
 int fetchInstr()
           
 boolean getBigEndian()
           
 boolean getLog()
          Get debug mode
 int getMemorySize()
          Capacity of the memory in words
 int getReadResult()
           
 int getWordWidth()
          Witdh of one word in bits
protected  void initCacheSelection(MipsMemory[] cacheSelection, MipsMemory cache, MipsMemory mem)
           
 void installEntryHandler(EntryHandler entryHandler)
          setEntry() calles this EntryHandler
 void invalidateCaches()
           
 void por()
          Power on reset or hardware reset
 void readInstr()
          Instruction fetch, always 32 bit
 int readMemory(int address)
          Read a word from the memory
 void readWord(int adr)
          Load data
 void reset()
          software reset
 void setBigEndian(boolean big)
          Set endianess
 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 swapCaches()
           
 int translateAddress(int adr)
           
protected  int translateAddress(int adr, int segment)
          Address translation
 int translateDataAdr(int adr)
           
 int translateInstrAdr(int adr)
           
 int translateWordAddress(int adr)
           
 void unswapCaches()
           
 void writeMemory(int address, int word)
          Write a word into the memory
 void writeWord(int adr, int value)
          Store data
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

partHandler

protected PartHandler partHandler

realInstrCache

public InstrCache realInstrCache

realDataCache

public DataCache realDataCache

instrCache

public Cache instrCache

dataCache

public Cache dataCache

tinyMemory

public TinyBPMemory tinyMemory

stack

public TinyBPMemory stack

dispatcher

public MemoryDispatcher dispatcher

mem

public MipsMemory mem

icache

public MipsMemory icache

dcache

public MipsMemory dcache

lasticache

public MipsMemory lasticache

lastdcache

public MipsMemory lastdcache

mmu

protected MemoryManagementUnit mmu

MEMORY_SIZE

public static final int MEMORY_SIZE
See Also:
Constant Field Values

ICACHE_SIZE

public static final int ICACHE_SIZE
See Also:
Constant Field Values

DCACHE_SIZE

public static final int DCACHE_SIZE
See Also:
Constant Field Values

STACK_SIZE

public static final int STACK_SIZE
See Also:
Constant Field Values

bigEndian

protected boolean bigEndian

virtualInstrAdr

protected int virtualInstrAdr

physicalInstrAdr

protected int physicalInstrAdr

virtualDataAdr

protected int virtualDataAdr

physicalDataAdr

protected int physicalDataAdr

instr

protected int instr

data

protected int data

translateable

protected boolean[] translateable

translation

protected int[] translation

icacheSelection

protected MipsMemory[] icacheSelection

dcacheSelection

protected MipsMemory[] dcacheSelection

halfwordWriteMask

protected int[] halfwordWriteMask

byteWriteMask

protected int[] byteWriteMask

triplebyteWriteMask

protected int[] triplebyteWriteMask

halfwordReadMask

protected int[] halfwordReadMask

byteReadMask

protected int[] byteReadMask

triplebyteReadMask

protected int[] triplebyteReadMask

partWordWrite

protected boolean partWordWrite

partWordFirst

protected boolean partWordFirst

partWordByte

protected boolean partWordByte

partWordTriple

protected boolean partWordTriple

dataMask

protected int dataMask

dataShift

protected int dataShift

debug

protected boolean debug
Constructor Detail

AccessMemory

public AccessMemory(PartHandler newPartHandler)
Method Detail

initCacheSelection

protected void initCacheSelection(MipsMemory[] cacheSelection,
                                  MipsMemory cache,
                                  MipsMemory mem)

por

public void por()
Power on reset or hardware reset

Specified by:
por in interface Resetable

reset

public void reset()
software reset

Specified by:
reset in interface Resetable

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

invalidateCaches

public void invalidateCaches()

swapCaches

public void swapCaches()

unswapCaches

public void unswapCaches()

setBigEndian

public void setBigEndian(boolean big)
Set endianess


getBigEndian

public boolean getBigEndian()

translateAddress

protected int translateAddress(int adr,
                               int segment)
Address translation


translateAddress

public int translateAddress(int adr)

translateWordAddress

public int translateWordAddress(int adr)

translateInstrAdr

public int translateInstrAdr(int adr)

translateDataAdr

public int translateDataAdr(int adr)

readInstr

public void readInstr()
Instruction fetch, always 32 bit


fetchInstr

public int fetchInstr()

readWord

public void readWord(int adr)
Load data


getReadResult

public int getReadResult()

writeWord

public void writeWord(int adr,
                      int value)
Store data


beginCycle

public boolean beginCycle()
Cycle


endCycle

public void endCycle()

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