Você está na página 1de 34

Microprocessor and Microcontroller

Spring 2013

Lecture 2: Architecture of a Microprocessor


Muhammad Saqib Bhatti

General Architecture of a Microsystem


The hardware of a microcomputer system can be

divided into four functional sections


Input Unit Micro processing Unit Memory Unit

Output Unit

Microprocessor Unit
Microprocessor Unit (MPU) is he heart of a

microcomputer. A microprocessor is a general purpose processing unit built into a single integrated circuit. The Microprocessor is the part of the microcomputer that executes instructions of the program and process data. It is responsible for performing all arithmetic operations and making the logical decisions initiated by the computers program. In addition to arithmetic and logic functions, the MPU controls overall system operation

Input, Output and Memory Unit


Input and Output units are the means by which

the MPU communicates with the outside world


Input Unit: keyboard, mouse, scanner Output mode: monitor, printer atc

Memory Unit:
Primary: is normally smaller in size and is used for

temporary storage of active information. Typically ROM, RAM. Secondary: is normally lager in size and used for long-term storage of information. Like Hard disk, Floppy, CD etc

Architecture
First of all we will se an architecture of a

computer

Von Neumann Architecture


Both data and instructions are stored in the

memory Program = set of instructions The contents are accessed by location n


n is the memory location
Instructions are accessed and executed

sequentially

Architecture
Main difference is CPU is replaced by

microprocessor

There are five main parts in the CPU

Registers 2. ALU 3. TIMING


1.

Control Unit 5. Interfaces Each of these parts would be discussed in further slides
4.

1. Registers
Registers are a temporary location where you can

move a data temporarily Set of flip flops are used store instruction data No. of flip flops depend upon the size of the data, address or instruction stored Most registers are 8-bit registers There are two main types of registers
General purpose registers

Special purpose registers

General purpose registers


It is not used to store a particular type of data

The no of instructions which could be

implemented at a time depends on the no. of general purpose registers The time needed to execute a set of instructions is also decided by the general purpose registers

Special Purpose registers


These register are present for a special purpose
Accumulator :- it is used to store one of the

operands Program Counter :- it keeps address of memory location from which the next instruction will be fetched
Status register (SR): stores basic state of

the

processor Stack register : It is required when a processor comes back from a interrupt state

Atmel Mega8
Status register : Many machine instructions affect

the state of this register

Status Register

Interrupt enable : If 1, the currently executing

program can be interrupted by another event Half carry flag : Set if an arithmetic operation resulted in a carry from the first nybble or bit to the next Twos complement overflow flag :Set if an arithmetic operation resulted in an overflow in twos complement (e.g., incrementing an 8-bit number whose value is 127)

Special Purpose registers


Negative flag : Set if an arithmetic operation

resulted in a negative value Zero flag: Set if an arithmetic operation resulted in a value of zero Carry flag: Set if an arithmetic operation resulted in a carry (with an unsigned value)

Registers

2. ALU
Arithmetic Operations
Addition, subtraction, multiplication, increment and

decrement No division in 8086 microprocessor


Logical Operators
AND, OR, XOR, NOT, CLEAR, COMPARE, SHIFT,

ROTATE operations
typically take multiple clock cycles

Results stored in registers and/or memory

3. Interface
8086 is a 40 pin microprocessor whereas latest

microprocessor have an interface of 256pins Interface can be divided into three main classes or sub-sections
1. Memory , I/O control lines

2. CPU and Bus control lines


3. Utility Lines

Memory I/O control lines


These provide a control interface between I/O,

memory the processor


Read/ Write : either read or write operation with

reference to memory or I/O device IO/M : either you are executing from memory or an I/o device READY/WAIT : incompatibility between memory and microprocessor, used for synchronisation ALE : Address Latch Enable : it tell you either data or an address is being carried out

CPU and Bus control lines


This portion of the interface is to give the control

to the external world


Reset: It resets the microprocessor to the its factory

default state Interrupts Bus request Bus grant lines

Utility Lines
Power supply lines
Vcc or GND Clock Lines Microprocessor is a sequential circuit Crystal is needed to access the clock from the

outside world
X1, X2

I/O Lines
Address lines and Data lines
AD0 AD7 These are multiplexed using time division

multiplexing NMI :- An interrupt which cannot be ignored S0 , S1, S2, S3, S5 = status bits HOLD : direct memory access (DMA)

Timing and Control Unit


It is reckoned as the heart of the CPU

Timing is used to synchronise data or provide a

coordination between all internal sub-systems Control unit controls the information spreading inside the processor It could be hard-wired or micro-programmable

Timing
Clock : There are mainly two type of clock
Single phase clock Two phase clock

Single phase clock

Two phase Clock

Timing
Two phase clock has three states

They are never high at the same time


Time period defines the frequency

T = 1/f Clock could be controlled externally and internally Crystal controls the clock when it is controlled by the outside world

Control unit
Under the control of the clock the instructions are

sequentially fetched, decoded and is executed one after the other within the CPU IC = FC + EC IC = instruction cycle FC = fetch cycle EC = Execution Cycle Execution cycle is variable i.e READ cycle + Write Cycle

Control Unit

Timing diagram

Cont.
T4 used for decoding

Fetch cycle = T1 T3
T1 T4 = one machine cycle

The hardware architecture of 8086 and 8088 processors


The microprocessors 8086 and 8088 were both

made of HMOS technology with an IC circuitry equivalent to ~ 29000 transistors Unlike he software model, the hardware architecture of 8088 microprocessor is different from that of 8086 Both processors are housed in a 40-pin dual inline package, with many of the pins having multiple fictions or multiplexed.

The Modes of Operation


The microprocessors 8086 and 8088 can be

configured to work in two modes: The Minimum mode and the Maximum mode
The minimum mode is used for single processor

system, where 8086/8088 directly generates all the necessary control signals. The Maximum mode is designed for multiprocessor systems, where an additional Bus-controller IC is required to generate the control signals. The processors control the BUS-controller using status codes.

Modes of Microprocessor

Você também pode gostar