• No results found

THE EXECUTION UNIT

In document Lyla b das 0 & 1.pdf (Page 32-36)

THE ARCHITECTURE OF 8086

1.2 THE EXECUTION UNIT

Fig 1.1 a Internal block diagram of the 8086 (simplified model)

The 8086 processor is a 16 bit processor internally as well as externally –which means that its data bus width as well as the bit size of its internal data registers is 16 .Thus it can access an external source 16 bits at a time through its data bus. . But it also has the capability to access and work on 8 bit (byte) data.

As the first step in understanding the architecture of the 8086 ,let us examine the internal block diagram of the 8086 . Fig 1-1a shows the simplified block diagram and Fig 1-1b show the detailed one . Go through the simplified one first .Though not specifically shown in the block diagram ,it is to be noted that all actions in the processor are synchronized by a system clock ,which provides the basic timing .There is a control unit which provides the control signals for the overall functioning of the processor.

We see that the internal block diagram has been partitioned into two logical units ,namely the Bus Interface Unit (BIU) and the Execution Unit .

They interact directly with each other through the internal bus ,but perform separately as two units with well defined functions for each unit. Let us explore the internal configuration of these units, one by one.

1.2 THE EXECUTION UNIT

It contains the arithmetic and logic unit ,the control unit ,an internal bus ,plus a few registers. Let us get a bird’s eye view of the EU starting with the register set.

Why Registers?

All processors have internal registers ,which is actually on-chip RAM.

Some are program visible ,while others are not directly visible to programmers.

The more the number of program visible registers ,the better it is for the programmer .This is because internal registers are used as temporary storage for operands ,and if the operand is already in a register ,it takes less time for execution of the associated instruction. Such registers are called general purpose or scratch pad registers . But registers constitute on chip RAM ,which is costly.

Also ,more the number of registers, more are the number of bits required to identify and address a particular register. This can cause an increase in the length of opcodes in modes involving registers. . Thus the number of registers a processor can have is a trade off between a number of conflicting factors..

x86 Chapter 1 Page 3 Fig 1.1b

Internal Block diagram of the 8086 (detailed)

Register Set of 8086

Let us see how the register set of 8086 has been organized.

The 8086 has data registers, address registers segment registers and also a flag registers.

We will first examine the registers in the Execution Unit.

x86 Chapter 1 Page 4 Fig 1.2 Register model of the 8086

x86 Chapter 1 Page 5

1.2.1 The Scratch Pad Registers

They are called so as they are used for temporary storage ,just as we jot down a few things temporarily in a scratch pad.

As shown in Fig1.2,,the 8086 has four 16 bit general purpose registers labeled as AX,BX, CX and DX. Each of these registers can also be used as two separate and exclusive 8 bit registers also .i.e AX has two parts AH and AL , where H and L stands for the high and low portions respectively When used as 8 bit registers , AH and AL are separate ,but they can be concatenated to form the 16 bit register AX. Similar is the case for the registers BX ,CX and DX. Each register ,while being general purpose ,has specialized uses as well .As such ,let us understand these features clearly,

AX

This is a 16 bit data register ,but can also be used as two unrelated 8 bit registers AH and AL . AL/AX is sometimes called the accumulator ,but the relevance of the accumulator is less for 8086 compared to the earlier 8085 in which one operand is implied to be in the A register for many instructions.However , for the 8086 ,only for certain specialized instructions is the AL or AX register implied to contain one of the operands .In most other instructions ,the source and destination must be specifically mentioned in the instruction. (The destination is the register or memory location in which the result of any operation is to be put )

BX,CX and DX

These are the other working registers of the 8086 ,which means that temporary data storage ,arithmetic calculations ,data manipulation etc can be done with these registers .They also can be used as 8 bit or 16 bit registers as mentioned earlier . Still, each of them has special functions .

Base register BX is frequently used as an address register in many based addressing modes. Counting register CX is used as a counter in many instructions .

Data register DX is used in I/O instructions as a pointer to data by storing the address of the I/O port . .Also, multiply and divide operations involving large numbers assume DX and AX as a pair.

Pointer and Index Registers

SP,BP ,SI and DI are address registers, and can be used only as 16 bit registers.

They are very important in programming ,as they facilitate the use of various addressing modes.

BP and SP

They are the Base pointer and Stack pointer respectively .

SP always points to the top of the stack ,while BP can point to any location in the stack . (We will discuss the concept of the stack shortly).Thus normally ,whenever we refer to data referred to by BP and SP , it is implied that we are talking about data in the stack.

SI and DI

These are Index registers ,labeled as Source Index and Destination Index respectively They function as address registers in various addressing modes ,but they have a specialized function as being the default registers in string instructions .

x86 Chapter 1 Page 6 1.2.2 FLAG REGISTER

It is a 16 bit register ,of which 7 bits are unused .Out of the remaining bits , 6 bits are used as conditional flags .The others are control .flags.

D15 D14 D13 D12 D11 D10 D9 D 8 D7 D6 D5 D4 D3 D2 D1 D0

U U U U OF DF IF TF SF ZF U AF U PF U CF

U=unused

In document Lyla b das 0 & 1.pdf (Page 32-36)

Related documents