com.github.croesch.micro_debug.mic1.register
Enum Register

java.lang.Object
  extended by java.lang.Enum<Register>
      extended by com.github.croesch.micro_debug.mic1.register.Register
All Implemented Interfaces:
Serializable, Comparable<Register>

public enum Register
extends Enum<Register>

This enumeration contains the registers of the processor. The registers are described in the script of Karl Stroetmann.

Since:
Date: Nov 19, 2011
Author:
croesch

Enum Constant Summary
CPP
          The Constant Pool Pointer - it points to the begin of the constant pool
H
          this register is a additional register to help storing values.
LV
          The Local Variable pointer - it points to the first variable of a method or if parameters are given, to the first parameter
MAR
          the Memory Address Register - if something is read/written from/to the memory this register defines the address in the memory where to read/write from/to
MBR
          the Memory Byte Register - it is the register that is connected to the program-memory.
MBRU
          this register is not a real register an exists only for simulation purpose.
It will be filled with the 8-bit-value of the MBR and the highest 24 bits are filled with zeros.
MDR
          the Memory Data Register - it is the register that is connected to the memory.
OPC
          the Old Program Counter - it is a additional register and has no certain function.
PC
          the Program Counter - if something is read from the program-memory this register defines the address in the program-memory where to read from.
SP
          The Stack Pointer
TOS
          The Top Of Stack - it contains the word that is the top of stack
 
Method Summary
 int getValue()
          Gets the value currently stored in the register.
 void setValue(int val)
          Sets the value for that register.
static Register valueOf(String name)
          Returns the enum constant of this type with the specified name.
static Register[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

MAR

public static final Register MAR
the Memory Address Register - if something is read/written from/to the memory this register defines the address in the memory where to read/write from/to


MDR

public static final Register MDR
the Memory Data Register - it is the register that is connected to the memory. If data is read from memory it'll be written into MDR. If data is written to the memory, MDR contains the data that'll be written.


PC

public static final Register PC
the Program Counter - if something is read from the program-memory this register defines the address in the program-memory where to read from.


MBR

public static final Register MBR
the Memory Byte Register - it is the register that is connected to the program-memory. If data is read from program-memory it'll be written into MBR. For security reasons one cannot change contents of the program-memory.
Since a single instruction is only 8-bit wide, this register is in the script of Karl Stroetmann only a 8-bit-register. For simulation we assume that we have a 32-bit-register. So this register contains the sign-extended 8-bit-value, written to the register MBR.
This register fills the content of MBRU. In the script of Karl Stroetmann are these two registers only one, but for simulation purpose we are using both registers to build the functionality of the MBR register.


MBRU

public static final Register MBRU
this register is not a real register an exists only for simulation purpose.
It will be filled with the 8-bit-value of the MBR and the highest 24 bits are filled with zeros.


SP

public static final Register SP
The Stack Pointer


LV

public static final Register LV
The Local Variable pointer - it points to the first variable of a method or if parameters are given, to the first parameter


CPP

public static final Register CPP
The Constant Pool Pointer - it points to the begin of the constant pool


TOS

public static final Register TOS
The Top Of Stack - it contains the word that is the top of stack


OPC

public static final Register OPC
the Old Program Counter - it is a additional register and has no certain function. But it can be used to store the value of PC in goto-functions.


H

public static final Register H
this register is a additional register to help storing values.

Method Detail

values

public static Register[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (Register c : Register.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static Register valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

setValue

public void setValue(int val)
Sets the value for that register.

Parameters:
val - the new value for the register
Since:
Date: Nov 19, 2011

getValue

public final int getValue()
Gets the value currently stored in the register.

Returns:
the value of the register.
Since:
Date: Nov 19, 2011


Copyright © 2012. All Rights Reserved.