com.cmpware.cmp.memory
Class BigEndianMemory

java.lang.Object
  extended by com.cmpware.cmp.memory.LittleEndianMemory
      extended by com.cmpware.cmp.memory.BigEndianMemory
All Implemented Interfaces:
MemoryInterface, ReadWriteInterface

public class BigEndianMemory
extends LittleEndianMemory
implements MemoryInterface

This class implements the Big Endian memory module.

Copyright (c) 2004, 2005 Cmpware, Inc. All Rights Reserved.

Author:
SAG

Field Summary
 
Fields inherited from class com.cmpware.cmp.memory.LittleEndianMemory
baseAddr, copyright, DEFAULT_MEMORY_SIZE, maxProfile, memory, profile, PROFILE_GRANULARITY
 
Constructor Summary
BigEndianMemory()
          Constructor
BigEndianMemory(byte[] b)
          Constructor
BigEndianMemory(int size)
          Constructor
 
Method Summary
 boolean getEndian()
          This method returns the endian (byte order) of the memory.
 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 write16(int addr, short a)
          This method writes the 16-bit value 'a' to the requested memory address.
 void write24(int addr, int a)
          This method writes a 24-bit value 'a' to the requested memory address.
 void write32(int addr, int a)
          This method writes the 32-bit value 'a' to the requested memory address.
 void write64(int addr, long a)
          This method writes the 64-bit value 'a' to the requested memory address.
 
Methods inherited from class com.cmpware.cmp.memory.LittleEndianMemory
clearProfile, get, getBaseAddress, getMaxProfile, getOffset, getProfile, getProfile, getProfileGranularity, isReadable, isValidAddress, isWriteable, profile, read, resize, setBaseAddress, setEndian, size, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.cmpware.cmp.memory.MemoryInterface
clearProfile, get, getBaseAddress, getMaxProfile, getProfile, getProfile, getProfileGranularity, isValidAddress, profile, resize, setBaseAddress, setEndian, size
 
Methods inherited from interface com.cmpware.cmp.memory.ReadWriteInterface
isReadable, isWriteable, read, write
 

Constructor Detail

BigEndianMemory

public BigEndianMemory()
Constructor


BigEndianMemory

public BigEndianMemory(int size)
Constructor

Parameters:
size - The size of the memory in bytes

BigEndianMemory

public BigEndianMemory(byte[] b)
Constructor

Parameters:
b - The byte array used as the memory store.
Method Detail

getEndian

public boolean getEndian()
Description copied from interface: MemoryInterface
This method returns the endian (byte order) of the memory.

Specified by:
getEndian in interface MemoryInterface
Overrides:
getEndian in class LittleEndianMemory
Returns:
This method returns the endian (byte order) of the memory.

read16

public short read16(int addr)
             throws MemoryAccessException
Description copied from interface: ReadWriteInterface
This method returns a 16-bit short from the memory at address 'addr'.

Specified by:
read16 in interface ReadWriteInterface
Overrides:
read16 in class LittleEndianMemory
Parameters:
addr - The memory address.
Returns:
The requested data is returned from the memory.
Throws:
MemoryAccessException - if an illegal memory address is encountered.

read24

public int read24(int addr)
           throws MemoryAccessException
Description copied from interface: ReadWriteInterface
This method returns a 24-bit unsigned integer from the memory at address 'addr'. The value is returned as a 32-bit int, with the upper 8 bits always zero.

Specified by:
read24 in interface ReadWriteInterface
Overrides:
read24 in class LittleEndianMemory
Parameters:
addr - The memory address.
Returns:
The requested data is returned from the memory.
Throws:
MemoryAccessException - if an illegal memory address is encountered.

read32

public int read32(int addr)
           throws MemoryAccessException
Description copied from interface: ReadWriteInterface
This method returns a 32-bit int from the memory at address 'addr'. Note that this method also attempts a Memory Mapped IO if an illegal memory address is encountered.

Specified by:
read32 in interface ReadWriteInterface
Overrides:
read32 in class LittleEndianMemory
Parameters:
addr - The memory address.
Throws:
MemoryAccessException - if an illegal memory address is encountered.

read64

public long read64(int addr)
            throws MemoryAccessException
Description copied from interface: ReadWriteInterface
This method returns a 64-bit long from the memory at address 'addr'.

Specified by:
read64 in interface ReadWriteInterface
Overrides:
read64 in class LittleEndianMemory
Parameters:
addr - The memory address.
Throws:
MemoryAccessException - if an illegal memory address is encountered.

write16

public void write16(int addr,
                    short a)
             throws MemoryAccessException
Description copied from interface: ReadWriteInterface
This method writes the 16-bit value 'a' to the requested memory address.

Specified by:
write16 in interface ReadWriteInterface
Overrides:
write16 in class LittleEndianMemory
Parameters:
addr - The memory address.
a - The value to be written.
Throws:
MemoryAccessException - if an illegal memory address is encountered.

write24

public void write24(int addr,
                    int a)
             throws MemoryAccessException
Description copied from interface: ReadWriteInterface
This method writes a 24-bit value 'a' to the requested memory address. The upper 8 bits of the value of 'a' are always ignored.

Specified by:
write24 in interface ReadWriteInterface
Overrides:
write24 in class LittleEndianMemory
Parameters:
addr - The memory address.
a - The value to be written.
Throws:
MemoryAccessException - if an illegal memory address is encountered.

write32

public void write32(int addr,
                    int a)
             throws MemoryAccessException
Description copied from interface: ReadWriteInterface
This method writes the 32-bit value 'a' to the requested memory address.

Specified by:
write32 in interface ReadWriteInterface
Overrides:
write32 in class LittleEndianMemory
Parameters:
addr - The memory address.
a - The value to be written.
Throws:
MemoryAccessException - if an illegal memory address is encountered.

write64

public void write64(int addr,
                    long a)
             throws MemoryAccessException
Description copied from interface: ReadWriteInterface
This method writes the 64-bit value 'a' to the requested memory address.

Specified by:
write64 in interface ReadWriteInterface
Overrides:
write64 in class LittleEndianMemory
Parameters:
addr - The memory address.
a - The value to be written.
Throws:
MemoryAccessException - if an illegal memory address is encountered.