Monday 15 August 2016

The Execution Unit

8086 Internal Architecture

Control Circuitry, Instruction Decoder And ALU

- The Execution Unit (EU) contains circuitry which directs internal operations.

- A decoder in the EU translates instructions fetched from memory into a series of actions which the EU carries out.

- The EU has AND, OR, XOR, increment, decrement, complement or shift binary numbers.

Flag Register

- A flag is a flip-flop which indicates some condition produced by the EU of an instruction or controls certain operations of the EU.

- A 16-bit flag register in the EU contains 9 active flags.

- 6 of 9 flags are used to indicate some condition produced by an instruction.

- The six additional flags in this group are:-
  + Carry Flag (CF)
  + Parity Flag (PF)
  + Auxiliary Carry Flag (AF)
  + Zero Flag (ZF)
  + Sign Flag (SF)
  + Overflow flag (OF)

- The 3 other flags in the flag register are used to control certain operations of the processor.
These flags are different from six conditional flags described above in the way they are set or reset.

- The six conditional flags are set or reset by the EU on the basis of the results of some arithmetic or logic operation.

- The control flag is deliberately set or reset with specific instructions you put in your program.

- The 3 control flags are:-
   + Trap Flag (TF): which is used for single stepping through a program.
   + Intrupt Flag (IF): which is used to allow or prohibit the intruption of a program; and
   + Direction Flag (DF): which is used with string instructions.

General Purpose Registers

- EU has 8 general purpose registers, labelled AH, AL, BH, BL, CH, CL, DH and DL.

- These registers can be used individually for storage of 8-bit data.

- AL register is also called ACCUMULATOR.

- Certain pairs of general purpose registers can be used together to store 16-bit data words. Eg: AH & AL, BH & BL, CH & CL, DH & DL.

- AH & AL pair is reffered as AX register. Similarly, BH & BL pair is reffered as BX; CH & CL pair is reffered as CX; DH & DL is reffered as DX register.

- The 8086 general purpose register set was designed this way so that many programs written for 8080 and 8085 microprocessor could easily be translated to run on the 8086.

- The advantage of using internal registers for the temporary storage of data is that, since data is already in EU, it can be accessed much more quickly than it could be accessed from external memory.

8086 Flag Register Format


- Carry Flag- Set(1) by carry out of Most Significant Bit.

- Parity flag- Parity is a term used to indicate whether a binary word has an even number of 1(s) or an odd number of 1(s). A binary number with an even number of 1(s) is said to have even parity.

- Auxiliary Flag- It has significance in BCD addition or BCD addition or BCD subtraction. If a carry is produced when the least significant nibbles of 2 bytes are added, the flag will be Set. If subtraction of least significant nibbles requires a borrow then the auxiliary carry/borrow flag will be set.

- Zero Flag- It is set to 1 if the result of an arithmetic/logic operation is zero.

- Sign Flag- The sign flag is a copy of MSB of the destination byte or the destination word. Here, 0 is for positive and 1 is for negative. This flag can be used to determine whether an operand has been decremented beyond zero.

- Trap Flag- single step trap flag.

- Interrupt Enable Flag- Enabled/Disabled based on the Intrupt acceptation state.

- Direction Flag- Used for Strings

- Overflow Flag- This flag will be set if the result of a signed operation is too large to fit in the number of bits available to represent it.

No comments:

Post a Comment