What are Registers in CPU
are special store locations generally having a capacity equivalent to the word size of the computer concerned and having specific properties for use during arithmetic and/or logical operations. The registers in a computer may be classified as either operational or storage type.
An ‘Operational register’ is capable of storing binary information in its flip-flops and, in addition, has combinational gates capable of data processing tasks. A ‘Storage register’ is used solely for the temporary storage of binary information. This information cannot be altered when transferred in and out of the register.
The bulk of the registers in a digital computer are storage registers, to which information is transferred for storage and form which information is available when needed for processing. Comparatively few operational registers are found in the processors. Registers exchange information through internal buses.
Multiple internal buses allow overlapping of certain operations and therefore increase processing speed. The word length of each register is usually equal to the width of internal data buses. The number of registers in a processor may vary from just 1 to 64 registers or more. Some special-purpose registers areas:
A. Program Counter (PC):
is also called “Control Counter” stores the address of the next instruction to be performed. Prior to the execution of a program, the PC is loaded with the
starting address of that program. Thereafter it is incremented every time a new instruction is fetched such that, since the instructions of a program occupy adjacent ascending addresses, it always points to the location of the next instruction.
B. Instruction Register (IR):
holds the address of the current instruction. Program instruction
consists of two parts; op-code and address field. The IR extracts only the opcode part from the data buffer. Subsequently, the CU decides this opcode and generates the control signals.
C. Buffer Register:
holds addresses, data and isolate the external data buses of the CPU from
its internal buses.
D. Status Register:
stores the program status word, consisting of status and control bits, which
contain information about the condition of a peripheral unit. This information includes, e.g., warning when a peripheral unit needs attention such as there is no paper on a printer and is entered into the status word automatically.
E. Stack Pointer:
holds the addresses of the instructions.
Types of 8086/88 REGISTERS: –
While programming 8086/88 we must have adequate knowledge of the various registers in the EU and BIU. Fig shows these registers into logical groups to form a “Programming Model”. The 8086 microprocessor has several internal registers that can store binary data. Registers are
special work areas inside the 8086, designed to be accessed at high speed and all these registers are 16-bits long. Now we will take a closer look at each of these registers in this section.
General/Data Registers: –
Four registers named “Data or General registers” consist of the AX, BX, CX, and DX registers. All general registers are used for storing intermediate results. These registers can be accessed as a byte (8-bits) or a word (16-bits). The upper halves of each of these registers are called AH, BH, CH, and DH. Similarly, the lower halves of these registers are labelled AL, BL, CL, and DL.
Bit positions are always numbered from right to left, starting with 0.
Although all the data registers can be used interchangeably for many operations, each of the
registers is used for specific purposes.
- Accumulator (AX): AX register is also called the Accumulator. It possesses some features that the other data registers don’t have. Many operations are also slightly more efficient when performed with AX.
- Base Register (BX): Like other data registers, the BX register can perform logical, arithmetic, data movement, and it has special addressing abilities. Like SI, DI, and BP it can hold memory address that points to another variable.
- Counter Register (CX): acts as a counter for repeating or looping instructions. These instructions automatically repeat and decrement CX and quit when it equals 0.
- Data Register (DX): has a special role in multiply and divide operations e.g., when multiplying, DX holds the high 16-bits of the product
Index Registers: –
The Index register SI, DI are 16-bit registers (you cannot access the low or high bytes alone) which can be used for temporary storage just like the general registers. However, their main purpose is to hold the ‘offset’ of variables. The offset refers to the distance of a variable, label, or instruction. These registers are used as ‘Memory Pointers’. Each instruction must refer to an index register when addressing locations in storage areas. Both the index registers can be used for general storage but their real strength shows up when they are used during powerful string
Source Index (SI): is named after the 8088’s string movement instructions, where the SI register points to the source string. SI usually contains an offset value from the DS register, but it
can address any variable.
Destination Index (DI): acts as the destination for 8088’s string movement instructions. DI usually contains an offset value from the ES register, but it can address any variable.
Any location used to hold the address of another location said to act as a pointer to that location. Pointer Registers are 16-bit registers as follows:
Base Pointer (BP): contains the offset from the SS register. It is used to access data in the stack segment.
Stack Pointer (SP): The ‘Stack’ is a set of contiguous memory locations where items are added or removed such that the latest arrival is processed first and the earliest arrival is processed last, for which it is called a Last-In-First-Out (LIFO) stack. A stack is different from any other memory location in that data are put on and taken from the top of the stack and is reserved to store operand and instructions.
The SP points to the top of the stack. In other words, it holds the address of the item currently occupying the top. So the SP contains the offset address of the top of the stack. The SS and SP registers combine to form the complete top-of-stack (actual) address. 8088 can handle an unlimited number of stacks.
Each one can be up to 64K in size and located anywhere in the 8088’s one mega address space. The only restriction is that their 64Ksize limit and they must start at an address boundary that is an even multiple of 16 bytes.
Instruction Pointer (IP): essentially plays the role of a PC and its only one function is containing the address of the next instruction to be executed. When an instruction is executed, the IP is automatically incremented the number of times needed to point the next instruction.
However, its contents don’t specify a physical memory address but an offset. CS and IP combine to form the address of the next instruction to be executed. IP is physically part of the BIU and not under the direct control of the programmer as are the other pointer registers.