Microprocessor systems (4)

26
Microprocessor Microprocessor System System Engr. Shafiullah Soomro Engr. Shafiullah Soomro

Transcript of Microprocessor systems (4)

Page 1: Microprocessor systems (4)

Microprocessor Microprocessor SystemSystem

Engr. Shafiullah SoomroEngr. Shafiullah Soomro

Page 2: Microprocessor systems (4)

ReviewReview

Computer?Computer? Input=>Process=>Output, StorageInput=>Process=>Output, Storage Generations of ComputerGenerations of Computer

Page 3: Microprocessor systems (4)

ReviewReview

Processing Devices

Page 4: Microprocessor systems (4)

SESSION NO.2SESSION NO.2

Introduction to Introduction to MicroprocessorMicroprocessorSimplified CPU Organization

Bus System

Fetch Execute Cycle

Page 5: Microprocessor systems (4)

What is Microprocessor?What is Microprocessor? A microprocessor incorporates most or all of the A microprocessor incorporates most or all of the

functions of a computer's central processing unit functions of a computer's central processing unit (CPU) on a single integrated circuit (IC, or (CPU) on a single integrated circuit (IC, or microchip) microchip)

A silicon chip that contains a CPU. In the world A silicon chip that contains a CPU. In the world of personal computers, the terms of personal computers, the terms microprocessormicroprocessor and CPU are used interchangeably. It is the heart and CPU are used interchangeably. It is the heart of computerof computer

A microprocessor, sometimes called a A microprocessor, sometimes called a logic chiplogic chip, , is a computer processor on a microchip. The is a computer processor on a microchip. The microprocessor contains all, or most of, the microprocessor contains all, or most of, the central processing unit (CPU) functionscentral processing unit (CPU) functions

Page 6: Microprocessor systems (4)

John von Neumann Model for Digital John von Neumann Model for Digital ComputerComputer

a design model for a stored-program digital computer that uses a central processing unit (CPU) and a single separate storage structure ("memory") to hold both instructions and data.

Page 7: Microprocessor systems (4)

MicrocomputerMicrocomputer What is a microcomputer? What is a microcomputer? Ans. A microcomputer is a system Ans. A microcomputer is a system

which is capable of processing a which is capable of processing a stream of input informations and stream of input informations and will generate a stream of output will generate a stream of output informations taking the help of a informations taking the help of a program which is stored in the program which is stored in the memory of the system. memory of the system.

Called “Micro” because of its small Called “Micro” because of its small size and low costsize and low cost

Contains Five Element:Contains Five Element:

1. Input Unit1. Input Unit2. Control Unit (in CPU)2. Control Unit (in CPU)3. Arthmetic Unit (in CPU)3. Arthmetic Unit (in CPU)4. Memory (RAM, ROM)4. Memory (RAM, ROM)5. Output Unit5. Output Unit

Page 8: Microprocessor systems (4)

Typical Microcomputer Typical Microcomputer OperationOperation

Fig from book page 5

Page 9: Microprocessor systems (4)

Practical ApproachPractical Approach

Page 10: Microprocessor systems (4)

Instruction?Instruction?

What is meant by instruction? Ans: An instruction is a command which asks the microprocessor to perform a specific task or job.

Practical Example:

Kill the enemy

Mathametical Example:

2 + 4 = ?

Operation / Operational Code (Op-Code)

Operand / Data

Page 11: Microprocessor systems (4)

Program?Program?

Series or Collection of InstructionsSeries or Collection of Instructions

Practical Example:

Program for making a Coffee???

Mathematical Example:

Let A = 10

Let B = 5

C = A + 2

D= C + B

Print D

Page 12: Microprocessor systems (4)

Computer Programming Computer Programming LanguagesLanguages

Low Level / Machine LanguageLow Level / Machine Language Assembly LanguageAssembly Language High level LanguageHigh level Language

10110100

11011101

11110110

11001010

01011100

MOVE AX, 2

MOVE BX, 4

ADD AX,BX

STA AX, 10BH

Let A = 2

Let B = 4

A = A+B

Print A

Page 13: Microprocessor systems (4)

Programming LanguagesProgramming LanguagesWhat is machine language programming? Ans. Programming a computer by utilizing hex or binary code is known as machine language programming.

What is meant by assembly language programming? Ans. Programming a microcomputer by writing mnemonics is known as assembly language programming. Assembly is Machine dependent language

What are meant by low level and high level languages? Ans. Programming languages that are closer to natural languages, these languages are machine independent, also called high level languages. Examples are BASIC, FORTRAN, C, ALGOL, COBOL, etc.

Page 14: Microprocessor systems (4)

What is mnemonic?What is mnemonic? It is very difficult to understand a program if it is It is very difficult to understand a program if it is

