INTRODUCTION TO MICROPROCESSORS
Compiled by: Seble N. What is Microprocessor?
2
Intel coined the term in 1971
usually made of millions of microscopic array of electronic circuits and electronic components (resistors, capacitors, inductors…) are diffused or implanted to surface of small silicon chip
its basic function is to take input, process it and then provide appropriate output
Examples Pentium, AMD , a PowerPC, a Sun-SPARC or any of the many other brands and types of microprocessors Function of microprocessors
3
A microprocessor performs three basic steps:
First, it fetches an instruction from memory,
Second, it uses decoding circuitry to determine what the instruction means (i.e., identify the operations and the devices involved in it) and
Third, it executes the instruction
Components of microprocessor
4 ALU (Arithmetic/Logic Unit)
performs all arithmetic and logic operations
Control Unit
holds the circuitry that controls the process of executing, decoding and fetching program instructions it controls the flow of data between the μ-processor and memory & peripherals it controls the operation of ALU, I/O devices, and memory unit
Registers
A register is a very small & very fast memory that is built into the CPU in order to store the current data and instructions which are being executed by the CPU Modes of Processing
5
One program at a time
Can run more than one program concurrently and protect them from each other
Virtual Mode
The processor can swap portion of the memory to the hard disk; in this way programs running concurrently will have more space to operate
Characteristics of microprocessors
6
Instruction set the set of instructions that a microprocessor can understand or execute
Word length refers to the number of bits a processor can process at a time Eg. a 4-bit processor means the ALU can perform a 4-bit data operation at a time the longer the word length is the more powerful the processor is and can process data at a faster speed as compared to processor with shorter word length Characteristics of microprocessors
7
Speed
measured in HZ = 1cycle/second
Some processors may complete a single instruction per cycle, or may take one or more cycles
a 2 GHZ CPU may compute 2 billion instructions per second, if it is able to complete a single instruction in a single cycle
but if it takes 2 cycles to complete a single instruction then it is only able to compute 1 billion instructions per second
Cache Size
The size of the cache memory Characteristics of microprocessors …
8
Size of registers
refers to the number of bits a microprocessor’s register can hold at a time
the size of addressable memory is often determined by the width of registers
Data bus width
Refers to the number of bits a data bus can carry at a time Classes of microprocessors
9
Complex instruction set computer (CISC)
Reduced instruction set computer (RISC)
Application Specific Integrated Circuit (ASIC)
Digital Signal Multiprocessors (DSP)
Superscalar Microprocessors Classes of microprocessors …
10
Complex instruction set computer (CISC)
is more complex and has the ability to perform complex commands
it allows the user to apply 1 instruction as an alternative to many simple instructions
can perform complex functions with one instruction
Ex: Intel’s Pentium and Atom chips
Classes of microprocessors …
11
Reduced instruction set computer (RISC)
are made according to the function in which the microprocessor can carry out small things in specific command
In this way these processors completes more commands at a faster rate
is simpler, smaller and faster
usually need multiple instructions
Ex: PowerPC and ARM's Cortex chips Evolution of Microprocessors
12
Computing technologies based on vacuum tubes and transistors
In 1959, Fair child semiconductors invented the first integrated circuit
In 1968, Gordan Moore, Robert Noyce & Andrew Grove founded Intel(Integrated Electronics)
In 1971, the first microprocessor, Intel 4004 was released
In 1972, Intel released the first 8-bit microprocessor Intel 8008
In 1976, MOS technologies introduced the Motorola 6502 an 8-bit processor, used in Apple I and II
In 1981, the first PC was created by IBM using intel’s 8088 microprocessor
Several companies like Intel, AMD, IBM, ARM, PowerPC, Motorola… make general purpose processors that are designed for personal computers, laptops, mobile devices and large central servers Evolution of microprocessors
13
Intel
is generally regarded as the company that sets the benchmark for others to follow
From the earlier Pentium and Centrino microprocessors to the Core 2, Core i series
Atom chips for mobiles
The high-end Itanium and Xeon processors for server applications
Over 90% of laptops use Intel microprocessors HP, Dell, Apple, Samsung, Sony, Toshiba …
Top CPU manufacturers
14
Intel AMD Qualcomm Mediatek NVIDIA IBM Samsung Motorola Hewlett-Packard (hp) Dell Acer … Intel microprocessors
15
Intel 4004 Intel 8080 Intel 8085 Intel 8088 Intel 8086 Intel 80286 Intel 80386 Intel 80486 Pentium Pentium II and III Dual Core/ Core Core i3, i5, i7 Intel microprocessors … 4-bits processors 16
Intel 4004
1971- the first commercially available processor as well as the first complete CPU on a single chip
a 4-bit processor: able to operate on 4 bits of data at a time
4-bit data bus
had 2,300 transistors
clock speed of 108KHZ
640 bytes addressable memory
was designed for use in calculator but also used In traffic light controller, Blood analyzers, and even in the NASA pioneer 10 deep space probe Intel microprocessors … 8-bits processors 17
Intel 8008
first 8-bit microprocessor
200KHz clock speed and 3,500 transistors,
had 6 , 8-bit registers
8-bit data bus
can address up to 16KB
Intel 8080
1974 with 4,500 transistors with up to 2-3MHz
can address up to 64KB
became famous for being used in the Altair 8800 as well as in Boeing's AGM- 86 cruise missile
Intel 8085
was popular as an embedded controller
ran at 5MHZ and contained 6500 transistors Intel microprocessors … 16-bits processors 18 Intel 8086
1978, first x86 family microprocessor
16-bit: all registers, internal and external buses
Used 20-bit addressing
Can address 1 million bytes of internal memory
29,000 transistors, 5MHz initially
Intel 8088
was identical to the 8086 with the exception of its 8-bit internal bus
The IBM 5150, the first IBM PC, came with the 8088 Intel microprocessors … 16-bits processors 19
Intel 80286
can operate on real and protected mode
134,000 transistors, 6M-8MHz initially
runs faster than the preceding processors
can address up to 16 million bytes of internal memory
was popular in IBM-PC AT and AT PC clones
Intel microprocessors … 32-bits processors 20
Intel 80386
the first 32-bit microprocessor
32 bit registers & data bus
can operate on protected mode and supports virtual mode
275,000 transistors
12MHz initially, later 33MHz
Andy Grove decided to single-source producing 386 to AMD Later changed in 1991 by AMD AM386 Intel microprocessors … 32-bits processors 22
Pentium (Pentium I)
32 bit registers
64 bit data bus
Has a high speed cache memory
It can execute more than one instruction per clock cycle
Pentium II and III
Have a dual independent bus that provides separate path to the system cache and memory
On-die L2 cache
Intel microprocessors … 64-bits processors 23
New instruction set, not at all related to x86.
Itanium Released May 29, 2001 733 MHz to 800 MHz 2MB cache
Itanium 2 Released July 2002 900 MHz – 1.6 GHz
Intel microprocessors … 64-bits processors 24
Intel core 2 x86-64 microprocessor Two cores on one die Number of transistors: 291 million 64 KB of L1 cache per core 1.86-3.00 GHz
Intel core i series Intel core i3, i5, i7
Intel microprocessors …
25 What is an x86 architecture?
26
x86 is a family of backward compatible instruction set architectures based on the Intel 8086 CPU and its Intel 8088 variant
the term "x86" came into being because the names of several successors to Intel's 8086 processor end in "86", including the 80186, 80286, 80386 and 80486 processors
all newer processors using Intel's x86 instruction set are still referred to as x86, i386, or i686 compatible (which means they all use extensions of the original 8086 instruction set) Intel 8086
27
1978, first x86 family microprocessor
16-bit: all registers, internal and external buses
a CISC processor
can address 1 million bytes of internal memory
used 20-bit addressing
to date backward compatibility has been maintained
8086 Microprocessor Architecture
28
The Basic Architecture of the Intel 8086
The processor is partitioned into two logical units
Execution Unit (EU)
Bus Interface Unit(BIU)
Why partition is needed?
Because the processor runs considerably faster than memory
Architecture of 8086
29
Execution Unit
30
takes care of the processing including arithmetic and logic operations
its role is to execute instructions
Contains
ALU,
Control Unit and
Registers
Bus Interface Unit (BIU)
31
Its role is to deliver instructions and data to the EU
Function
to manage the bus control unit, segment registers and instruction queue
to provide access to instructions from memory and place them in an instruction queue, which varies in size depending on the processor
This feature enables the BIU to look ahead and prefetch instructions so that there is always a queue of instructions ready to execute Internal Memory of 8086
32
Memory consists of cells organized in 8-bit groups
Bytes in memory are numbered consecutively, beginning with 00
8086
was able to address 1MB of memory
has 20bits wide memory address
Intel 8086- Memory
33
RAM
From the 1MB of memory, the first 640K is base RAM
is used for temporary program storage
ROM
The 8086 Basic Input/Output System (BIOS) begins at address 768K and handles I/O devices, such as a hard disk controller
ROM beginning at 960K controls the computer’s basic functions Power-On Self-Test, dot patterns for graphics, and the disk self-loader
Memory Segments
34
Memory segmentation is the division of computer's primary memory into segments or sections
Segments are special areas defined in a program for containing the code, the data, and what is known as the stack
A segment begins on a paragraph boundary, that is, at a location evenly divisible by 16, or hex 10.
Memory Segments …
35 In real mode, the three main segments are code, data, and stack
Code Segment: Contains the machine instructions to be executed The first executable instruction is at the start of this segment, and the operating system links to that location to begin program execution Data Segment: Contains a program’s defined data, constants, and work areas Stack Segment: Contains any data and addresses that the program needs to save temporarily for use on subroutines
A program may contain one or more segments, which may vary in size, and can be defined in any sequence 8086/8088 Registers
36
The registers are categorized into two sets:
Data registers
are for calculations
Address registers
used to store memory addresses that point to locations in memory where data will be retrieved or stored
8086/8088 Data Registers
37 aka general purpose registers, these are
AX - Accumulator register BX - Base register CX - Counter register DX - Data register
each are 16-bit long and can also be accessed as two 8-bit registers AX AH & AL BX BH & BL CX CH & CL DX DH & DL
The 80386 introduced an extended 32-bit general purpose registers named EAX, EBX, ECX and EDX
8086/8088 Data Registers
38
AX register is used for operations involving input/output and arithmetic
BX register given the name base register because it is the only general purpose register that can be used as an index in indirect addressing can also be used for computations
CX register usually used to control the number of times a loop is repeated or a value to shift bits left or right in bit shifting operations can also be used for computations
DX register is used for operations involving input/output and most arithmetic 8086/8088 Address Registers
39 Segment registers: used to store starting address of memory segments
Code Segment register
Data Segment register
Stack Segment register
Extra Segment register
Index registers: used for indexed addressing and string operations
Source Index register
Destination Index register
Pointer registers: used to store offset address within memory segments
Instruction Pointer register
Stack Pointer register
Base Pointer register
All the above address registers are 16-bit long in 8086/8088 8086/8088 Segment Registers
40
CS register: used to hold starting address of program’s code segment
DS register: used to hold starting address of program’s data segment
SS register: used to hold starting address of program’s stack segment
ES register: used to hold starting address of programmers defined extra data segment
FS and GS registers: additional extra segment registers introduced by the 80386 8086/8088 Pointer Registers
41
IP (Instruction Pointer) register
used to locate a specific location within the code segment
used to hold offset address of the next instruction to be executed
SP (Stack Pointer) register
used to hold offset address of the top of the stack segment
points to the current word being processed in the stack
BP (Base Pointer) register
used to point to a specific location in the stack 8086/8088 Index Registers
42
SI (Source Index) & DI (Destination Index) registers
are used to locate a specific location within the data segment
both are used in string handling operations. In this context, SI is associated with the DS register while DI is associated with the ES register
Flags Register
43
Is the status register in Intel x86 microprocessors that shows the current state of the processor
In 8086 flags register is 16 bits wide, among which 9 are active
They are modified automatically by the processor after instruction execution, which allows to determine the type of the result and also conditions to transfer control to other parts of the program Flags Register …
44
The flags bits has two groups Status flags: reflect the result of an operation executed by the processor SF, ZF, AF, CF, PF & OF Control flags: enable or disable certain operations of the processor Trap flag (TF) Interrupt flag (IF) Direction flag (DF)
Flags Register: control flags
45
The Trap Flag Permits operation of the processor in single-step mode Setting TF (TF=1) puts the processor into single step mode for debugging, where the processor automatically generates an internal interrupt after each instruction, allowing a program to be inspected as it executes instruction by instruction
The Interrupt Flag Indicates that external interrupts, such as keyboard entry, are to be processed or ignored Clearing IF (IF=0) disables interrupts
The Direction Flag Determines left or right direction for moving or comparing string (character) data If DF=1, the string instruction will automatically decrement the pointer Flags Register: Status Flags
46
SF (Sign): Indicates the resulting sign of an arithmetic operation (0 = positive and 1 = negative)
ZF (Zero): Indicates the result of an arithmetic or comparison operation (0 = nonzero and 1 = zero result)
PF (Parity): indicates the number of 1-bits that result from an operation. (0=even parity and 1 = odd parity)
AF (Auxiliary Carry): contains a carry out of bit 3 into bit 4 in an arithmetic operation OF (Overflow): indicates overflow of a high-order(leftmost) bit following in a signed arithmetic operation
CF(Carry): contains carries from a high-order bit following an unsigned arithmetic operation; also contains the contents of the last bit of a shift or rotate operation