|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.cmpware.cmp.Memory
public class Memory
This class implements the Processor's interface to memory. This class originally supplied the interface to a single main memory located at address 0. It is now responsible for managing the entire memory map. Currently this includes: local memories, memory mapped IO and shared memory. This should all be transparent; an address should be used to request a value, and a valid calue should be returned for a valid address. If the address is not valid, a Memory Access Exception should be thrown. In short, this class should make memory accesses behave in much the same way as they would in actual hardware.
Copyright (c) 2004, 2005 Cmpware, Inc. All Rights Reserved.
| Field Summary | |
|---|---|
static boolean |
BIG
Big Endian |
static java.lang.String |
copyright
Copyright string |
static boolean |
LITTLE
Little Endian (default) |
| Constructor Summary | |
|---|---|
Memory()
Constructor |
|
Memory(int size)
Constructor |
|
| Method Summary | |
|---|---|
void |
addInput(int addr,
MemoryMappedIOReader mmior)
Deprecated. use mmio.addInput() |
void |
addMemory(MemoryInterface m)
This method adds a Memory to the memory manager. |
void |
addOutput(int addr,
MemoryMappedIOWriter mmiow)
Deprecated. use mmio.addOutput() |
boolean |
getEndian()
Deprecated. Use getLocalMemory().getEndian() |
LocalMemory |
getLocalMemory()
This method returns the local memory. |
MemoryManager |
getMemoryManager()
This method returns the memory manager. |
MemoryMappedIO |
getMmio()
This method returns the Memory Mapped IO manager. |
int |
getProfile(int addr)
This method returns the profile for a given a memory address. |
java.lang.String |
hexDump(int addr)
This method returns a single text line of a hex dump starting at the specified address. |
java.lang.String |
hexDump(int addr,
int lines)
This method returns multiple text lines of a hex dump starting at the specified address. |
boolean |
isReadable(int addr)
This method returns true if the current address is readable and false otherwise. |
boolean |
isValidAddress(int addr)
This method returns true if the address is valid and false otherwise. |
boolean |
isWriteable(int addr)
This method returns true if the current address is writeable and false otherwise. |
void |
profile(int addr)
This method profiles a memory address. |
byte |
read(int addr)
This method returns a byte from the memory at address 'addr'. |
byte[] |
read(int addr,
int size)
This method returns 'size' bytes from the memory at address 'addr'. |
short |
read16(int addr)
This method returns a 16-bit short from the memory at address 'addr'. |
int |
read24(int addr)
This method returns a 24-bit unsigned integer from the memory at address 'addr'. |
int |
read32(int addr)
This method returns a 32-bit int from the memory at address 'addr'. |
long |
read64(int addr)
This method returns a 64-bit long from the memory at address 'addr'. |
void |
removeMemory(MemoryInterface m)
This method removes a bank of memory from the memory manager. |
void |
resize(int size)
Deprecated. use getLocalMemory().resize(int) |
void |
setEndian(boolean e)
Deprecated. Use getLocalMemory().setEndian(boolean) |
int |
size()
Deprecated. use getLocalMemory().size() |
int |
toInt(byte[] b)
This method converts a byte array to an integer. |
short |
toShort(byte[] b)
This method converts a byte array to a short. |
void |
write(int addr,
byte data)
This method copies a byte from 'a' into the memory at address 'addr'. |
void |
write(int addr,
byte[] buffer)
This method copies a buffer of bytes from 'buffer' into the memory at address 'addr'. |
void |
write16(int addr,
short data)
This method writes the 16-bit value 'a' to the requested memory address. |
void |
write24(int addr,
int data)
This method writes a 24-bit value 'a' to the requested memory address. |
void |
write32(int addr,
int data)
This method writes the 32-bit value 'a' to the requested memory address. |
void |
write64(int addr,
long data)
This method writes the 64-bit value 'a' to the requested memory address. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String copyright
public static final boolean BIG
public static final boolean LITTLE
| Constructor Detail |
|---|
public Memory()
public Memory(int size)
size - The size of the memory in bytes| Method Detail |
|---|
public LocalMemory getLocalMemory()
public MemoryMappedIO getMmio()
public MemoryManager getMemoryManager()
public void setEndian(boolean e)
e - The endian value. Should be "BIG" or "LITTLE".public boolean getEndian()
public void resize(int size)
size - The size of the new memory in bytes.public int size()
public boolean isValidAddress(int addr)
addr - The address.
public void profile(int addr)
addr - The address.public int getProfile(int addr)
addr - The address.
public byte[] read(int addr,
int size)
throws MemoryAccessException
addr - The memory address.size - The number of bytes to be read
from memory.
MemoryAccessException - if an illegal memory address
is encountered.public boolean isReadable(int addr)
ReadWriteInterface
isReadable in interface ReadWriteInterfaceaddr - the address
public boolean isWriteable(int addr)
ReadWriteInterface
isWriteable in interface ReadWriteInterfaceaddr - the address
public byte read(int addr)
throws MemoryAccessException
ReadWriteInterface
read in interface ReadWriteInterfaceaddr - The memory address.
MemoryAccessException - if an illegal memory address
is encountered.
public short read16(int addr)
throws MemoryAccessException
ReadWriteInterface
read16 in interface ReadWriteInterfaceaddr - The memory address.
MemoryAccessException - if an illegal memory address
is encountered.
public int read24(int addr)
throws MemoryAccessException
ReadWriteInterface
read24 in interface ReadWriteInterfaceaddr - The memory address.
MemoryAccessException - if an illegal memory address
is encountered.
public int read32(int addr)
throws MemoryAccessException
ReadWriteInterface
read32 in interface ReadWriteInterfaceaddr - The memory address.
MemoryAccessException - if an illegal memory address
is encountered.
public long read64(int addr)
throws MemoryAccessException
ReadWriteInterface
read64 in interface ReadWriteInterfaceaddr - The memory address.
MemoryAccessException - if an illegal memory address
is encountered.
public void write(int addr,
byte[] buffer)
throws MemoryAccessException
addr - The memory address.buffer - The data to be written to the memory.
MemoryAccessException - if an illegal memory address
is encountered.
public void write(int addr,
byte data)
throws MemoryAccessException
ReadWriteInterface
write in interface ReadWriteInterfaceaddr - The memory address.data - The data to be written to the memory.
MemoryAccessException - if an illegal memory address
is encountered.
public void write16(int addr,
short data)
throws MemoryAccessException
ReadWriteInterface
write16 in interface ReadWriteInterfaceaddr - The memory address.data - The value to be written.
MemoryAccessException - if an illegal memory address
is encountered.
public void write24(int addr,
int data)
throws MemoryAccessException
ReadWriteInterface
write24 in interface ReadWriteInterfaceaddr - The memory address.data - The value to be written.
MemoryAccessException - if an illegal memory address
is encountered.
public void write32(int addr,
int data)
throws MemoryAccessException
ReadWriteInterface
write32 in interface ReadWriteInterfaceaddr - The memory address.data - The value to be written.
MemoryAccessException - if an illegal memory address
is encountered.
public void write64(int addr,
long data)
throws MemoryAccessException
ReadWriteInterface
write64 in interface ReadWriteInterfaceaddr - The memory address.data - The value to be written.
MemoryAccessException - if an illegal memory address
is encountered.public java.lang.String hexDump(int addr)
addr - The address of the memory to be dumped. Will
be aligned to a 16 byte boundary.
public java.lang.String hexDump(int addr,
int lines)
addr - The address of the memory to be dumped. Will
be aligned to a 16 byte boundary.lines - The number of lines of hex dump to return.
public int toInt(byte[] b)
b - The byte array.
public short toShort(byte[] b)
b - The byte array.
public void addInput(int addr,
MemoryMappedIOReader mmior)
addr - the address of the Memory Mapped IO Input port.mmior - The Memory Mapped IO reader.
public void addOutput(int addr,
MemoryMappedIOWriter mmiow)
addr - the address of the Memory Mapped IO Output port.mmiow - The Memroy Mapped IO writer.public void addMemory(MemoryInterface m)
m - The memory being added.public void removeMemory(MemoryInterface m)
m - The memory being removed.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||