The program counter stores the address of each instruction and tells the CPU in what order they should be carried out. When a program is being executed, the CPU performs the fetch-decode-execute cycle, which repeats over and over again until reaching the STOP instruction. Fetch-decode-execute cycle The main job of the CPU is to execute programs using the fetch-decode-execute cycle also known as the instruction cycle. Summary of the fetch-decode-execute cycle The processor checks the program counter to see which instruction to run next.
The program counter gives an address value in the memory of where the next instruction is. Whatever software is being used on computers, the CPU processes the data being used. Before this process can begin, both the program and data are loaded into Random-access memory RAM by the operating system.
The CPU is now ready to carry out the fetch decode execute cycle. The PC is an important register that keeps track of the running order of the instructions and shows which instruction in the program is due to be executed next.
The CPU then places the address of the next item to be fetched on to the address bus. A single piece of program code might require several instructions. For example, look at this Python code:.
First, the computer needs to load in the value of the variable length into the immediate access store registers. Next it needs to load in the value of the variable width. This is the part of the cycle when data processing takes place, and the instruction is executed.
In a program, each machine code command occupies a space in the main memory. These memory locations each have a specific memory address. The program counter saves the address of each command and instructs the CPU in what sequence they should be executed. When a program is being carried out, the CPU implements the fetch — decode — execute cycle, which recurs over and over again until arriving at the STOP instruction. The Execute Cycle is the only step useful to the end user, everything else is required to make the execute cycle happen, as it performs the function of the command.
The ALU is utilised if the command involves arithmetic or logical operations. A-Level Functions and Characteristics of CPU years An editable PowerPoint lesson presentation Editable revision handouts A glossary which covers the key terminologies of the module Topic mindmaps for visualising the key concepts Printable flashcards to help students engage active recall and confidence-based repetition A quiz with accompanying answer key to test knowledge and understanding of the module View A-Level Functions and Characteristics of CPU Resources.
Table of Contents hide.
0コメント