The Wayback Machine - https://web.archive.org/web/20240822125800/https://www.geeksforgeeks.org/general-purpose-registers/
Open In App

General Purpose Registers

Last Updated : 30 Nov, 2022
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

A register serves as a quick memory for accepting, storing, and sending data and instructions that the CPU will need right away. A register is a collection of flip-flops, Single bit digital data is stored using flip-flops. By combining many flip-flops, the storage capacity can be extended to accommodate a huge number of bits. We must utilize an n-bit register with n flip flops if we wish to store an n-bit word.

The gates govern the flow of information, i.e., when and how the information is sent into a register, whereas the flip-flops store the binary information.

General Purpose Registers

 

Working of Registers:

When we provide the system with input, that input is stored in registers, and when the system returns results after processing, those results are also drawn from the registers. so that the CPU can use them to process the data that the user provides.

Registers are performed based on three operations:

  • Fetch: The Fetch Operation is used to retrieve user-provided instructions that have been stored in the main memory. Registers are used to fetch these instructions.
  • Decode: The Decode Operation is used to interpret the Instructions, which means that the CPU will determine which Operation has to be carried out on the Instructions after the Instructions have been decoded.
  • Execute: The CPU manages the Execute Operation. The results that the CPU generates are then stored in the memory before being presented on the user screen.

Types of Registers:

  • Status and control registers.
  • General-purpose data registers.
  • Special purpose register.

Status and Control Register:

Status and Control registers report and allow modification of the state of the processor and of the program being executed.

General Purpose Registers and Special Purpose Registers

 

General-Purpose Data Registers: 

General purpose registers are extra registers that are present in the CPU and are utilized anytime data or a memory location is required. These registers are used for storing operands and pointers. These are mainly used for holding the following:

  • Operands for logical and arithmetic operations
  • Operands for address calculation
  • Memory pointers

There are 3 types of General-purpose data registers they are:

Data registers: Data registers consists of four 32-bit data registers, which are used for arithmetic, logical and other operations. Data registers are again classified into 4 types they are:

  • AX: This is known as the accumulator register. Its 16 bits are split into two 8-bit registers, AH and AL, allowing it to execute 8-bit instructions as well. In 8086 microprocessors, it is used in the arithmetic, logic, and data transfer instructions. One of the numbers involved in manipulation and division must be in AX or AL.
  • BX: This is called a Base register. It has 16 bits and is split into two registers with 8 bits each, BH and BL. An address register is the BX  register. It typically includes a data pointer for indirect addressing that is based, based indexed, or register-based.
  • CX: This is known as the Count register. Its 16 bits are split into two 8-bit registers, CH and CL, allowing it to execute 8-bit instructions as well. This acts as a counter for loops. It facilitates the development of program loops. Shift/rotate instructions and string manipulation both allow the use of the count register as a counter.
  • DX: This is known as the Data register. Its 16 bits are split into two 8-bit registers, DH and DL so that it can execute 8-bit instructions as well. In I/O operations, the data register can be used as a port number. It is also applied to division and multiplication.

Pointer registers: The pointer registers consist of 16-bit left sections (SP, and BP) and 32-bit ESP and EBP registers.

  • SP: This is known as a Stack pointer used to point the program stack. For accessing the stack segment, it works with SS. It has a 16-bit size. It designates the item at the top of the stack. The stack pointer will be (FFFE)H if the stack is empty. The stack segment is relative to its offset address.
  • BP: This is known as the Base pointer used to point data in the stack segments. We can utilize BP to access data in the other segments, unlike SP. It has a 16-bit size. It mostly serves as a way to access parameters given via the stack. The stack segment is relative to its offset address.

Index registers: The 16-bit rightmost bits of the 32-bit ESI and EDI index registers. SI and DI are sometimes employed in addition and sometimes in subtraction as well as for indexed addressing.

  •  SI: This source index register is used to identify memory addresses in the data segment that DS is addressing. Therefore, it is simple to access successive memory locations when we increment the contents of SI. It has a 16-bit size. Relative to the data segment, it has an offset.
  • DI: The function of this destination index register is identical to that of SI. String operations are a subclass of instructions that employ DI to access the memory addresses specified by ES. It is generally used as a Destination index for string operations.

Special Purpose Registers:

