Skip to main content

Section 6.3 The Processor, cont.

Subsection 6.3.1 The ALU

The arithmetic logic unit is a collection of circuits that can do math and logic. Early processors could only do very simple operations - add or subtract numbers, compare two numbers to see which is larger, and do Boolean logic (to say combine two values with XOR). More complex operations, like multiplication, might have to be performed via simpler operations that the ALU can do directly. Instead of multiplying two numbers, a very simple computer would have to add them repeatedly.
As components became smaller, more and more logic could be built into ALUs - from circuits to do multiplication, to circuits to work with floating-point decimals or process text. Nowadays, almost every processor has multiple ALUs that work in parallel and are often specialized for specific jobs.

Subsection 6.3.2 The Control Unit

The control unit is the true “brain” of the CPU and is responsible for controlling much of the operation of the rest of the processor. It does this by issuing control signals to the other areas of the processor, instructing them on what should be performed next. Similarly to the arithmetic logic unit, the control unit can be broken down further for easier understanding. Two key sub-components are the decoder and clock:

Subsubsection 6.3.2.1 The Decoder

Like everything else the computer works with, instructions are represented as sequences of 0s and 1s. The decoder is the logic that examines those bits and determines what actions must be taken to execute the instruction they represent. The control unit uses this information to send the appropriate series of messages to the ALU, memory, and registers.

Subsubsection 6.3.2.2 The Clock (or Timer)

The timer or clock ensures that all processes and instructions are carried out and completed at the right time. If one component of the computer tries to read a signal before another component has sent the message it might see an older message or complete gibberish. Pulses are sent to the other areas of the CPU at regular intervals and actions only occur when a pulse is detected.

Subsection 6.3.3 The Registers

A register is a memory location within the CPU itself, designed to be quickly accessed for purposes of fast data retrieval. These contain instructions, data, and other values that are needed by the ALU and control unit. On the timescale processors work at (billionths of a second) the trip to main memory can be too slow to wait for during the middle of an instruction. So the CPU needs some high-speed memory right inside the CPU to store the information it is currently working with. Here are some examples of kinds of registers a CPU will often have:

Subsubsection 6.3.3.1 Instruction Register (IR)

This is used to hold the current instruction in the processor while it is being decoded and executed. As each instruction that is to be executed is fetched from memory it is placed here for quick reference.

Subsubsection 6.3.3.2 Program Counter (PC)

This register is used to hold the memory address of the instruction being executed. This is how the CPU keeps track of where it is in the program (“I am on instruction 010101”). Normally, each time an instruction is executed, the PC is increased by one to move to the next instruction. Sometimes, however, an instruction will modify the PC to make the program jump to a completely different instruction.

Subsubsection 6.3.3.3 General Purpose Registers

A simple computer might have one Accumulator (ACC) that is used to hold the result of operations performed by the ALU. (We will see an example of such a machine in Section 7.2). Modern processors have anywhere from a few to dozens of these registers for storing the results of work directly in the CPU. The names of these general-purpose registers will differ from one machine to another, but no matter what they are called, they simply are very fast, very temporary storage for the CPU.
You have attempted of activities on this page.