Page 32 - DCAP104_EXPOSURE_TO_COMPUTER_DISCPLINES
P. 32

Unit 2: Data Processing



            2.4 Registers                                                                         Notes

            In computer architecture, a processor register (or general purpose register) is a small amount
            of storage available on the CPU whose contents can be accessed more quickly than storage
            available elsewhere. Typically, this specialized storage is not considered part of the normal
            memory range for the machine. Most, but not all, modern computers adopt the so-called load-
            store architecture. Under this paradigm, data is loaded from some larger memory be it cache
            or RAM into registers, manipulated or tested in some way (using machine instructions for
            arithmetic/logic/comparison) and then stored back into memory, possibly at some different
            location. A common property of computer programs is locality of reference: the same values
            are often accessed repeatedly; and holding these frequently used values in registers improves
            program execution performance.


                          Processor registers are at the top of the memory hierarchy, and provide
                          the fastest way for a CPU to access data. The term is often used to refer only
                          to the group of registers that are directly encoded as part of an instruction, as
                          defined by the instruction set.


            Allocating frequently used variables to registers can be critical to a program’s performance. This
            action (register allocation) is performed by a compiler in the code generation phase.

            2.4.1 Categories of Registers

            Registers are normally measured by the number of bits they can hold, for example, an “8-bit
            register” or a “32-bit register”. A processor often contains several kinds of registers, that can be
            classified accordingly to their content or instructions that operate on them:
             (a) User-accessible registers: The most common division of user-accessible registers is into
                 data registers and address registers.
             (b) Data registers: These are used to hold numeric values such as integer and floating-point
                 values. In some older and low end CPUs, a special data register, known as the accumulator,
                 is used implicitly for many operations.
             (c) Address registers: Its hold addresses and are used by instructions that indirectly access
                 memory.
                 • Some processors contain registers that may only be used to hold an address or only to
                   hold numeric values (in some cases used as an index register whose value is added as
                   an offset from some address); others allow registers to hold either kind of quantity. A
                   wide variety of possible addressing modes, used to specify the effective address of an
                   operand, exist.
                 • A stack pointer, sometimes called a stack register, is the name given to a register that
                   can be used by some instructions to maintain a stack.
             (d) Conditional registers: Its hold truth values often used to determine whether some instruction
                 should or should not be executed.
             (e) General purpose registers (GPRs): Its can store both data and addresses, i.e., they are
                 combined Data/Address registers.
              (f) Floating point registers (FPRs): Its store floating point numbers in many architectures.
             (g) Constant registers: Its hold read-only values such as zero, one, or pi.

             (h) Vector registers: Its hold data for vector processing done by SIMD instructions (Single
                 Instruction, Multiple Data).



                                             LOVELY PROFESSIONAL UNIVERSITY                                    25
   27   28   29   30   31   32   33   34   35   36   37