Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## mars.mips.hardware
Class Coprocessor1

    java.lang.Object
      mars.mips.hardware.Coprocessor1

    public class Coprocessor1

extends Object

Represents Coprocessor 1, the Floating Point Unit (FPU)

Author:
  Pete Sanderson

Constructor Summary
`Coprocessor1()`

Method Summary
`static void` | `addRegistersObserver(Observer observer)` Each individual register is a separate object and Observable.
`static int` | `clearConditionFlag(int flag)` Set condition flag to 0 (false).
`static void` | `clearConditionFlags()` Clear all condition flags (0-7).
`static void` | `deleteRegistersObserver(Observer observer)` Each individual register is a separate object and Observable.
`static int` | `getConditionFlag(int flag)` Get value of specified condition flag (0-7).
`static int` | `getConditionFlagCount()` Get count of condition flags.
`static int` | `getConditionFlags()` Get array of condition flags (0-7).
`static double` | `getDoubleFromRegisterPair(int reg)` Gets the double value stored in the given FPU register.
`static double` | `getDoubleFromRegisterPair(String reg)` Gets the double value stored in the given FPU register.
`static float` | `getFloatFromRegister(int reg)` Gets the float value stored in the given FPU register.
`static float` | `getFloatFromRegister(String reg)` Gets the float value stored in the given FPU register.
`static int` | `getIntFromRegister(int reg)` Gets the 32-bit int bit pattern stored in the given FPU register.
`static int` | `getIntFromRegister(String reg)` Gets the 32-bit int bit pattern stored in the given FPU register.
`static long` | `getLongFromRegisterPair(int reg)` Gets a long representing the double value stored in the given double precision FPU register.
`static long` | `getLongFromRegisterPair(String reg)` Gets the double value stored in the given FPU register.
`static Register` | `getRegister(String rName)` Get register object corresponding to given name.
`static int` | `getRegisterNumber(String n)` For getting the number representation of the FPU register.
`static Register[]` | `getRegisters()` For returning the set of registers.
`static int` | `getValue(int num)` Returns the value of the FPU register who's number is num.
`static void` | `resetRegisters()` Method to reinitialize the values of the registers.
`static int` | `setConditionFlag(int flag)` Set condition flag to 1 (true).
`static void` | `setConditionFlags()` Set all condition flags (0-7).
`static void` | `setRegisterPairToDouble(int reg, double val)` Sets the value of the FPU register given to the double value given.
`static void` | `setRegisterPairToDouble(String reg, double val)` Sets the value of the FPU register given to the double value given.
`static void` | `setRegisterPairToLong(int reg, long val)` Sets the value of the FPU register pair given to the long value containing 64 bit pattern given.
`static void` | `setRegisterPairToLong(String reg, long val)` Sets the value of the FPU register pair given to the long value containing 64 bit pattern given.
`static void` | `setRegisterToFloat(int reg, float val)` Sets the value of the FPU register given to the value given.
`static void` | `setRegisterToFloat(String reg, float val)` Sets the value of the FPU register given to the value given.
`static void` | `setRegisterToInt(int reg, int val)` Sets the value of the FPU register given to the 32-bit pattern given by the int parameter.
`static void` | `setRegisterToInt(String reg, int val)` Sets the value of the FPU register given to the 32-bit pattern given by the int parameter.
`static void` | `showRegisters()` Method for displaying the register values for debugging.
`static int` | `updateRegister(int num, int val)` This method updates the FPU register value who's number is num.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Coprocessor1

    public Coprocessor1()

Method Detail

### showRegisters

    public static void showRegisters()

  Method for displaying the register values for debugging.

### setRegisterToFloat

    public static void setRegisterToFloat(String reg,
                                          float val)

  Sets the value of the FPU register given to the value given.

  Parameters:
    `reg` - Register to set the value of.
    `val` - The desired float value for the register.

### setRegisterToFloat

    public static void setRegisterToFloat(int reg,
                                          float val)

  Sets the value of the FPU register given to the value given.

  Parameters:
    `reg` - Register to set the value of.
    `val` - The desired float value for the register.

