The Registers
Registers are used in computer systems as places to store a wide variety of data,
such as addresses, program counters, or data necessary for program execution.
Put simply, a register is a hardware device that stores binary data. Registers are
located on the processor so information can be accessed very quickly. We saw in
Chapter 3 that D flip-flops can be used to implement registers. One D flip-flop is
equivalent to a 1-bit register, so a collection of D flip-flops is necessary to store
multi-bit values. For example, to build a 16-bit register, we need to connect 16 D
flip-flops together. We saw in our binary counter figure from Chapter 3 that these
collections of flip-flops must be clocked to work in unison. At each pulse of the
clock, input enters the register and cannot be changed (and thus is stored) until
the clock pulses again.
Data processing on a computer is usually done on fixed size binary words
that are stored in registers. Therefore, most computers have registers of a certain
size. Common sizes include 16, 32, and 64 bits. The number of registers in a
machine varies from architecture to architecture, but is typically a power of 2,
with 16 and 32 being most common. Registers contain data, addresses, or control
information. Some registers are specified as “special purpose” and may contain
only data, only addresses, or only control information. Other registers are more
generic and may hold data, addresses, and control information at various times.
Information is written to registers, read from registers, and transferred from
register to register. Registers are not addressed in the same way memory is
addressed (recall that each memory word has a unique binary address beginning
with location 0). Registers are addressed and manipulated by the control unit itself.
In modern computer systems, there are many types of specialized registers:
registers to store information, registers to shift values, registers to compare values,
and registers that count. There are “scratchpad” registers that store temporary
values, index registers to control program looping, stack pointer registers to manage
stacks of information for processes, status registers to hold the status or mode
of operation (such as overflow, carry, or zero conditions), and general purpose
registers that are the registers available to the programmer. Most computers have
register sets, and each set is used in a specific way. For example, the Pentium
architecture has a data register set and an address register set. Certain architectures
have very large sets of registers that can be used in quite novel ways to
speed up execution of instructions. (We discuss this topic when we cover
advanced architectures in Chapter 9.)