Page100
The CPU
The Central Processing Unit (CPU) is the “brains” of the computer, capable of controlling and performing mathematical calculations. Ultimately, everything a computer does is mathematical: adding numbers (which can be extended to subtraction, multiplication, division, etc.), performing logical operations, accessing memory locations by address, etc. CPUs are rated by the number of clock cycles per second. A 2.4 GHz Pentium 4 CPU has 2.4 billion clock cycles per second.
Arithmetic Logic Unit and Control Unit
The arithmetic logic unit (ALU) performs mathematical calculations: it “computes.” It is fed instructions by the control unit, which acts as a traffic cop, sending instructions to the ALU.
Fetch and Execute
CPUs fetch machine language instructions (such as “add 1 + 1”) and execute them (add the numbers, for an answer of “2”). The “fetch and execute” (also called “Fetch, Decode, Execute,” or FDX) process actually takes four steps:
- Fetch Instruction 1
- Decode Instruction 1
- Execute Instruction 1
- Write (save) Result 1
These four steps take one clock cycle to complete.
Pipelining
Pipelining combines multiple steps into one combined process, allowing simultaneous fetch, decode, execute, and write steps for different instructions. Each part is called a pipeline stage; the pipeline depth is the number of simultaneous stages that may be completed at once.
Given our previous fetch and execute example of adding 1 + 1, a CPU without pipelining would have to wait an entire cycle before performing another computation. A four-stage pipeline can combine the stages of four other instructions:
- Fetch Instruction 1
- Fetch Instruction 2, Decode Instruction 1
- Fetch Instruction 3, Decode Instruction 2, Execute Instruction 1
- Fetch Instruction 4, Decode Instruction 3, Execute Instruction 2, Write (save) Result 1
- Fetch Instruction 5, Decode Instruction 4, Execute Instruction 3, Write (save) Result 2, etc.
Pipelining is like an automobile assembly line: instead of building one car at a time, from start to finish, lots of cars enter the assembly pipeline, and discrete phases (like installing the tires) occur on one car after another. This increases the throughput.