To store machine state data and change state configuration, special purpose registers are employed. In other words, it is also defined as the CPU has a number of registers that are used to carry out instruction execution these registers are called special purpose registers. Special purpose registers are of 8 types they are cs, ds, ss, es, fs, and gs registers come under segment registers. These registers hold up to six segment selectors. 

  • CS (Code Segment register): A 16-bit register called a code segment (CS) holds the address of a 64 KB section together with CPU instructions. All accesses to instructions referred to by an instruction pointer (IP) register are made by the CPU using the CS segment. Direct changes to CS registration are not possible. When using the far jump, far call, and far return instructions, the CS register is automatically updated.
  •  DS (Data Segment register): A 64KB segment of program data is addressed using a 16-bit register called the data segment. The processor by default believes that the data segment contains all information referred to by the general registers (AX, BX, CX, and DX) and index registers (SI, DI). POP and LDS commands can be used to directly alter the DS register.
  •  SS (Stack Segment register): A 16-bit register called a stack segment holds the address of a 64KB segment with a software stack. The CPU by default believes that the stack segment contains all information referred to by the stack pointer (SP) and base pointer (BP) registers. POP instruction allows for direct modification of the SS register.
  •  ES (Extra Segment register): A 16-bit register called extra segment holds the address of a 64KB segment, typically holding program data. In string manipulation instructions, the CPU defaults to assuming that the DI register refers to the ES segment. POP and LES commands can be used to directly update the ES register.
  •  FS (File Segment register): FS registers don’t have a purpose that is predetermined by the CPU; instead, the OS that runs them gives them a purpose. On Windows processes, FS is used to point to the thread information block (TIB).
  •  GS (Graphics Segment register): The GS register is used in Windows 64-bit to point to operating system-defined structures. OS kernels frequently use GS to access thread-specific memory. The GS register is employed by Windows to control thread-specific memory. In order to access CPU-specific memory, the Linux kernel employs GS. A pointer to a thread local storage, or TLS, is frequently used as GS.
  •  IP (Instruction Pointer register): The registers CS and IP are used by the 8086 to access instructions. The segment number of the following instruction is stored in the CS register, while the offset is stored in the IP register. Every time an instruction is executed, IP is modified to point to the upcoming instruction. The IP cannot be directly modified by an instruction, unlike other registers; an instruction may not have the IP as its operand.
  •  Flag register: The status register for an x86 CPU houses its current state, and it is called the FLAGS register. The flag bits’ size and significance vary depending on the architecture. It often includes information about current CPU operation limitations as well as the outcome of mathematical operations. Some of these limitations might forbid the execution of a particular class of “privileged” instructions and stop some interrupts from triggering. Other status flags may override memory mapping and specify the response the CPU should have in the event of an arithmetic overrun.


Previous Article
Next Article

Similar Reads

