microprocessor details 1 updated april 2011 paul r. godin prgodin gmail.com

Post on 18-Jan-2018

219 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

ALU (Arithmetic Logic Unit) 3

TRANSCRIPT

MICROPROCESSOR DETAILS

1

Updated April 2011©Paul R. Godin

prgodin°@ gmail.com

Internal Diagram of a Basic MPU

2

ALU(Arithmetic Logic Unit)

3

ALU• The ALU performs many of the functions that involve

arithmetic and logic operations. – Arithmetic:

• Add• Subtract

– Logic• AND• OR• XOR• Incrementing a number

4

• The basic Arithmetic component can only perform addition, yet it can perform all other operations:

• Subtraction: Adding the 2’s compliment• Multiply: Adding or shifting the value multiple times • Divide: Subtracting or shifting the value multiple times

• The Arithmetic unit also handles all data manipulation, such as shift left/right, rotate, and the 2’s compliment operations.

• All ALU results are stored in a register

Arithmetic

5

Registers

6

Registers

7

Registers

• Data registers are locations where data is stored temporarily within the microprocessor.

• There are a larger number of registers in MPUs, each with a specific function.

• The following slides address the more important registers.

8

Program Counter Register

• The most important of the registers, the program counter is often referred to as the PC.

• The Program Counter controls the sequence in which instructions are performed.

• The count indicates the memory location from which information is to be retrieved.

9

Accumulator Register

• This is one of the most used registers. Often referred to as the A or Acc register.

• It has two main functions:– Hold one of the operands before an arithmetic or a

logic operation.– Stores the results after the operation.

10

Temporary Register

• The temporary register is used to transfer data to the ALU.

• It usually contains the second value required for arithmetic operations.

• It is often called the Data Register.

11

General Purpose Registers• The general purpose registers are used to store various

binary values and can be accessed quickly. In our example the data is 8-bit but addresses are 16-bit. Two registers can be combined to store a 16-bit (address) value.

• These registers are controllable with programming instructions.

12

Stack Register• The stack register is used to temporarily store an

address. Special register used for sub-routines and when processing interrupts.

• Different microprocessors use the stack registers in different manners.

• Sometimes referred to as the Data Pointer.

13

FLAG Register• The FLAG register is used to keep track of specific

results of arithmetic operations.

• This includes:– the sign of a result (S)– whether an overflow occurred (CY)– whether the result was zero (Z)– the parity of the result (P)– the auxiliary carry status (AC)

• Flags are covered in greater detail in another course. 14

Instruction Register• This register stores and provides instructions to the

instruction decoder.

• The instruction decoder examines the code and determines which operation needs to be performed.

15

Index Register• Also known as the incrementer/decrementer register,

used for indexed addressing mode. It modifies the Operand address.

16

Control

17

Control• The control section of the MPU is responsible for:

– Timing of all components (within and outside the microprocessor)

– Clock input– Input and Output traffic flow– External inputs (for example, reset)– Outputs (for example, status)

• The control section ensures the proper traffic flow on all buses (not all control lines are shown on diagram).

18

Reset In operation• The RESET is an externally applied control signal

that stops all operation of the microprocessor, and forces the program counter to return to the start (often all zero’s).

• This causes the program execution to restart at the first memory location.

19

ALE• The Address Latch Enable is a control signal used

with MPUs that have multiplexed address outputs.

• It indicates the moment when the lower address is contained on the multiplexed address bus (as opposed to the data).

• An ALE pulse is generated at the beginning of every machine cycle. The negative edge latches the address in our example.

20

Interrupt• The microprocessor can be interrupted from its normal

operations to execute instructions from another memory location.

• There are several interrupt inputs, with each having a priority setting and a restart address.

• The table on the following page an example of the priority of the interrupts and restarts.

21

Interrupt Priority Example

Interrupt Table for the 8085 Microprocessor 22

Interrupt (INTR)• Interrupts allows the microprocessor to run a sub-

routine, or a different set of instruction.

• The PC value is pushed to the Stack register

• When the sub-routine is done, the program continues from where it left off (from the PC).

23

TRAP• The TRAP command is the highest level interrupt.

• TRAP causes the CPU to execute the command located at a specific memory location.

• Typically, TRAP is used for urgent request. For instance, a shut-down routine.

24

END of Part 2

©Paul R. Godinprgodin°@ gmail.com

top related