Enum Class Phase

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

public enum Phase extends Enum<Phase>
CPU Execution Phases - Instruction Cycle States.

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:

  1. Fetch - Retrieve instruction from memory
  2. Decode - Decode instruction and prepare operands
  3. Execute - Execute the instruction operation
  4. None - Default state

Since:
1.0
  • Enum Constant Details

    • Fetch

      public static final Phase 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

      public static final Phase 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

      public static final Phase 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

      public static final Phase 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

      public static Phase[] 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 Phase 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
    • 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.