written in either binary or hex code. Thus the written in either binary or hex code. Thus the manufacturers have devised a symbolic code for manufacturers have devised a symbolic code for each instruction, called a mnemonic. each instruction, called a mnemonic.

In assembly language a mnemonic is a code, In assembly language a mnemonic is a code, usually from 1 to 5 letters, that represents an usually from 1 to 5 letters, that represents an opcode, followed by one or more numbers (the opcode, followed by one or more numbers (the operands). operands).

Examples of mnemonics are: Examples of mnemonics are: INR A, ADD M, etc.INR A, ADD M, etc.

Page 15: Microprocessor systems (4)

TranslatorsTranslators InterpreterInterpreter

Translate the program into Machine language code Translate the program into Machine language code line by lineline by line

CompilerCompiler

Translate the whole program at once into machine Translate the whole program at once into machine language codelanguage code

AssemblerAssembler

Special translator used for translating the Assembly Special translator used for translating the Assembly language program into Machine Language codelanguage program into Machine Language code

Page 16: Microprocessor systems (4)

Bus SystemBus System

Note: You can also use fig:1-2 on page 3 (typical microcomputer organization) of book Microprocessor Fundamentals by Roger Tokhiem, to understand bus system

Page 17: Microprocessor systems (4)

Bus System DescriptionBus System Description A bus is a bunch of wires through which data or address or A bus is a bunch of wires through which data or address or

control signals flow. control signals flow.

The MPU communicates with memory and I/O using the system The MPU communicates with memory and I/O using the system bus consisting of:bus consisting of:

Address Bus:Address Bus: unidirectional and carries memory and I/O unidirectional and carries memory and I/O addresses (From where the Data will come or to where the addresses (From where the Data will come or to where the Data would go?)Data would go?)

Data Bus:Data Bus: bidirectional; transfers binary data and bidirectional; transfers binary data and instructions between MPU and memory and I/O (Who will instructions between MPU and memory and I/O (Who will bring the data to and from?)bring the data to and from?)

Control lines:Control lines: Read and Write timing signals asserted by Read and Write timing signals asserted by MPU (What to do with Data?)MPU (What to do with Data?)

Page 18: Microprocessor systems (4)

Inside Inside CPU/MicroprocessorCPU/Microprocessor

Fig from Page 72

Simplified CPU Organization

Page 19: Microprocessor systems (4)

Inside ALUInside ALU

Page 20: Microprocessor systems (4)

Description of Description of Simplified CPU Organization

Accumulator: Its is the general purpose register(s) associated with the ALU operations and sometimes I/O operations.

Temporary Register: It is also a general purpose register, use with Accumulator to perform ALU operations

Program Counter: It holds the address of the next instruction to be fetched from the memory.

Airthmetic Logic Unit: Performs all calculations of CPU using Adder & Shifter and results are sent back to Accumulator and it also expresses status or conditions (if occur) in result of operation through Status Register.

Instruction Register: holds the instruction (op-code)

Instruction Decoder: it translates the instruction that is in Instruction Register

Timming and Control Section: most complex section of CPU, It affects and sequences all events within the CPU

Page 21: Microprocessor systems (4)

Description of Description of Simplified CPU Organization

Primary Function of the CPU of a microcomputer:

1. Fetch, decode and execute program instructions in proper order

2. Transfer data to and from memory and to and from input/output sections

3. Respond to external interrupts

4. Provide overall timming and control signals for entire system

Page 22: Microprocessor systems (4)

Fetch Execute CycleFetch Execute Cycle

Computer Memory Addressing

Page 23: Microprocessor systems (4)

Fetch Execute CycleFetch Execute Cycle

Page 24: Microprocessor systems (4)

Fetch Execute CycleFetch Execute Cycle

Page 25: Microprocessor systems (4)

Bit Size/Word SizeBit Size/Word Size of of MicroprocessorMicroprocessor

It is the width of accumulator.It is the width of accumulator. Microprocessors are commonly Microprocessors are commonly

classified as 4-bit, 8-bit, 16-bit or 32-classified as 4-bit, 8-bit, 16-bit or 32-bit units.bit units.

8080/8085, 6800, 6502 and Z80 are 8080/8085, 6800, 6502 and Z80 are common 8-bit microprocessorscommon 8-bit microprocessors

8086, 8088, 68000, 65816 and Z8000 8086, 8088, 68000, 65816 and Z8000 are typical 16-bit microprocessorsare typical 16-bit microprocessors

80386, 68020, 32000 and Z-80000 are 80386, 68020, 32000 and Z-80000 are examples of 32-bit microprocessorexamples of 32-bit microprocessor

Page 26: Microprocessor systems (4)

End of Session no. 2End of Session no. 2