PART OF THE PICTURE: Computer Architecture 3
There is not a clean separation of registers into these two categories. For example, on some machines
the program counter is user visible, but on many it is not. For purposes of the following discussion, how-
ever, it is convenient to use these categories.
User-Visible Registers. A user-visible register is one that may be referenced by means of
the machine language that the processor executes and that is generally available to all programs,
including application programs as well as system programs. The following types of registers are
typically available: data, address, and condition codes.
Data registers can be assigned to a variety of functions by the programmer. In some cases, they are
general purpose in nature and can be used with any machine instruction that performs operations on data.
Often, however, there are restrictions. For example, there may be dedicated registers for floating-point
operations.
Address registers contain main memory addresses of data and instructions, or they contain a portion
of the address that is used in the calculation of the complete address. These registers may themselves be
somewhat general purpose, or they may be devoted to a particular addressing mode. Examples include:
• Index register: Indexed addressing is a common mode of addressing that involves adding
an index to a base value to get the effective address.
• Segment pointer: With segmented addressing, memory is divided into variable-length
blocks of words called segments. A memory reference consists of a reference to a particular
segment and an offset within the segment; this mode of addressing is important in memory
management. In this mode of addressing, a register is used to hold the address of the base
(starting location) of the segment. There may be multiple registers; for example, one for the
operating system (i.e., when operating-system code is executing on the processor) and one
for the currently executing application.
• Stack pointer: If there is user-visible stack addressing, then typically the stack is in main
memory and there is a dedicated register that points to the top of the stack. This allows the
use of instructions that contain no address field, such as push and pop.
A final category of registers, which is at least partially visible to the user, holds condition codes (also
referred to as flags). Condition codes are bits set by the processor hardware as the result of operations. For
example, an arithmetic operation may produce a positive, negative, zero, or overflow result. In addition to
the result itself being stored in a register or memory, a condition code is also set. The code may subse-
quently be tested as part of a conditional branch operation.
Condition code bits are collected into one or more registers. Usually, they for m part of a control reg-
ister. Generally, machine instructions allow these bits to be read by implicit reference, but they cannot be
altered by the programmer.
Control and Status Registers. There are a variety of processor registers that are
employed to control the operation of the processor. Most of these, on most machines, are not vis-
ible to the user. Some of them may be accessible by machine instructions executed in a control