sim
Class MemoryMap

java.lang.Object
  |
  +--sim.MemoryMap
All Implemented Interfaces:
Memory

public class MemoryMap
extends java.lang.Object
implements Memory

Implements a mapped memory.


Constructor Summary
MemoryMap(Mips machine)
           
 
Method Summary
 void attach(Memory mem, int location)
          Attach memory of size, at location
 void doCycle()
          Give each block a cycle
 int getLastWriteAddr()
           
 int getLastWriteVal()
           
 int getSize()
           
 void initialize()
          Initialize each block
 boolean isMapped(int address)
          Answer if this address is mapped.
 byte readByte(int address)
          Read a byte at the given address.
 int readWord(int address)
          Read a word at the given address.
 java.lang.String toString()
           
 void writeByte(int address, byte value)
          Write a byte at the given address.
 void writeWord(int address, int value)
          Write a word at the given address.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MemoryMap

public MemoryMap(Mips machine)
Method Detail

getLastWriteAddr

public int getLastWriteAddr()

getLastWriteVal

public int getLastWriteVal()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

attach

public void attach(Memory mem,
                   int location)
Attach memory of size, at location


isMapped

public boolean isMapped(int address)
Answer if this address is mapped.


doCycle

public void doCycle()
Give each block a cycle

Specified by:
doCycle in interface Memory

initialize

public void initialize()
Initialize each block

Specified by:
initialize in interface Memory

getSize

public int getSize()
Specified by:
getSize in interface Memory

readWord

public int readWord(int address)
Read a word at the given address. If there is no memory mapped at that address, an exception in the simulator is raised.

Specified by:
readWord in interface Memory

readByte

public byte readByte(int address)
Read a byte at the given address. If there is no memory mapped at that address, an exception in the simulator is raised.

Specified by:
readByte in interface Memory

writeWord

public void writeWord(int address,
                      int value)
Write a word at the given address. If there is no memory mapped at that address, an exception in the simulator is raised.

Specified by:
writeWord in interface Memory

writeByte

public void writeByte(int address,
                      byte value)
Write a byte at the given address. If there is no memory mapped at that address, an exception in the simulator is raised.

Specified by:
writeByte in interface Memory