0% found this document useful (0 votes)
22 views4 pages

Understanding CPU Registers and Types

CPU registers are storage locations in a CPU that hold data and instructions. There are different types of registers including control registers, general purpose registers, and floating point registers. Registers vary in number and size depending on the CPU architecture.

Uploaded by

Hafsa Ahmed 4307
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views4 pages

Understanding CPU Registers and Types

CPU registers are storage locations in a CPU that hold data and instructions. There are different types of registers including control registers, general purpose registers, and floating point registers. Registers vary in number and size depending on the CPU architecture.

Uploaded by

Hafsa Ahmed 4307
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

CPU REGISTERS

A register is a quickly accessible temporary storage location built into a


CPU. Some registers are used internally and cannot be accessed outside
the processor, while others are user-accessible. Most modern CPU
architectures include both types of registers.

TYPES
Control and Status Registers
The control and status register holds the address or data that is
important to control the processor’s operation. Most of these, on most
machines, are not visible to the user. Some of them may be accessible by
machine instructions executed in control or operating system mode.
1. Program Counter (PC)
The program counter is a processor register that holds the address of
the instruction that has to be executed next. It is a processor which
updates the program counter with the address of the next instruction to
be fetched for execution.
2. Instruction Register (IR)
Instruction register has the instruction that is currently fetched. It helps
analyzing the opcode and operand present in the instruction.
3. Memory Buffer Register (MBR)
Memory buffer register is used to store the data coming from the
memory or going to the memory.
The memory buffer register holds the data that has to be written to a
memory location or it holds the data that is recently been read.
4. Memory Data Register (MDR)
MDR is the register of a computer’s control unit that contains the data
to be stored in the computer storage (e.g. RAM), or the data after a
fetch from the computer storage. It acts like a buffer and holds anything
that is copied from the memory read for the processor to use it. MDR
hold the information before it goes to the decoder.
MDR which contains the data to be written into or readout of the
addressed location. For example, to retrieve the contents of cell 123, we
would load the value 123 (in binary of course) into the MAR and perform
a fetch operation. When the operation is done, a copy of the contents of
cell 123 would be in the MDR. To store the value 98 into cell 4, we load a
4 into the MAR and a 98 into the MDR and perform a store. When the
operation is completed the contents of cell 4 will have been set to 98, by
discarding whatever was there previously.
The MDR is a two-way register.
5. Memory Address Register (MAR)
Memory address register is used to store memory address of data and
instructions being used by CPU. This register is used to access data and
instructions from memory during the execution phase of an instruction.
It holds the address of a memory location.
Suppose CPU wants to store some data in the memory or to read the
data from the memory. It places the address of the-required memory
location in the MAR.
The MAR and MBR are used to move the data between processor and
memory.
6. Program Status Word (PSW)
All processor designs also include a register or set of registers, often
known as the program status word (PSW), which contains status
information. The PSW typically contains condition codes plus other
status information. Common fields and flags include the following:
 Sign: Contains the sign bit of the last arithmetic operation.
 Zero: Set when the result of an arithmetic operation is zero.
 Carry: Set if an operation resulted in a carry (addition) into or
borrow (subtraction) out of a high-order bit. Used for multi-word
arithmetic operations.
 Equal: Set if a logical compare result in equality.
 Overflow: Used to indicate arithmetic overflow.
 Interrupt Enable/Disable: Used to disable or enable interrupts.
When interrupts are disabled, the processor ignores them. This
is often desirable when operating system is in the midst of
dealing with another interrupt.
 Supervisor: Indicates whether the processor is executing in
supervisor or user mode. Certain privileged instructions can be
executed only in supervisor mode, and certain areas of memory
can be accessed only in supervisor mode.

User-accessible Registers
User-accessible registers are larger than internal registers and typically
hold data for a longer time. 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.
1. General Purpose Register
The general-purpose register detain both the addresses or the data.
Although we have separate data registers and address registers. The
general purpose register also accepts the intermediate results in the
course of program execution.
Well, the programmers can restrict some of the general-purpose
registers to specific functions. Like, some registers are specifically used
for stack operations or for floating-point operations. The general-
purpose register can also be employed for the addressing functions.
2. Data Register
Data register may store individual values referenced being by a currently
running program. It is used for division and multiplication.
It 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 perform operations on data. Often, however,
there are restrictions. For example, there may be dedicated registers for
floating-point operation.
3. Address Register
An 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
The index register is employed for indexed addressing and it is
initial value is 0. Generally, it used for traversing the memory
locations. After each reference, the index register is incremented
or decremented by 1, depending upon the nature of the
operation.
Sometime the index register may be auto indexed.
 Segment Pointer Register
A memory divided in segments, requires a segment register to
hold the base address of the segment. There can be multiplied
segment registers. As one segment register can be employed to
hold the base address of the segment occupied by the operating
system. The other segment register can hold the base address of
the segment allotted to the processor.
 Stack Pointer Register
The stack register has the address that points the stack top.
4. Condition Code
Condition codes are the flag bits which are the part of the control
register. The condition codes are set by the processor as a result of an
operation and they are implicitly read through the machine instruction.
The programmers are not allowed to alter the conditional codes.
Generally, the condition codes are tested during conditional branch
operation.

Status Registers
Status registers hold truth values often used to determine whether some
instruction should or should not be executed.

Floating-Point Registers (FPRs)


FPRs store floating point numbers in many architectures.

Constant Registers
Constant registers hold read-only values such as zero, one, or pi.

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

Accumulator Register
This register is used for storing the Results those are produced by the
System. When the CPU will generate some Results after the processing
then all the results will be stored into the AC Register.

NUMBERS & SIZE


Register vary in both number and size, depending on the CPU
architecture. Some processors have 8 registers while others have 16, 32,
or more. For many years, registers were 32-bit, but now many are 64-bit
in size. A 64-bit register is necessary for a 64-bit processor, since it
enables the CPU to access 64-bit memory addresses. A 64-bit register
can also store 64-bit instructions, which cannot be loaded into a 32-bit
register. Therefore, most programs written for 32-bit processors can run
on 64-bit computers, while 64-bit programs are not backwards
compatible with 32-bit machines.

You might also like