The CPU is the part of the computer one thinks of first when describing the components of a computer. The
repetitive cycle of the von Neumann computer is to a) load an instruction from memory into the CPU, and b)
decode and execute the instruction. Executing the instruction may include performing arithmetic or logical
operations, and also loading or storing data in memory. When the instruction execution is complete, the computer
fetches the next instruction from memory, and executes that instruction. The cycle continues indefinitely,
unless the instruction fetched turns out to be a HALT instruction.
The CPU is usually described as consisting of a control unit and an arithmetic and logic unit (ALU). The
control unit is responsible for maintaining the steady cycle of fetch-and-execute, and the ALU provides the
hardware for arithmetic operations, value comparisons (greater than, less than, equal to), and logical functions
(AND, OR, NOT, etc.).
Both the control unit and the ALU include special, very high-performance memory cells called registers.
Registers are intimately connected to the wiring of the control unit and the ALU; some have a special purpose,
and some are general purpose. One special-purpose register is the program counter (PC).
The PC keeps track of the address of the instruction to execute next. When the control unit begins
a fetch–execute cycle, the control unit moves the instruction stored at the address saved in the PC to another
special register called the instruction register (IR). When such a fetch of the next instruction occurs, the control
unit automatically increments the PC, so that the PC now “points” to the next instruction in sequence.
The control unit then decodes the instruction in the IR, and executes the instruction. When execution is
complete, the control unit fetches the instruction to which the PC now points, and the cycle continues.
Other registers of the ALU are general purpose. General-purpose registers are used to store data close to
the processor, where the processor can access the information even more quickly than when the value is in
memory. Different computers have different numbers of registers, and the size of the registers will be congruent
with the word size of the computer (16-bit, 32-bit, etc.).
The number of registers, and the nature of the special-purpose registers, comprise an important part of the
computer architecture. In the case of the Intel x86 architecture, there are four 32-bit general-purpose registers
(EAX, EBX, ECX, and EDX), and four 32-bit registers devoted to address calculations and storage (ESP, EBP,
ESI, and EDI). One could say much more about registers in the Intel x86 architecture, but they are now too
complex to describe completely, as the architecture has been cleverly expanded while maintaining complete
compatibility with earlier designs.
No comments:
Post a Comment