Package io.matita08.data
Enum Class FlagsConstants
- All Implemented Interfaces:
Serializable,Comparable<FlagsConstants>,Constable
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 ConstantsEnum ConstantDescriptionOverflow 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
FieldsModifier and TypeFieldDescriptionstatic final intConstant equivalent to2^values().length-1. -
Method Summary
Modifier and TypeMethodDescriptionintget()Gets the bitmask value for this flag constant.static FlagsConstantsReturns the enum constant of this class with the specified name.static FlagsConstants[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
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
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 allConstant equivalent to2^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
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
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 nameNullPointerException- 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)
-