Fetch Decode Execute Cycle in more detail

Sdílet
Vložit
  • čas přidán 5. 06. 2024
  • This computer science video illustrates the fetch decode execute cycle. The view of the CPU focusses on the role of various registers including the accumulator, memory address register, memory data register, current instruction register and the program counter. The arithmetic and logic unit and the control unit are also shown. For simplicity, the machine code commands being executed are represented by assembly language code.
    NOTES:
    To fetch an instruction from main memory into the CPU, the memory address of the instruction is copied from the program counter register into to the memory address register.
    The instruction is then copied from the main memory into the memory data register.
    The instruction in the memory data register is then copied into the current instruction register.
    The fetch part of the cycle is now complete so 1 is added to the contents of the program counter (the program counter is incremented).
    The program counter now contains the memory address of the next instruction to fetch, before the current instruction has been decoded.
    The instruction in the current instruction register is then decoded by the control unit, and then it is executed.
    If the current instruction is complete, the next instruction is fetched, decoded and executed in the same way.
    Some instructions require data to be fetched from the memory in order to be completed, such as the instruction ADD 11. To fetch a data item from the memory, the main memory address of the data item is copied into to the memory address register (the memory address is part of the instruction, in this example it is 11).
    The data item is then copied from the main memory into the memory data register.
    The data item in the memory data register is then copied into the arithmetic and logic unit.
    Some instructions require data in the accumulator register to be saved in the main memory, such as the instruction STORE 12. To store a data item into the main memory, the memory address is copied into to the memory address register (the memory address is part of the instruction, in this example it is 12).
    The data item is then copied from the accumulator register into the memory data register.
    The data item in the memory data register is then copied into the main memory.
    Notice that when anything is copied FROM the main memory (instruction or data item), its memory address is first put into the memory address register, and it is then copied into the memory data register.
    Notice that when anything is copied TO the main memory (data item), its memory address is first put into the memory address register, and it is then copied into the memory data register first.

Komentáře • 453