jfrace
Class Register

java.lang.Object
  |
  +--jfrace.Register

public class Register
extends java.lang.Object

This is a helper class which holds information about a register of the CPU. These informations are

The register type can be any combination of the 6 basic types PROGRAM_COUNTER, DATA_REGISTER, ADDRESS_REGISTER, STACK_POINTER, ACCUMULATOR, and STATUS_REGISTER. Note that the number of bits has to be less than or equal 32.

Author:
Franz-Josef Elmer

Field Summary
static int ACCUMULATOR
          Register type mask.
static int ADDRESS_REGISTER
          Register type mask.
static int DATA_REGISTER
          Register type mask.
static int PROGRAM_COUNTER
          Register type mask.
static int STACK_POINTER
          Register type mask.
static int STATUS_REGISTER
          Register type mask.
 
Constructor Summary
Register(int numberOfBits, int type, java.lang.String name, int value)
          Create a new instance.
 
Method Summary
 java.lang.String getName()
          Return the name of the register.
 int getNumberOfBits()
          Return the number of bits.
 int getType()
          Return the type of the register.
 int getValue()
          Return the value of the register.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROGRAM_COUNTER

public static final int PROGRAM_COUNTER
Register type mask.

DATA_REGISTER

public static final int DATA_REGISTER
Register type mask.

ADDRESS_REGISTER

public static final int ADDRESS_REGISTER
Register type mask.

STACK_POINTER

public static final int STACK_POINTER
Register type mask.

ACCUMULATOR

public static final int ACCUMULATOR
Register type mask.

STATUS_REGISTER

public static final int STATUS_REGISTER
Register type mask.
Constructor Detail

Register

public Register(int numberOfBits,
                int type,
                java.lang.String name,
                int value)
Create a new instance.
Parameters:
numberOfBits - the number of bits.
type - the type of the register (e.g. PROGRAM_COUNTER).
name - the name of the register.
value - the value of the bits of the register. Only lowest numberOfBits are meaningful.
Method Detail

getNumberOfBits

public int getNumberOfBits()
Return the number of bits.

getType

public int getType()
Return the type of the register.

getName

public java.lang.String getName()
Return the name of the register. Return an empty string if the corresponding argument in the constructor was null.

getValue

public int getValue()
Return the value of the register.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object