Enum Class Phase
- All Implemented Interfaces:
Serializable,Comparable<Phase>,Constable
This enum defines the three primary phases of CPU instruction execution following the classical fetch-decode-execute cycle. Each phase is associated with its corresponding execution logic.
The CPU execution cycle:
- Fetch - Retrieve instruction from memory
- Decode - Decode instruction and prepare operands
- Execute - Execute the instruction operation
- None - Default state
- Since:
- 1.0
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
-
Enum Constant Details
-
Fetch
FETCH Phase - Instruction Retrieval.Retrieves the next instruction from memory at the address specified by the Program Counter, loads it into the Instruction Register, and increments the PC for the next instruction.
-
Decode
DECODE Phase - Instruction Interpretation.Decodes the instruction in the IR, looks up the corresponding operation, and prepares the control unit for instruction execution including setting up cycle counts.
-
Execute
EXECUTE Phase - Instruction Execution.Executes the decoded instruction operation, handling multi-cycle instructions and coordinating with memory, ALU, and I/O systems as required by the specific instruction.
-
None
NONE Phase - Default State.Represents an inactive or uninitialized CPU state where no operation is being performed. Used during system initialization.
-
-
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
-
run
public void run()Executes the action associated with this phase.Calls the phase-specific execution logic to perform the appropriate CPU operations for this phase of the instruction cycle.
-