### setRegisterToInt

    public static void setRegisterToInt(String reg,
                                        int val)

  Sets the value of the FPU register given to the 32-bit pattern given by the int parameter.

  Parameters:
    `reg` - Register to set the value of.
    `val` - The desired int bit pattern for the register.

### setRegisterToInt

    public static void setRegisterToInt(int reg,
                                        int val)

  Sets the value of the FPU register given to the 32-bit pattern given by the int parameter.

  Parameters:
    `reg` - Register to set the value of.
    `val` - The desired int bit pattern for the register.

### setRegisterPairToDouble

    public static void setRegisterPairToDouble(int reg,
                                               double val)
                                        throws InvalidRegisterAccessException

  Sets the value of the FPU register given to the double value given. The register must be even-numbered, and the low order 32 bits are placed in it. The high order 32 bits are placed in the (odd numbered) register that follows it.

  Parameters:
    `reg` - Register to set the value of.
    `val` - The desired double value for the register.
  Throws:
    `InvalidRegisterAccessException` - if register ID is invalid or odd-numbered.

### setRegisterPairToDouble

    public static void setRegisterPairToDouble(String reg,
                                               double val)
                                        throws InvalidRegisterAccessException

  Sets the value of the FPU register given to the double value given. The register must be even-numbered, and the low order 32 bits are placed in it. The high order 32 bits are placed in the (odd numbered) register that follows it.

  Parameters:
    `reg` - Register to set the value of.
    `val` - The desired double value for the register.
  Throws:
    `InvalidRegisterAccessException` - if register ID is invalid or odd-numbered.

### setRegisterPairToLong

    public static void setRegisterPairToLong(int reg,
                                             long val)
                                      throws InvalidRegisterAccessException

  Sets the value of the FPU register pair given to the long value containing 64 bit pattern given. The register must be even-numbered, and the low order 32 bits from the long are placed in it. The high order 32 bits from the long are placed in the (odd numbered) register that follows it.

  Parameters:
    `reg` - Register to set the value of. Must be even register of even/odd pair.
    `val` - The desired double value for the register.
  Throws:
    `InvalidRegisterAccessException` - if register ID is invalid or odd-numbered.

### setRegisterPairToLong

    public static void setRegisterPairToLong(String reg,
                                             long val)
                                      throws InvalidRegisterAccessException

  Sets the value of the FPU register pair given to the long value containing 64 bit pattern given. The register must be even-numbered, and the low order 32 bits from the long are placed in it. The high order 32 bits from the long are placed in the (odd numbered) register that follows it.

  Parameters:
    `reg` - Register to set the value of. Must be even register of even/odd pair.
    `val` - The desired long value containing the 64 bits for the register pair.
  Throws:
    `InvalidRegisterAccessException` - if register ID is invalid or odd-numbered.

### getFloatFromRegister

    public static float getFloatFromRegister(int reg)

  Gets the float value stored in the given FPU register.

  Parameters:
    `reg` - Register to get the value of.
  Returns:
    The float value stored by that register.

### getFloatFromRegister

    public static float getFloatFromRegister(String reg)

  Gets the float value stored in the given FPU register.

  Parameters:
    `reg` - Register to get the value of.
  Returns:
    The float value stored by that register.

### getIntFromRegister

    public static int getIntFromRegister(int reg)

  Gets the 32-bit int bit pattern stored in the given FPU register.

  Parameters:
    `reg` - Register to get the value of.
  Returns:
    The int bit pattern stored by that register.

### getIntFromRegister

    public static int getIntFromRegister(String reg)

  Gets the 32-bit int bit pattern stored in the given FPU register.

  Parameters:
    `reg` - Register to get the value of.
  Returns:
    The int bit pattern stored by that register.

### getDoubleFromRegisterPair

    public static double getDoubleFromRegisterPair(int reg)
                                            throws InvalidRegisterAccessException

  Gets the double value stored in the given FPU register. The register must be even-numbered.

  Parameters:
    `reg` - Register to get the value of. Must be even number of even/odd pair.
  Throws:
    `InvalidRegisterAccessException` - if register ID is invalid or odd-numbered.

