Académique Documents
Professionnel Documents
Culture Documents
(c) Pearson Education, 2006-2007. All rights reserved. You may modify and copy this slide show for your personal use,
or for use in the classroom, as long as this copyright statement, the author's name, and the title are not changed.
Chapter 2 Outline
2.1 General Concepts
2.2 IA-32 Processor Architecture
2.3 IA-32 Memory Management
2.4 Components of an IA-32 Microcomputer
2.5 Input-Output System
Web site
Examples
Web site
Examples
registers
Central Processor Unit
(CPU)
ALU
CU
Memory Storage
Unit
I/O
Device
#1
I/O
Device
#2
clock
control bus
address bus
Web site
Examples
Address bus
Hold the address of instruction and data
Control bus
Synchronize the actions of all devices
Web site
Examples
Clock
Clock: repeatedly pulses at a constant time
Synchronizes all CPU and BUS operations
Machine cycle (clock cycle time): the most basic unit of
time for machine instruction
A machine instruction requires at least one clock cycle
to execute.
A few instructions (e.g., the multiply instruction) require in
excess of 50 clocks
one cycle
1
0
Web site
Examples
Clock (Cont.)
The duration of a clock cycle is the reciprocal of the
clock
s speed
1 GHz ( 1 billion oscillations per second)
=> clock cycle time = 1 ns (nanosecond)
Web site
Examples
Web site
Examples
PC
I-1
memory
op1
op2
fetch
read
registers
registers
instruction
I-1 register
decode
write
Fetch
Decode
Fetch operands
Execute
Store output
write
program
I-2 I-3 I-4
flags
ALU
execute
(output)
Web site
Examples
Web site
Examples
10
Multi-Stage Pipeline
Pipelining makes it possible for processor to execute instructions in
parallel
Instruction execution divided into discrete stages
Stages
1
S1
I-1
S3
S4
8
9
10
S6
I-1
I-1
5
6
7
S5
I-1
3
4
Cycles
S2
I-1
I-1
I-2
I-2
I-2
I-2
11
I-2
12
I-2
Web site
Examples
11
Pipelined Execution
More efficient use of cycles, greater throughput of instructions:
S ta g e s
Cycles
1
2
3
4
S1
S2
I- 1
I- 2
I-1
I-2
5
6
7
S3
S4
I-1
I-2
I-1
I-2
S5
I-1
I-2
S6
I-1
I-2
Web site
Examples
12
Cycles
S ta g e s
S2
S3
S1
I-1
2
3
I-2
I-3
I-1
I-2
I-1
4
5
I-3
I-2
I-3
exe
S4
S5
I-1
I-1
6
7
I-2
I-2
I-1
8
9
I-3
I-3
I-2
10
11
S6
I-1
I-2
I-3
I-3
For k states and n instructions, the number of required cycles is: k + (2n 1)
Web site
Examples
13
Superscalar
A superscalar processor has multiple execution pipelines. In the
following, note that Stage S4 has left and right pipelines (u and v).
S ta g e s
S4
Cycles
S1
S2
S3
S5
S6
I-1
2
3
I-2
I-3
I- 1
I- 2
I-1
I-4
I- 3
I-2
I-1
I- 4
I-3
I-1
I- 2
I-4
I-3
I- 2
I-1
I-3
I- 4
I- 4
I-2
I-3
I-1
I-2
I-4
I-3
5
6
7
8
9
10
I-4
Web site
Examples
14
Cycle 2
Cycle 3
Cycle 4
CLK
Address
ADDR
RD
Data
DATA
Web site
Examples
15
Cache Memory
High-speed expensive static RAM both inside and
outside the CPU.
Level-1 cache: inside the CPU
Level-2 cache: outside the CPU
Web site
Examples
16
sends program
nam e to
O perating
system
gets starting
cluster from
searches for
program in
returns to
System
path
loads and
starts
Directory
entry
Current
directory
Program
Web site
Examples
17
Web site
Examples
18
Multitasking
OS can run multiple programs at the same time.
A process may optionally contains multiple threads of
execution.
Scheduler assigns a given amount of CPU time to
each running program.
Rapid switching of tasks
Gives illusion that all programs are running at once
The processor must support task switching.
The processor saves the state (e.g., registers, variables,
program counter) of each task before switching to a new
one
Web site
Examples
19
Web site
Examples
20
Web site
Examples
21
Real-address mode
Native MS-DOS
Implements the programming environment of the Intel 8086
processor
All Intel processors boot in Real-address mode
Then the OS may switch to another mode
Web site
Examples
22
Virtual-8086 mode
While in Protected mode, the processor can directly execute
Real-address mode program in a safe multitasking environment.
Each program has its own 8086 computer
A special case of Protected Mode, so it is called Virtual
Web site
Examples
23
Web site
Examples
24
Addressable Memory
Protected mode
4 GB
32-bit address
Web site
Examples
25
Registers
Registers are high-speed storage locations directly inside the CPU
Intel registers
8 general-purpose registers
6 segment registers
EFLAGS: processor status flag
EIP: instruction pointer
32-bit General-Purpose Registers
EAX
EBP
EBX
ESP
ECX
ESI
EDX
EDI
CS
ES
SS
FS
DS
GS
Web site
Examples
26
General-Purpose Registers
Used for arithmetic and data movement
EAX, EBX, ECX, EDX, ESI, EDI, ESP, EBP
AH
AL
AX
EAX
8 bits + 8 bits
16 bits
32 bits
Web site
Examples
27
AH
AL
AX
EAX
8 bits + 8 bits
16 bits
32 bits
Web site
Examples
28
Web site
Examples
29
Web site
Examples
30
DS data segment
Hold variables
SS stack segment
Hold local variables and function parameters
Web site
Examples
31
Status Flag
Reflect the outcome of some CPU operations
Example
Carry Flag (CF)
Overflow Flag (OF)
Sign Flag
Zero Flag
Auxiliary Carry Flag
Parity Flag
Web site
Examples
32
Flags
Control Flags
Direction
Interrupt
Status Flags
Carry
unsigned arithmetic out of range
Overflow
signed arithmetic out of range
Sign
result is negative
Zero
result is zero
Auxiliary Carry
carry from bit 3 to bit 4
Parity
sum of 1 bits is an even number
Irvine, Kip R. Assembly Language for Intel-Based Computers 5/e, 2007.
Web site
Examples
33
System Registers
System registers
Only permit access by programs running at the highest
privilege level (level 0), e.g., the Window XP
IDTR (Interrupt Descriptor Table Register)
GDTR (Global Descriptor Table Register)
LDTR (Local Descriptor Table Register)
Task Registers
Control Registers: CR0, CR2, CR3, CR4
Model-Specific Registers
Web site
Examples
34
ST(0)
ST(1)
ST(2)
arranged in a stack
ST(3)
ST(4)
ST(5)
ST(6)
Web site
ST(7)
Examples
35
Web site
Examples
36
Web site
Examples
37
The IBM-AT
Intel 80286
16 MB addressable RAM
Protected memory
several times faster than 8086
introduced IDE bus architecture
80287 floating point unit
Web site
Examples
38
Intel486
instruction pipelining
Pentium
superscalar, 32-bit address bus, 64-bit
internal data path
Web site
Examples
39
Intel P6 Family
Pentium Pro
advanced optimization techniques in microcode
Pentium II
MMX (multimedia) instruction set
Pentium III
SIMD (streaming extensions) instructions
Web site
Examples
40
Web site
Examples
41
Web site
Examples
42
Web site
Examples
43
Web site
Examples
44
Real-Address Mode
Web site
Examples
45
F0000
E0000
8000:FFFF
D0000
C0000
one segment
B0000
linear addresses
A0000
90000
80000
70000
60000
8000:0250
50000
0250
40000
30000
8000:0000
20000
10000
seg
00000
ofs
Web site
Examples
46
0 1 0 0
Linear address:
0 9 0 1 0
Web site
Examples
47
Your turn . . .
What linear address corresponds to the segment/offset
address 028F:0030?
Web site
Examples
48
Your turn . . .
What segment addresses correspond to the linear address
28F30h?
Web site
Examples
49
Protected Mode (1 of 2)
4 GB addressable RAM
(00000000 to FFFFFFFFh)
Web site
Examples
50
Protected Mode (2 of 2)
Program structure
code, data, and stack areas
CS, DS, SS segment descriptors
global descriptor table (GDT)
Web site
Examples
51
Web site
Examples
52
Multi-Segment Model
Each program has a local descriptor table (LDT)
Holds descriptor for each segment used by the program
RAM
L o c a l D e s c rip to r T a b le
26000
base
lim it
00026000
0010
00008000
000A
00003000
0002
access
8000
3000
Irvine, Kip R. Assembly Language for Intel-Based Computers 5/e, 2007.
Web site
Examples
53
Paging
Supported directly by the CPU
A segment is further divided into 4096-byte (4KB)
blocks of memory called pages
Allow the memory used by programs can be larger
than the computer
s actual memory
Virtual memory v.s. physical memory
Part of running program is in memory, part is on disk
Web site
Examples
54
Web site
Examples
55
Web site
Examples
56
2.4.1 Motherboard
CPU socket
External cache memory slots
Main memory slots
BIOS chips
Sound synthesizer chip (optional)
Video controller chip (optional)
IDE, parallel, serial, USB, video, keyboard, joystick,
network, and mouse connectors
PCI bus connectors (expansion cards)
Web site
Examples
57
mouse, keyboard,
parallel, serial, and USB
connectors
Audio chip
PCI slots
memory controller hub
Pentium 4 socket
AGP slot
dynamic RAM
Firmware hub
I/O Controller
Speaker
Battery
Power connector
Diskette connector
Examples
58
Web site
Examples
59
Web site
Examples
60
2.4.3 Memory
ROM
read-only memory
EPROM
erasable programmable read-only memory
Dynamic RAM (DRAM)
inexpensive; must be refreshed constantly
Static RAM (SRAM)
expensive; used for cache memory; no refresh required
Video RAM (VRAM)
dual ported; optimized for constant video refresh
CMOS RAM
complimentary metal-oxide semiconductor
system setup information
Web site
Examples
61
Parallel
short cable, high speed
common for printers
bidirectional, parallel data transfer
Intel 8255 controller chip
Web site
Examples
62
Serial
RS-232 serial port
one bit at a time
uses long cables and modems
16550 UART (universal asynchronous receiver
transmitter)
programmable in assembly language
Web site
Examples
63
Web site
Examples
64
medium performance
Level 1: Call a BIOS (basic input-output system) function
may produce different results on different systems
knowledge of hardware required
usually good performance
Level 0: Communicate directly with the hardware
May not be allowed by some operating systems
Irvine, Kip R. Assembly Language for Intel-Based Computers 5/e, 2007.
Web site
Examples
65
Web site
Application Program
Level 3
OS Function
Level 2
BIOS Function
Level 1
Hardware
Level 0
Examples
66
ASM Program
OS Function
Level 2
BIOS Function
Level 1
Hardware
Level 0
Web site
Examples
67
Web site
Examples
68
Tradeoff
Tradeoff
Control (efficiency) v.s. portability
However, some OSs, like Windows and Linux, do not
permit user programs to directly access system
hardware
Web site
Examples
69
Summary
Central Processing Unit (CPU)
Arithmetic Logic Unit (ALU)
Instruction execution cycle
Multitasking
Floating Point Unit (FPU)
Complex Instruction Set
Real mode and Protected mode
Motherboard components
Memory types
Input/Output and access levels
Web site
Examples
70