SPECIAL PURPOSE REGISTERS SPECIAL .pptx

226 views 54 slides Sep 01, 2024
Slide 1
Slide 1 of 54
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43
Slide 44
44
Slide 45
45
Slide 46
46
Slide 47
47
Slide 48
48
Slide 49
49
Slide 50
50
Slide 51
51
Slide 52
52
Slide 53
53
Slide 54
54

About This Presentation

Special purpose registers are registers in a processor that perform specific tasks or functions, such as:
Accumulator
A register that holds data being processed and the results of calculations, and is used by the arithmetic logic unit (ALU)
Program counter (PC)
A register that stores the memory ad...


Slide Content

GENERAL PURPOSE REGISTERS

General purpose registers are used to store temporary data within the microprocessor.There are 8 general purpose registers in 8086 microprocessor. General Purpose Registers are a kind of registers which can store both data and addresses. All general registers of the Intel 8086 microprocessor can be used for arithmetic and logic operations and data movement. There are 4 general-purpose registers of 16-bit length each. Each of them is further divided into two subparts of 8-bit length each: one high, which stores the higher-order bits and another low which stores the lower order bits.

1. AX  –  This is the accumulator. It is of 16 bits and is divided into two 8-bit registers AH and AL to also perform 8-bit instructions.It is generally used for arithmetical and logical instructions but in 8086microprocessor it is not mandatory to have accumulator as the destinationoperand . Example: ADD AX, AX (AX = AX + AX)

2. BX –  This is the base register. It is of 16 bits and is divided into two 8-bit registersBH and BL to also perform 8-bit instructions.It is used to store the value of the offset. Example: MOV BL, [500] (BL = 500H)

3. CX  –  This is the counter register. It is of 16 bits and is divided into two 8-bitregisters CH and CL to also perform 8-bit instructions.It is used in looping and rotation. Example: MOV CX, 0005LOOP

4. 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. Stack pointer Base pointer

STACK POINTER A stack pointer is a small register that stores the memory address of the last data  element  added to the stack or, in some cases, the first available address in the stack. It is used as a memory pointer. It points to a memory location in read/write memory, called the stack. It is always incremented/decremented by 2 during push and pop operation.

2. BASE POINTER 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. Source Index Destination Index

SOURCE INDEX 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.

2. DESTINATION INDEX   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

The 8085 microprocessor has special-purpose registers, namely, Program Counter (PC), Stack Pointer (SP), Flags/Status Registers (SR), Instruction Register (IR), Memory Address Register (MAR), Temporary Register (TR), and Memory Buffer Register (MBR).

Program Counter (PC) : The program counter is a 16-bit special-purpose register. This is used to hold the memory address of the next instruction which will be executed. Actually, this register keeps track of memory locations of the instructions during execution of program. The microprocessor uses this register to execute instructions in sequence. For this, the microprocessor increments the content of the program counter.

STACK POINTER The stack pointer is a 16-bit register, which is used to point the memory location called the stack. The stack is a sequence of memory locations in the R/W memory. The starting of the stack is defined by loading a 16-bit address into the stack pointer. Generally, the programmers use this register to store and retrieve the contents of the accumulator, flags, program counter as well as general-purpose registers during the execution of a program.

Flags/Status Registers (SR) : The Arithmetic Logic Unit (ALU) includes five flip-flops, which are set or reset after an ALU operation according to data conditions of the result in the accumulator and other general-purpose registers. The status of each flip-flop is known as a flag. Therefore, there are five flags, namely, Carry flag (CY), Parity flag (P), Auxiliary Carry flag (AC), Zero flag (Z), and Sign (S) flags. The most commonly used flags are Carry(CY), Zero(Z) and Sign(S). Generally, the microprocessor uses these flags to test data conditions.

Instruction Register (IR) : The instruction register holds the operation code (opcode) of the current instruction of a program during an arithmetic/logical operation. The instruction is fetched from the memory prior to execution. The decoder takes the instruction and decodes it. After that, the decoded instruction is passed to the next stage for execution

Memory Address Register (MAR) : The Memory Address Register holds the address of the next program instruction. Then MAR feeds the address bus with addresses of the memory location of the program instruction which will be executed.

Temporary Register (TR) : This is an 8-bit register, which is associated with ALU. This register holds data during arithmetic and logical operation. This register can be used by the microprocessor but is not accessible to the programmer.

MICRO OPERATIONS

What is micro operation?   A microoperation is an elementary operation performed on the information stored in one or more. registers.  Types of Micro-operations: Register Transfer Micro-operations: Transfer binary information from one register to another. Arithmetic Micro-operations: Perform arithmetic operation on numeric data stored in registers. Logical Micro-operations: Perform bit manipulation operations on data stored in registers. Shift Micro-operations: Perform shift operations on data stored in registers.

Arithmetic Micro-operations In general, the Arithmetic Micro-operations deals with the operations performed on numeric data stored in the registers. The basic Arithmetic Micro-operations are classified in the following categories: Addition Subtraction Increment Decrement Shift

Some additional Arithmetic Micro-operations are classified as: Add with carry Subtract with borrow Transfer/Load, etc.

Symbolic Representation Description R3 ← R1 + R2 The contents of R1 plus R2 are transferred to R3. R3 ← R1 - R2 The contents of R1 minus R2 are transferred to R3. R2 ← R2' Complement the contents of R2 (1's complement) R2 ← R2' + 1 2's complement the contents of R2 (negate) R3 ← R1 + R2' + 1 R1 plus the 2's complement of R2 (subtraction) R1 ← R1 + 1 Increment the contents of R1 by one R1 ← R1 - 1 Decrement the contents of R1 by one

