Lecture 1 - Architecture of Microprocessor
Lecture 1 - Architecture of Microprocessor
Mechanical Age
UCCE2043 Basic Microprocessor
Charles Babbage was the pioneer of mechanical
computing machinery
Architecture of Analytical Engine in 1832
Assisted by Augusta Ada King
Microprocessor Steam powered, 50 000
components
Input via punch cards,
H Y Lee control unit, memory unit
[email protected] to calculate a series of numerical
values and automatically print the results.
1 2
6 μm
Microprocessor
Intel 8080 4,500 1974 Intel 20 mm²
RCA 1802 5,000 1974 RCA 5 μm 27 mm²
Intel 8085 6,500 1976 Intel 3 μm 20 mm²
Date of Date of
Processor Transistor count Manufacturer Process Area Processor Transistor count Manufacturer Process Area
introduction introduction
Pentium 3,100,000 1993 Intel 0.8 µm Itanium 2 220,000,000 2003 Intel 130 nm
Pentium II 7,500,000 1997 Intel 0.35 µm Core 2 Duo 291,000,000 2006 Intel 65 nm
AMD K6 8,800,000 1997 AMD 0.35 µm AMD K10 463,000,000 2007 AMD 65 nm
Pentium III 9,500,000 1999 Intel 0.25 µm AMD K10 758,000,000 2008 AMD 45 nm
AMD K6-III 21,300,000 1999 AMD 0.25 µm Itanium 2 with 9MB cache 592,000,000 2004 Intel 130 nm
Pentium 4 42,000,000 2000 Intel 180 nm Six-Core Opteron 2400 904,000,000 2009 AMD 45 nm
AMD K8 105,900,000 2003 AMD 130 nm Dual-Core Itanium 2 1,700,000,000[3] 2006 Intel 90 nm 596 mm²
7 8
Date of
Processor Transistor count Manufacturer Process Area
introduction
9 10
11 12
Integration example: Processors
Power consumption
Power Density Off Chip Cache:
(W/cm2) Sun’s Surface 82395 DX
10,000
Rocket Nozzle
1,000
Nuclear Reactor
100 387
Math Coprocessor
17 18
Processor Specifications –
The Address Bus
Architectures -I
Harvard architecture - separate data and
instruction busses, allowing transfers to be
performed simultaneously on both busses.
Von Neumann architecture - only one bus
which is used for both data transfers and
instruction fetches, and therefore data transfers
and instruction fetches must be scheduled - they
can not be performed at the same time
19 20
Architectures -II Block diagram of a Computer
System
Address Bus
I/O
MAIN
DEVICES
MEMORY
(Ports)
MPU
Data Bus
21 22
General
Registers
MPU vs MCU
DETAIL Program Counter
Stack Pointer
Micro-processor (MPU, μP)
OVERVIEW CPU alone
may contain some memory
External Data Bus
Instruction
classified by data path width 4, 8, 16, 32 or 64 bits
Register
Accumulator Temp Reg
Instruction
Decoder
Micro-controller (MCU)
C
Z
microprocessor plus peripherals on a single chip
N one chip computer system
ALU
RESET additional peripherals may be interfaced separately
Clock
Control Unit
Ex: 8051
Similarities Differences
Architecture of the 8088 = 8086: 16-bit external data bus in 8086, 8-bit external data
16-bit registers, 16-bit internal data bus and 20-bit address bus in 8088
bus, (address up to 1 MB of memory).
instruction queue size (8088 - 4 bytes long 8086-6
8088 had the same segmented memory addressing as the
8086: the processor could address 64 KB of memory directly,
bytes) and prefetching algorithms were changed
and to address more than 64 KB of memory one of special 8088 used two consecutive bus cycles to write or read
segment registers had to be updated. 16 bit data instead of one cycle for the 8086.
run slower, but on the hardware changes in the 8088
CPU made it compatible with 8080/8085 peripherals.
25 26
Fetch-Decode-Execute Fetch
Address Bus Address Bus Address Bus
Address
111
111 110
Instruction Pointer
Memory
Program Program Program
MPU MPU MPU
Memory Memory Memory Control
CPU Data
Data Bus Data Bus Data Bus
64
Instruction Register
27 28
8088 CPU Functional Block (Courtesy Intel Corporation)
Decode-Execute
Address
111 111
Instruction Pointer
Memory
Control
CPU Data
Increment
64
Accumulator
Instruction Register
7
8 I/O
Accumulator
29 30
The Sequence
BIU outputs the contents of the IP into the address bus,
causing the selected byte or word to be read into the BIU.
Functions of BIU
Interface to the external world
Responsible for all external bus operations.
IP +1 to prepare for the next instruction fetch Instruction fetching (reading) from primary memory.
R/W of data operand from/to primary memory.
I/O of data from/to peripheral ports.
Inside BIU, the instruction is passed to the queue
Address generation for memory reference (Or formation of a 20-bits RAM
address from the contents of a segment base registers and offset register,
later).
Assuming that the queue is initially empty, the EU Prefetch instructions for the instructions stream queue. It is called
immediately draws this instruction from the queue and pipelined architecture.
begins execution
Contents of BIU
While the EU is executing this instruction, the BIU proceeds 4-segment registers (CS, DS, SS and ES) - to be discussed later
to fetch a new instruction. An instruction pointer register (IP).
Address generation and bus control.
Instruction queue (FIFO)-pipeline.
31 32
Functions of EU Simple operation (1)
Responsible for decoding and execution of the Simple CPUs perform one action at a time.
instructions.
Accesses data from the general purpose register Example instruction sequence
Write to memory
Check and update control flags - to be discussed later Register operation
Commands BIU for memory & I/O operations Read from memory
Has the following units: CPU:
ALU. Fetch Execute Write Fetch Execute Fetch Execute Read
Status and control flags.
General purpose registers (AX, BX, CX, DX, etc).
Bus:
Busy Busy Busy Busy Busy
Temporary operand registers.
33 34
35 36
8086/8088 Pre-fetching No pipeline vs pipeline
The 8086/8088 has a pipelined architecture.
BIU – accesses memory and peripherals
EU – executes fetched instructions
BIU:
Fetch Fetch Write Fetch Fetch Read
6 cycles instead
EU: of 8
Idle Execute Execute Idle Execute Wait
Bus is more
Bus: efficient
Busy Busy Busy Busy Busy Busy
BIU pre-fetches instructions bytes whenever EU is not using the bus and stores them
in the queue.
37 38
• Physical Address
• The 20-bit value that uniquely identifies each byte location in
the memory
16 bits
• Logical Address 15 0
16 bits offset
• Allows code to be developed without prior knowledge of where
the code is to be located in memory + Segment 0
• Facilitates dynamic management of memory resources 20 bits
30000
•Segmentation
20000 Protects tasks from
10000 interfering with each other
00000 (e.g. prevents them from
writing into each others
memory areas)
41 42
43 44
Storage organization
Little Endian, Big Endian
All memory in 8086/88 systems are byte-addressable.
Store 12H, 34H, 56H, and 78H in locations 10000H to 10003H. Little Endian
10003H 78H The ‘little end’ of the number is stored in the
10002H 56H least significant byte.
10001H 34H
10000H 12H Big Endian
The ‘big end’ of the number is stored in the
In MPU world there are two categories--- Little endian and Big endian
most significant byte.
Store 1234H and 5678H in locations 10000H to 10003H.
10003H
10002H
78H
56H
10003H
10002H
56H
78H
8086/8088 uses little endian
Big Endian 10001H 34H 10001H 12H Little Endian Motorola family uses big endian
10000H 12H 10000H 34H
45 46
Segment Registers
8088/86 Registers Four 16-bit registers containing address of 64 KB segment
16-bits Code segment (CS)
contains processor instructions (assembly).
Stack segment (SS)
For temporary storage of data. By default, the processor assumes that
all data referenced by the stack pointer (SP) and base pointer (BP)
registers is located in the stack segment.
Data segment (DS)
To store data that needs to processed. By default, the processor
assumes that all data referenced by general registers (AX, BX, CX, DX)
and index register (SI, DI) is located in the data segment.
Extra segment (ES)
Secondary general purpose data area. Defines the area of memory
used by some of the string instructions to hold destination data.
49 50
53 54
PUSH POP
Assume SP=1230H, AX=2107H, DI=1235H, DX=2345H Assume SP=1230H, AX=2107H, DI=1235H, DX=2345H
Show the contents of the stack as each of the following instructions is Show the contents of the stack as each of the following instructions is
executed: executed:
PUSH AX PUSH DI PUSH DX PUSH AX PUSH DI PUSH DX
55 56
Offset Registers for Various Segments
IP & Flags
Instruction Pointer (IP)
16-bit register which points to next instruction Note : Segments may be override !
to be executed.
Contains the offset of the next instructions to Segment Override Examples
be fetched from the CS instead of the actual
address
Every fetch operation, the value IP increment
by 2
57 58
59 60
Example 1
mov BH,38H ; (BH) 38H
Find the contents of flag add BH,2FH ;ADD 2F to (BH) ,now
(BH) 67
register for the following
example!!! 38+2F=67 00111000
00101111
01100111
61 62
Example 2 Example 3
MOV AL,9CH ; (AL) 9CH MOV AX,34F5H ; AX=34F5
MOV DH,64H ; (DH) 64H ADD AX,95EBH ; now AX=CAE0
ADD AL,DH ; ADD DH to AL ,now 35F5+95EB=CAE0
AL=0
0011010111110101
9C+64=100 10011100 1001010111101011
01100100 1100101011100000
00000000
63 64
Example 4 Example 5
Add the two signed numbers +96 ,+70
MOV BX,AAAAH ; BX=AAAAH
MOV AL,60H ; AL=0110 0000 (+96)
ADD BX,55 56H ; now BX=CAE0H
MOV BL,46H ; BL=0100 0110 (+60)
AAAA+5556=100000000
ADD AL,BL
0110 0000
1010101010101010
0100 0110
0101010101010110
1010 0110
0000000000000000
65 66
A. 16
B. Unknown
67 68
Q.2 Answer – B (56F)
What is 101011011112 in hex?
Break it up like this: 101 0110 1111
A. AD716 So hexadecimal is 56F
B. 56F16
69 70
71 72
Q.4 Answer – A (1MB)
How much memory can be addressed if
a computer has an address bus with 20 The number of addressable units of
lines? memory is 220 = 1 048 576.
The standard addressable unit is a byte.
B. 4 KB
73 74
Answer - B
Q. 5
ROM is_________ Read Only Memory is non-volatile.
Non-volatile means that the contents of
A. volatile
the memory are not lost when power is
B. non-volatile
removed.
75 76
Q.6 Answer - A
A data bus is 32-bits wide. How many
memory banks are needed? 4 memory banks, if each one stores data
as 8 bits units, are needed for a 32-bit
A. 4 data bus.
Not all memory banks are 8 bits wide!
B. 2
77 78
Q.7 Answer - B
A computer stores its instructions and
data in separate memory units. This Computers with a Harvard architecture
architecture is called________. store instructions and data in separate
memory units.
Most often used with Digital Signal
A. von Neumann
Processing (DSP) microprocessors, and
B. Harvard microcontrollers (MCUs)
79 80