CPU
The CPU (Central Processing Unit) is the brain
of the computer, and it has the most highly complex circuitry in a computer.
Recall that a computer has five basic components: input, output, processor,
memory, and storage. Since the CPU works closely with memory, or primary
storage, referring to it for both data and instructions, we will examine both
these components in this chapter. General purpose and special purpose computers
will be used in some examples in this chapter. The two main components of the
Central Processing Unit are its ALU (Arithmetic
Logic Unit) and the CU (Control Unit).
ALU
Just as with a human brain, the ALU is where the arithmetic operations are
performed and where logical decisions are made. As its name implies, the
arithmetic logic unit performs basic operations such as addition and
subtraction. Higher order operations such as multiplication and division are
done either by "hard-wiring," that is, done using hardware, or by
following software instructions. The logic unit cannot make a decision such as,
"What should I wear tomorrow?". Instead it makes a comparison and
determines if the result is true or false. These comparisons are based on the
traditional mathematical relations: equal (=), less than (<),
greater than (>), less than or equal, greater than or equal, and not
equal. Since there is no single key on a keyboard for each of the last three
relations, they are entered as multiple keystrokes: <=, >=,
and <>. Assume that your instructor records his/her grades in a
spreadsheet, a software application that we will examine in Chapter 13, and that
a "B" is a grade in the eighties. The logic unit can test your grade
to see if it is >= 80 and <90. If both conditions are true, then the
letter grade is a B. However if either condition was false, in the case of a 65
or a 95, then your grade would not be a B. As you can see, the logic unit can
make compound decisions connected by the logical operators and or or. Although
it is not usual for a mainframe computer to have multiple CPUs, most personal
computers only have a single one. However with a newer personal computer, that
single ALU will very likely have two or more ALUs. Whereas the ALU processes
data, the Control Unit processes instructions.
Control Unit
The control unit's circuitry directs the computer system to execute stored
program instructions. For example a typical instruction may be to read a
character from the keyboard and store the keystroke in a specific memory
location. Instructions are numerically coded. Suppose that 04 is the code for
reading a keystroke, and 89 is the memory address where the character is to be
stored. The instruction would be 0489. If 05 is the code for outputting to the
printer, then 0589 would send the character found in cell #89 to the printer.
Actual instructions are more complex than this, and they are written in binary.
Furthermore, each processor, or family of processors, can have different
instruction sets. For example, the 0489 command may instruct a Wintel computer
to read data from the keyboard and store it in memory, but on a Macintosh
computer, the instruction could mean retrieve the contents of that memory cell
and add it to the number in the ALU. It is important to understand that both
instructions and data are stored numerically and in binary. Using the previous
example, 04 is actually 0100, and 89 is 1011001. So the instruction would be
01001011001. Suppose that the keystroke was the letter A, then the actual
contents of cell #89 would not be an "A", but instead its binary code,
which is 01000001. This example uses the ASCII code,
which is one of the most commonly used character codes for microcomputers. We
now turn our attention to memory.