Note: The increment and decrement micro-operations are symbolized by '+ 1' and ‘- 1' respectively. Arithmetic operations like multiply and divide are not included in the basic set of micro-operations.

BINARY ADDER

The Add micro-operation requires registers that can hold the data and the digital components that can perform the arithmetic addition. A Binary Adder is a digital circuit that performs the arithmetic sum of two binary numbers provided with any length. A Binary Adder is constructed using full-adder circuits connected in series, with the output carry from one full-adder connected to the input carry of the next full-adder.

4-BIT BINARY ADDER

The augends bits of A and the addend bits of B are designated by subscript numbers from right to left, with subscript 0 denoting the low-order bit. The carries are connected in a chain through the full-adders. The input carry to the binary adder is Co and the output carry is C4. The S outputs of the full-adders generate the required sum bits. An n-bit binary adder requires n full-adders.

Binary Adder-Subtractor The Subtraction micro-operation can be done easily by taking the 2's compliment of addend bits and adding it to the augend bits. Note: The 2's compliment can be obtained by taking the 1's compliment and adding one to the least significant pair of bits. The 1's compliment can be implemented with inverters, and one can be added to the sum through the input carry.

The block diagram for a 4-bit adder-subtractor circuit can be represented as:

A 4-bit combinational circuit incrementer can be represented by the following block diagram.

SHIFT MICRO OPERATIONS

The operation that changes the adjacent bit position of the binary values stored in the register is known as shift micro-operation. Shift micro operations are involved in shifting of bits of a register. Shift micro operations are used for serial transfer of data.

Shift Micro-operations are categorized in detail as follows:

1 . Logical Shift: Logical shift can be defined as the shift of the bits to the right or left serially. This operation is associated with shift of data bits towards left or right and allowing a serial bit stream to occupy vacated bit positions. Normally a zero occupies the vacated position when every bit gets shifted either leftwards or rightwards. Logical Shift is of two types: Logical Left Shift ( Shl ) Logical Right Shift ( Shr )

Logical Left Shift:  Every bit gets shifted towards left. The left most bit (MSB) gets discarded and a zero fills the vacated LSB position. Mathematically this operation shows that the number is multiplied by 2.

Logical Right Shift:  Every bit gets shifted towards right. The right most bit (LSB) gets discarded and a zero fills the vacated MSB position. Mathematically this operation shows that the number is divided by 2.

Circular Shift: Circular shift also named as rotate shift circulates the bits among the ends of the register without losing information. We can achieve this by connecting the output terminal to the input terminal of the register. Thus while shift operation (left or right) the data does not get lost. Instead the data moves in a circular fashion. Circular Shift is of two types: Circular Left Shift ( Cil ) Circular Right Shift (Cir)

Circular Left Shift:  Every bit gets shifted towards left. The left most bit (MSB) extracts and gets appended to the LSB position.

C ircular Right Shift:  Every bit gets shifted towards right. The right most bit (LSB) extracts and gets appended to the MSB position.

Arithmetic Shift: In this operation we shift signed binary numbers left or right. For these operations proper care must be taken. For shift left the content of the register is multiplied by 2 whereas For shift right the content of the register is divided by 2. The arithmetic shift must leave the sign bit unchanged. Arithmetic Shift is of two types: Arithmetic Left Shift ( Ashl ) Arithmetic Right Shift ( Ashr )

Arithmetic Left Shift:  Every bit gets shifted towards left. The left most bit (MSB) represents the sign hence it doesn't participate in shifting process normally.

Arithmetic Right Shift:  Every bit gets shifted towards right. The right most bit (LSB) gets lost and the sign bit is copied to the MSB-1 position. Again in this case, the sign bit remains the same.

What are Logic Micro-Operations? Logic Microoperations are a set of binary operations that are performed on registers that contain strings of bits. These operations treat each bit of the register separately and consider them as binary variables. As a result, there are 16 different logic operations that could be performed. These are-

INTERRUPTS

Interrupt  is the mechanism by which modules like I/O or memory may interrupt the normal processing by CPU. It may be either clicking a mouse, dragging a cursor, printing a document etc the case where interrupt is getting generated.

Why we require Interrupt?  External devices are comparatively slower than CPU. So if there is no interrupt CPU would waste a lot of time waiting for external devices to match its speed with that of CPU. This decreases the efficiency of CPU. Hence, interrupt is required to eliminate these limitations.

EXAMPLE With Interrupt: Suppose CPU instructs printer to print a certain document. While printer does its task, CPU engaged in executing other tasks. When printer is done with its given work, it tells CPU that it has done with its work. (The word ‘tells’ here is interrupt which sends one message that printer has done its work successfully.).

Advantages: It increases the efficiency of CPU. It decreases the waiting time of CPU. Stops the wastage of instruction cycle. Enables multitasking by allowing the CPU to quickly switch between different processes. Simplifies input/output (I/O) operations by allowing devices to communicate directly with the CPU.

Disadvantages: CPU has to do a lot of work to handle interrupts, resume its previous execution of programs (in short, overhead required to handle the interrupt request.). Priority inversion can occur when a low-priority task holds a resource needed by a higher-priority task.