|
Simple Machine | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmachine.AbstractMainMemory.Port
public class AbstractMainMemory.Port
Memory's port for reading and writing. This is the interface the memory presents to the CPU.
Constructor Summary | |
---|---|
AbstractMainMemory.Port(AbstractMainMemory.MMU mmu)
|
Method Summary | |
---|---|
UnsignedByte[] |
read(int address,
int length)
Read a sequence of bytes from memory using an aligned address. |
int |
readInteger(int address)
Read a 4-byte integer from memory using an aligned address. |
int |
readIntegerUnaligned(int address)
Read a 4-byte integer from memory using a possibly-unaligned address. |
UnsignedByte[] |
readUnaliged(int address,
int length)
Read a sequence of bytes from memory using a possibly-unaligned address. |
void |
write(int address,
UnsignedByte[] value)
Write a sequence of bytes to memory using an aligned address. |
void |
writeInteger(int address,
int value)
Write a 4-byte integer to memory using an aligned address. |
void |
writeIntegerUnaligned(int address,
int value)
Write a 4-byte integer to memory using a possibly-unaligned address. |
void |
writeUnaligned(int address,
UnsignedByte[] value)
Write a sequence of bytes to memory using a possibly-unaligned address. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractMainMemory.Port(AbstractMainMemory.MMU mmu)
Method Detail |
---|
public UnsignedByte[] read(int address, int length) throws AbstractMainMemory.InvalidAddressException
address
- address of first byte.length
- number of bytes.
InvalidMemoryException
- if any address in the range address to address+length-1 is out of range or if address % length != 0 (i.e., address is not aligned to length).
AbstractMainMemory.InvalidAddressException
public UnsignedByte[] readUnaliged(int address, int length) throws AbstractMainMemory.InvalidAddressException
address
- address of first byte.length
- number of bytes.
InvalidMemoryException
- if any address in the range address to address+length-1 is out of range.
AbstractMainMemory.InvalidAddressException
public int readInteger(int address) throws AbstractMainMemory.InvalidAddressException
address
- address of first byte.
InvalidMemoryException
- if any address in the range address to address+3 is out of range or if address % 4 != 0 (i.e., address is not aligned to length).
AbstractMainMemory.InvalidAddressException
public int readIntegerUnaligned(int address) throws AbstractMainMemory.InvalidAddressException
address
- address of first byte.
InvalidMemoryException
- if any address in the range address to address+3 is out of range.
AbstractMainMemory.InvalidAddressException
public void write(int address, UnsignedByte[] value) throws AbstractMainMemory.InvalidAddressException
address
- address of first byte.value
- array of bytes to write into memory.
InvalidMemoryException
- if any address in the range address to address+value.length-1 is out of range or if address % length != 0 (i.e., address is not aligned to length).
AbstractMainMemory.InvalidAddressException
public void writeUnaligned(int address, UnsignedByte[] value) throws AbstractMainMemory.InvalidAddressException
address
- address of first byte.value
- array of bytes to write into memory.
InvalidMemoryException
- if any address in the range address to address+value.length-1 is out of range.
AbstractMainMemory.InvalidAddressException
public void writeInteger(int address, int value) throws AbstractMainMemory.InvalidAddressException
address
- address of first byte.value
- integer to write into memory.
InvalidMemoryException
- if any address in the range address to address+3 is out of range or if address % 4 != 0 (i.e., address is not aligned to length).
AbstractMainMemory.InvalidAddressException
public void writeIntegerUnaligned(int address, int value) throws AbstractMainMemory.InvalidAddressException
address
- address of first byte.value
- integer to write into memory.
InvalidMemoryException
- if any address in the range address to address+3 is out of range.
AbstractMainMemory.InvalidAddressException
|
Simple Machine | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |