mars.mips.hardware
Class Register

java.lang.Object
  |
  +--java.util.Observable
        |
        +--mars.mips.hardware.Register

public class Register
extends java.util.Observable

Abstraction to represent a register of a MIPS Assembler.


Constructor Summary
Register(java.lang.String n, int num, int val)
          Creates a new register with specified name, number, and value.
 
Method Summary
 java.lang.String getName()
          Returns the name of the Register.
 int getNumber()
          Returns the number of the Register.
 int getResetValue()
          Returns the reset value of the Register.
 int getValue()
          Returns the value of the Register.
 void resetValue()
          Resets the value of the register to the value it was constructed with.
 int setValue(int val)
          Sets the value of the register to the val passed to it.
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Register

public Register(java.lang.String n,
                int num,
                int val)
Creates a new register with specified name, number, and value.

Parameters:
n - The name of the register.
num - The number of the register.
val - The inital (and reset) value of the register.
Method Detail

getName

public java.lang.String getName()
Returns the name of the Register.

Returns:
name The name of the Register.

getValue

public int getValue()
Returns the value of the Register.

Returns:
value The value of the Register.

getResetValue

public int getResetValue()
Returns the reset value of the Register.

Returns:
The reset (initial) value of the Register.

getNumber

public int getNumber()
Returns the number of the Register.

Returns:
number The number of the Register.

setValue

public int setValue(int val)
Sets the value of the register to the val passed to it.

Parameters:
val - Value to set the Register to.
Returns:
previous value of register

resetValue

public void resetValue()
Resets the value of the register to the value it was constructed with.