Enum Class FlagsConstants

java.lang.Object
java.lang.Enum<FlagsConstants>
io.matita08.data.FlagsConstants
All Implemented Interfaces:
Serializable, Comparable<FlagsConstants>, Constable

public enum FlagsConstants extends Enum<FlagsConstants>
Enumeration of CPU flag constants used in the simulator's flag management system. This enum defines the available CPU flags that indicate the results of arithmetic and logical operations performed by the simulated processor.

Each flag constant represents a specific CPU condition and is implemented as a power-of-2 bitmask to allow efficient bitwise operations for flag manipulation and testing.

The flags are used throughout the simulator to:

  • Track the results of ALU operations
  • Control conditional branching and execution flow
  • Provide status information for debugging and monitoring

Flag states are managed by the Flags class, which provides methods for setting, clearing, and querying individual flags or combinations of flags using the bitmask values provided by this enumeration.

Since:
1.0
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    Overflow Flag - Set to true when the last arithmetic operation resulted in an overflow (exceeds maximum representable value) or underflow (falls below minimum representable value in the case of subtraction).
    Zero Flag - Set to true when the result of the last arithmetic or logical operation equals zero.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Constant equivalent to 2^values().length-1.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    get()
    Gets the bitmask value for this flag constant.
    Returns the enum constant of this class with the specified name.
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • ZERO

      public static final FlagsConstants ZERO
      Zero Flag - Set to true when the result of the last arithmetic or logical operation equals zero. This flag is commonly used by conditional jump instructions to test for equality conditions.

      Bitmask value: 1 (2^0)

    • OVERFLOW

      public static final FlagsConstants OVERFLOW
      Overflow Flag - Set to true when the last arithmetic operation resulted in an overflow (exceeds maximum representable value) or underflow (falls below minimum representable value in the case of subtraction).

      This flag indicates that the result cannot be accurately represented in the current data format and may require special handling.

      Bitmask value: 2 (2^1)

  • Field Details

    • all

      public static final int all
      Constant equivalent to 2^values().length-1. It represents the sum of all flag bitmasks and can be used for operations that need to affect all flags simultaneously.

      This value is computed during class initialization by summing all individual flag bitmasks.

  • Method Details

    • values

      public static FlagsConstants[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static FlagsConstants valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified name
      NullPointerException - if the argument is null
    • get

      public int get()
      Gets the bitmask value for this flag constant. The bitmask is calculated as 2^ordinal(), ensuring each flag has a unique power-of-2 value suitable for bitwise operations.

      For example:

      • ZERO.get() returns 1 (2^0)
      • OVERFLOW.get() returns 2 (2^1)
      Returns:
      the bitmask value for this flag (2^ordinal)