EFLAGS Registers of 80386 Microprocessor
A flag is a flip-flop that controls certain EU activities or signals a situation carried on by the execution of an instruction. Thirteen flags are present in the EFLAG register. EFLAGS, a 32-bit register, operates as the flags register. FLAGS is the name given to the low-order 16 bits of EFLAGS and can be treated as a unit. This feature is useful f
5 min read
Asynchronous Data Transfer
Asynchronous data transfer enables computers to send and receive data without having to wait for a real-time response. With this technique, data is conveyed in discrete units known as packets that may be handled separately. This article will explain what asynchronous data transfer is, its primary terminologies, advantages and disadvantages, and som
5 min read
Interconnection Networks For Parallel Processores
In parallel computing, Interconnection networks are very crucial for efficient communication among all processors within a similar system. There are two main approaches for interconnecting these processors static high-speed high-speed interconnection network and Dynamic interconnection network. Understanding Interconnection NetworksHigh-speed repre
4 min read
Moore's Law
Gordon Moore one of the co-founders of Intel corporation established the term "Moore's Law" in 1965, This law explains how the number of transistors on integrated circuits is increasing exponentially, which boosts computing capability and lowers prices. Moore's law has had a significant and far-reaching impact on technology, from the introduction o
3 min read
Computer Organization & Architecture: GATE CSE Previous Year Questions
Solving GATE Previous Year's Questions (PYQs) not only clears the concepts but also helps to gain flexibility, speed, accuracy, and understanding of the level of questions generally asked in the GATE exam, and that eventually helps you to gain good marks in the examination. Previous Year Questions help a candidate practice and revise for GATE, whic
4 min read
Difference between Bit and Byte
Bit and byte appear to be very similar terms but there is a vast difference between them. They are the units that are used in computers. It is used in deciding the speed of data transmission between CPU and register, RAM and CPU, and so on. At the same time, it also decides the speed with which data is received in networking. Example: 2Mbps or 1Gbp
2 min read
Application Area of Microprocessors
Pre-requisites: Introduction of Microprocessor, Evolution of Microprocessors Microprocessors are small, central processing units (CPUs) that are found in a wide range of electronic devices and computing systems. It is responsible for executing instructions and performing various operations in these devices, making them an essential component of mod
3 min read
Difference Between Minimum Mode and Maximum Mode in 8086 Microprocessor
Introduction : In the 8086 microprocessor, there are two modes of operation: minimum mode and maximum mode. Minimum mode is used when the 8086 microprocessor is operating as a standalone processor without any external coprocessors or support chips. In this mode, the 8086 uses a single 8-bit bus for both data and instructions, and a single 20-bit ad
3 min read
General Purpose Registers
A register serves as a quick memory for accepting, storing, and sending data and instructions that the CPU will need right away. A register is a collection of flip-flops, Single bit digital data is stored using flip-flops. By combining many flip-flops, the storage capacity can be extended to accommodate a huge number of bits. We must utilize an n-b
7 min read
Basic Cache Optimization Techniques
Generally, in any device, memories that are large(in terms of capacity), fast and affordable are preferred. But all three qualities can't be achieved at the same time. The cost of the memory depends on its speed and capacity. With the Hierarchical Memory System, all three can be achieved simultaneously. The cache is a part of the hierarchy present
5 min read
Instruction sets of a microcontroller
DATA processing instructions :We use data processing instructions to manipulate data within the registers. Types for data processing instructions - Arithmetic instructionsLogical instructionsMultiply instructionsComparison instructionsMove instructions Most of the data processing instructions use a barrel shifter to pre-process the data of one of t
7 min read
External Memory Interfacing in 8051 Microcontroller
Introduction : The 8051 microcontroller is a popular microcontroller used in various applications, ranging from small embedded systems to larger industrial applications. While the 8051 has a limited amount of internal memory, it is possible to extend the memory capacity by interfacing it with external memory devices. External memory interfacing in
9 min read
Pipelining in ARM
ARM Pipelining : A Pipelining is the mechanism used by RISC(Reduced instruction set computer) processors to execute instructions,by speeding up the execution by fetching the instruction, while other instructions are being decoded and executed simultaneously.Which in turn allows the memory system and processor to work continuously.The pipeline desig
3 min read
Minimum mode configuration of 8086 microprocessor (Min mode)
Overview : The 8086 microprocessor operates in minimum mode when MN/MX' = 1.In minimum mode,8086 is the only processor in the system which provides all the control signals which are needed for memory operations and I/O interfacing.Here the circuit is simple but it does not support multiprocessing.The other components which are transceivers, latches
5 min read
Maximum mode configuration of 8086 microprocessor (Max mode)
The 8086 microprocessor is an 8-bit/16-bit microprocessor designed by Intel in the late 1970s. It is the first member of the x86 family of microprocessors, which includes many popular CPUs used in personal computers. The architecture of the 8086 microprocessor is based on a complex instruction set computer (CISC) architecture, which means that it s
4 min read
4 Bit Binary Incrementer
What is 4 Bit Binary Incrementer ?It adds 1 binary value to the existing binary value stored in the register or in other words we can simply say that it increases the value stored in the register by 1.For any n-bit binary incrementer ,‘n’ refers to the storage capacity of the register which needs to be incremented by 1. So we require ‘n’ number of
2 min read
Difference Between ALU and CU
The most essential component of a computer is the Central Processing Unit. It is popularly known as CPU. It is used to process instructions. The principal component of the CPU is the Arithmetic Logic Unit and Control Unit. In this article, we will learn what is the main difference between ALU and CU. What is Arithmetic Logic Unit(ALU)?ALU stands fo
4 min read
Difference between MCU and SoC
System on Chip (SoC) is a newer term with many interpretations & definitions, and its meaning can change over time, but the micro-controller unit (MCU) term has a clear definition and scope, refined from decades of use. Documentation frequently uses these two terms interchangeably, but most industry veterans believe the two terms are not synony
3 min read
Difference between Analog Computer and Digital Computer
Pre-requisite - Classification of Computers 1. Analog Computer : Analog computer system is the very old computer system which operates on the mathematical variables in the form of continuously changeable physical quantities/entities like mechanical, electrical, hydraulic, etc. They use continuous values rather than discrete values so they work on a
4 min read
Difference between Memory and Hard Disk
Memory and hard disk are two essential components of a computer system. Memory refers to the temporary storage used by a computer to perform its operations, while a hard disk is a permanent storage device used to store data and programs. 1. Memory: Memories are made up of registers. Memory refers to the location of short-term data. Each register in
4 min read
Advanced RISC Machine (ARM) Processor
ARM stands for Advanced RISC Machine. It is one of the most licensed and extensive processor cores in the world. In the year of 1978, first ARM processor was introduced by Cambridge University. The first ARM processor was produced by Acorn Group Of Computers in year 1985. ARM was founded and became very popular in 1990. In 2007, ARM processors were
3 min read
Pin diagram of 8051 Microcontroller
Introduction : The 8051 microcontroller is a popular 8-bit microcontroller widely used in embedded systems. It is a single-chip microcontroller with a Harvard architecture that includes a CPU, RAM, ROM, and several peripherals. The 8051 microcontroller has a 40-pin dual in-line package (DIP) that provides various inputs and outputs for communicatio
9 min read
Difference between Microcomputer and Supercomputer
1. Microcomputer: A microcomputer is a general-purpose computer also known as a personal computer. Microcomputers are used for day-to-day work in our homes and offices. Microcomputers are used for simple tasks because it has a single processor. 2. Supercomputer: Supercomputers are the most powerful, very large in size, and very expensive computers
2 min read
What is POST(Power-On-Self-Test)?
A power-on self-test (POST) is a set of routines performed by firmware or software immediately after a computer is powered on, to determine if the hardware is working as expected. The process would proceed further only if the required hardware is working correctly, else the BIOS(Basic Input Output Software) would issue an error message. POST sequen
4 min read
GTX vs RTX - Which is better?
The GTX vs. RTX debate is a common one when selecting a graphics card for gaming or other demanding jobs. NVIDIA's two series provide strong performance, but they target slightly different markets and price points. This post will examine the GTX vs. RTX comparison, emphasizing pricing, features, and performance to assist you in selecting the model
5 min read
Introduction to UNIX System
Unix is an Operating System that is truly the base of all Operating Systems like Ubuntu, Solaris, POSIX, etc. It was developed in the 1970s by Ken Thompson, Dennis Ritchie, and others in the AT&T Laboratories. It was originally meant for programmers developing software rather than non-programmers. Unix and the C were found by AT&T and distr
8 min read
Interrupts in 8085 microprocessor
Introduction : In the 8085 microprocessor, an interrupt is a signal that temporarily suspends the normal execution of a program and redirects the control to a specific interrupt service routine (ISR). Interrupts allow the microprocessor to respond to external events, such as user input, system events, or hardware signals, without the need for const
7 min read
Microprocessor | 8254 programmable interval timer
8254 is a device designed to solve the timing control problems in a microprocessor. It has 3 independent counters, each capable of handling clock inputs up to 10 MHz, and size of each counter is 16 bit. It operates in +5V regulated power supply and has 24 pin signals. All modes are software programmable. The 8254 is an advanced version of 8253 whic
1 min read
Computer Organization | Von Neumann architecture
Von-Neumann computer architecture: Von-Neumann  computer architecture design was proposed in 1945.It was later known as Von-Neumann architecture.  Historically there have been 2 types of Computers:  Fixed Program Computers - Their function is very specific and they couldn't be reprogrammed, e.g. Calculators. Stored Program Computers - These can be
4 min read
Booth’s Multiplication Algorithm
Booth's algorithm is a multiplication algorithm that multiplies two signed binary numbers in 2's complement notation. Booth used desk calculators that were faster at shifting than adding and created the algorithm to increase their speed. Booth’s algorithm is of interest in the study of computer architecture. Here's the implementation of the algorit
15 min read
three90RightbarBannerImg