Class SCMainMem

java.lang.Object
  |
  +--SCMainMem

public class SCMainMem
extends java.lang.Object

SCmainMem simulates the main memory module of a SimpComp computer. User addressable space from 1000h to FFFFh.


Field Summary
static int ADDR_OFFSET
           
static int BASE_ADDR
           
static int MAX_ADDR
           
 
Constructor Summary
SCMainMem()
          Constructor, initializes the entire memory array to 0.
 
Method Summary
 short getByteAt(int addr)
          Retrieves a byte of data from a specified address location.
 short getByteAt(java.lang.String addr)
          Retrieves a byte of data from a specified address location.
 void putByteAt(int addr, short byteValue)
          Puts a byte of data at a specified address location.
 void putByteAt(java.lang.String addr, short byteValue)
          Puts a byte of data at a specified address location.
 void reset()
          Resets the memory, each address to 0;
 java.lang.String toString(int pc)
          Converts a range of memory values, from pc-4 to pc+4, into a concatenated string String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BASE_ADDR

public static final int BASE_ADDR
See Also:
Constant Field Values

MAX_ADDR

public static final int MAX_ADDR
See Also:
Constant Field Values

ADDR_OFFSET

public static final int ADDR_OFFSET
See Also:
Constant Field Values
Constructor Detail

SCMainMem

public SCMainMem()
Constructor, initializes the entire memory array to 0.

Method Detail

reset

public void reset()
Resets the memory, each address to 0;


putByteAt

public void putByteAt(java.lang.String addr,
                      short byteValue)
               throws java.lang.IllegalArgumentException
Puts a byte of data at a specified address location.

Parameters:
byteValue -
java.lang.IllegalArgumentException

putByteAt

public void putByteAt(int addr,
                      short byteValue)
               throws java.lang.IllegalArgumentException
Puts a byte of data at a specified address location.

Parameters:
byteValue -
java.lang.IllegalArgumentException

getByteAt

public short getByteAt(java.lang.String addr)
                throws java.lang.IllegalArgumentException
Retrieves a byte of data from a specified address location.

Returns:
byteValue
java.lang.IllegalArgumentException

getByteAt

public short getByteAt(int addr)
                throws java.lang.IllegalArgumentException
Retrieves a byte of data from a specified address location.

Returns:
byteValue
java.lang.IllegalArgumentException

toString

public java.lang.String toString(int pc)
Converts a range of memory values, from pc-4 to pc+4, into a concatenated string String. Values are separated by tab character, which are meant for possible tokenization.

Returns:
concatenated string