### getDoubleFromRegisterPair

    public static double getDoubleFromRegisterPair(String reg)
                                            throws InvalidRegisterAccessException

  Gets the double value stored in the given FPU register. The register must be even-numbered.

  Parameters:
    `reg` - Register to get the value of. Must be even number of even/odd pair.
  Throws:
    `InvalidRegisterAccessException` - if register ID is invalid or odd-numbered.

### getLongFromRegisterPair

    public static long getLongFromRegisterPair(int reg)
                                        throws InvalidRegisterAccessException

  Gets a long representing the double value stored in the given double precision FPU register. The register must be even-numbered.

  Parameters:
    `reg` - Register to get the value of. Must be even number of even/odd pair.
  Throws:
    `InvalidRegisterAccessException` - if register ID is invalid or odd-numbered.

### getLongFromRegisterPair

    public static long getLongFromRegisterPair(String reg)
                                        throws InvalidRegisterAccessException

  Gets the double value stored in the given FPU register. The register must be even-numbered.

  Parameters:
    `reg` - Register to get the value of. Must be even number of even/odd pair.
  Throws:
    `InvalidRegisterAccessException` - if register ID is invalid or odd-numbered.

### updateRegister

    public static int updateRegister(int num,
                                     int val)

  This method updates the FPU register value who's number is num. Note the registers themselves hold an int value. There are helper methods available to which you can give a float or double to store.

  Parameters:
    `num` - FPU register to set the value of.
    `val` - The desired int value for the register.

### getValue

    public static int getValue(int num)

  Returns the value of the FPU register who's number is num. Returns the raw int value actually stored there. If you need a float, use Float.intBitsToFloat() to get the equivent float.

  Parameters:
    `num` - The FPU register number.
  Returns:
    The int value of the given register.

### getRegisterNumber

    public static int getRegisterNumber(String n)

  For getting the number representation of the FPU register.

  Parameters:
    `n` - The string formatted register name to look for.
  Returns:
    The number of the register represented by the string.

### getRegisters

    public static Register[] getRegisters()

  For returning the set of registers.

  Returns:
    The set of registers.

### getRegister

    public static Register getRegister(String rName)

  Get register object corresponding to given name. If no match, return null.

  Parameters:
    `rName` - The FPU register name, must be "$f0" through "$f31".
  Returns:
    The register object,or null if not found.

### resetRegisters

    public static void resetRegisters()

  Method to reinitialize the values of the registers.

### addRegistersObserver

    public static void addRegistersObserver(Observer observer)

  Each individual register is a separate object and Observable. This handy method will add the given Observer to each one.

### deleteRegistersObserver

    public static void deleteRegistersObserver(Observer observer)

  Each individual register is a separate object and Observable. This handy method will delete the given Observer from each one.

### setConditionFlag

    public static int setConditionFlag(int flag)

  Set condition flag to 1 (true).

  Parameters:
    `flag` - condition flag number (0-7)
  Returns:
    previous flag setting (0 or 1)

### clearConditionFlag

    public static int clearConditionFlag(int flag)

  Set condition flag to 0 (false).

  Parameters:
    `flag` - condition flag number (0-7)
  Returns:
    previous flag setting (0 or 1)

### getConditionFlag

    public static int getConditionFlag(int flag)

  Get value of specified condition flag (0-7).

  Parameters:
    `flag` - condition flag number (0-7)
  Returns:
    0 if condition is false, 1 if condition is true

### getConditionFlags

    public static int getConditionFlags()

  Get array of condition flags (0-7).

  Returns:
    array of int condition flags

### clearConditionFlags

    public static void clearConditionFlags()

  Clear all condition flags (0-7).

### setConditionFlags

    public static void setConditionFlags()

  Set all condition flags (0-7).

### getConditionFlagCount

    public static int getConditionFlagCount()

  Get count of condition flags.

  Returns:
    number of condition flags

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD