Known by the acronym in English for central processing unit (or CPU listed on Abbreviationfinder), or simply the processor or microprocessor, it is the component in a computer that interprets the instructions and processes the data contained in the computer’s programs.
CPUs provide the fundamental characteristic of the digital computer (programmability) and are one of the necessary components found in computers of any time, along with the primary storage and I / O devices. The CPU that is manufactured with integrated circuits is known as a Microprocessor. Since the mid- 1970s, single- chip microprocessors have almost totally replaced all types of CPUs, and today, the term “CPU” is usually applied to all microprocessors.
The fundamental operation of most CPUs is to execute a sequence of stored instructions called “programs”. The program is represented by a series of numbers that are kept in a certain kind of computer memory. There are four steps that almost all von Neumann Architecture CPUs use in their operation: fetch, decode, execute, and writeback, (read, decode, execute, and write).
The first step, read (fetch), involves retrieving an Instruction, (which is represented by a number or a sequence of numbers), from program memory. The location of the program memory is determined by a Program Counter (PC), which stores a number that identifies the current position in the program. In other words, the program counter tells the CPU where the instruction is in the current program. After an instruction is read, the Program Counter is incremented by the length of the instruction word in terms of memory units. Often times the instruction to be read must be retrieved from relatively slow memory, causing the CPU to stop while it waits for the instruction to be returned. This problem is addressed on modern processors largely by caches and Pipeline architectures (see below).
The instruction that the CPU reads from memory is used to determine what the CPU should do. In the decoding step, the instruction is divided into parts that have meaning for other CPU units. The way in which the value of the numerical instruction is interpreted is defined by the architecture of the Instruction Set (the ISA) of the CPU. Often times, a group of numbers in the instruction, called Opcode, indicates what operation to perform. The remaining parts of the number usually provide information required for that instruction, such as operands for an Addoperation.
Such operands can be given as a constant value (called an immediate value), or as a place to locate a value, which as determined by some Address Mode, can be a register or a Memory Address. In older designs the CPU units responsible for decoding the instruction were fixed hardware devices. However, in more abstract and complicated CPUs and ISAs, a firmware is often used to help translate instructions into various configuration signals for the CPU. This firmware is sometimes rewritable in such a way that it can be modified to change the way the CPU decodes instructions even after it has been manufactured.
After the reading and decoding steps, the instruction execution step is carried out. During this step, various CPU units are connected in such a way that they can perform the desired operation. If, for example, an add operation was requested, an Arithmetic Logic Unit (ALU) will be connected to a set of inputs and a set of outputs. The inputs provide the numbers to be added, and the outputs will contain the final sum.
The ALU contains the circuitry to perform simple arithmetic and logic operations on the inputs, such as addition and bitwise operations. If the add operation produces a result too large to be handled by the CPU, an Arithmetic Overflow flag located in a flag register can also be set (see the section on integer range below).
The final step, the writeback, simply “writes” the results of the execution step to some form of memory. Very often, the results are written to some internal register of the CPU for quick access by subsequent instructions. In other cases the results can be written to a slower but cheaper and larger main memory. Some types of instructions manipulate the program counter instead of directly producing result data.
These are generally called “jumps” (jumps) and facilitate behavior like loops (loops), conditional program execution (through the use of conditional jumps), and functions in programs. Many instructions will also change the state of digits in a “flag” register. These flags can be used to influence how a program behaves, since they often indicate the results of various operations. For example, a “compare” type of instruction considers two values and sets a number, in the flag register, according to which is the greater. This flag can then be used by a subsequent jump instruction to determine the program flow.
After the execution of the instruction and the writing of the resulting data, the entire process repeats with the next instruction cycle, usually reading the next instruction in sequence due to the incrementing value in the program counter. If the completed instruction was a jump, the program counter will be modified to contain the address of the instruction that was jumped to, and program execution continues normally. In CPUs more complex than the one described here, multiple instructions can be read, decoded, and executed simultaneously. This section describes what is generally referred to as the “Classic RISC pipeline”, which is in fact quite common among the simple CPUs used in many electronic devices, often called Microcontrollers.