Lec02 The Microprocessor and Its Architecture
Lec02 The Microprocessor and Its Architecture
IT372
Microprocessors
Lec02 The Microprocessor and iTs archiTecTure
Introduction
1
2/28/2024
Objectives
2
2/28/2024
3
2/28/2024
4
2/28/2024
Multipurpose Registers
• Intel plans to expand the address bus to 52 bits to address 4P (252~1015 =peta)
bytes of memory.
10
5
2/28/2024
Multipurpose Registers
11
Multipurpose Registers
12
6
2/28/2024
Multipurpose Registers
• R8 - R15 found in the Pentium 4 and Core2 if 64-bit extensions are enabled.
• data are addressed as 64-, 32-, 16-, or 8-bit sizes and are of general purpose
• Most applications will not use these registers until 64-bit processors are
common.
• the 8-bit portion is the rightmost 8-bit only
• bits 8 to 15 are not directly addressable as a byte
13
Special-Purpose Registers
14
7
2/28/2024
Special-Purpose Registers
15
The EFLAG and FLAG register counts for the entire 8086 and
Pentium microprocessor family.
• Flags never change for any data transfer or program control operation.
• Some of the flags are also used to control features found in the
microprocessor.
16
8
2/28/2024
18
• A (auxiliary carry) holds the carry (half-carry) after addition or the borrow
after subtraction between bit positions 3 and 4 of the result.
• Z (zero) shows that the result of an arithmetic or logic operation is zero.
• S (sign) flag holds the arithmetic sign of the result after an arithmetic or logic
instruction executes.
• T (trap) The trap flag enables trapping through an on-chip debugging feature.
19
9
2/28/2024
20
• IOPL used in protected mode operation to select the privilege level for I/O
devices.
• NT (nested task) flag indicates the current task is nested within another
task in protected mode operation.
• RF (resume) used with debugging to control resumption of execution after
the next instruction.
• VM (virtual mode) flag bit selects virtual mode operation in a protected
mode system.
21
10
2/28/2024
22
Segment Registers
23
11
2/28/2024
24
25
12
2/28/2024
26
• All real mode memory addresses must consist of a segment address plus an
offset address.
• segment address defines the beginning address of any 64K-byte memory segment
• offset address selects any location within the 64K byte memory segment
• Figure 2–3 shows how the segment plus offset addressing scheme selects a
memory location.
27
13
2/28/2024
28
• Once the beginning address is known, the ending address is found by adding
FFFFH.
• because a real mode segment of memory is64K in length
• The offset address is always added to the segment starting address to locate
the data.
• Segment and offset address is sometimes written as 1000:2000.
• a segment address of 1000H; an offset of 2000H
29
14
2/28/2024
30
31
15
2/28/2024
32
TPA
• The transient program area (TPA) holds the DOS (disk operating system)
operating system; other programs that control the computer system.
33
16
2/28/2024
34
35
17
2/28/2024
• Allows access to data and programs located within & above the first 1M byte
of memory.
• Protected mode is where Windows operates.
• In place of a segment address, the segment register contains a selector that
selects a descriptor from a descriptor table.
• The descriptor describes the memory segment’s location, length, and access
rights.
36
• The descriptor is located in the segment register & describes the location,
length, and access rights of the segment of memory.
• it selects one of 8192 descriptors from one
of two tables of descriptors
• In protected mode, this segment number can address any memory location
in the system
for the code segment.
• Indirectly, the register still selects a memory segment, but not directly as in
real mode.
37
18
2/28/2024
38
39
19
2/28/2024
• The base address of the descriptor indicates the starting location of the
memory segment.
• the paragraph boundary limitation is removed in protected mode
• segments may begin at any address
• The G, or granularity bit allows a segment length of 4K to 4G bytes in steps of
4K bytes.
• 32-bit offset address allows segment lengths of 4G bytes
• 16-bit offset address allows segment lengths of 64K bytes.
40
41
20
2/28/2024
• The access rights byte controls access to the protected mode segment.
• describes segment function in the system and allows complete control over the segment
• if the segment is a data segment, the direction of growth is specified
• If the segment grows beyond its limit, the operating system is interrupted,
indicating
a general protection fault.
• You can specify whether a data segment
can be written or is write-protected.
42
Figure 2–7 The access rights byte for the 80286 through Core2 descriptor.
43
21
2/28/2024
• Descriptors are chosen from the descriptor table by the segment register.
• register contains a 13-bit selector field, a table selector bit, and requested privilege level
field
• The TI bit selects either the global or the local descriptor table.
• Requested Privilege Level (RPL) requests the access privilege level of a
memory segment.
• If privilege levels are violated, system normally indicates an application or privilege level
violation
44
45
22
2/28/2024
• Figure 2–9 shows how the segment register, containing a selector, chooses a
descriptor from the global descriptor table.
• The entry in the global descriptor table selects a segment in the memory
system.
• Descriptor zero is called the null descriptor, must contain all zeros, and may
not be used for accessing memory.
46
Figure 2–9 Using the DS register to select a description from the global descriptor
table. In this example, the DS register accesses memory locations 00100000H–
001000FFH as a data segment.
47
23
2/28/2024
Program-Invisible Registers
48
49
24
2/28/2024
50
• The GDTR (global descriptor table register) and IDTR (interrupt descriptor
table register) contain the base address of the descriptor table and its limit.
• when protected mode operation desired, address of the global descriptor table and its
limit are loaded into the GDTR
• The location of the local descriptor table is selected from the global
descriptor table.
• one of the global descriptors is set up to address the local descriptor table
51
25
2/28/2024
• To access the local descriptor table, the LDTR (local descriptor table register)
is loaded with a selector.
• selector accesses global descriptor table, & loads local descriptor table address, limit, &
access rights into the cache portion of the LDTR
• The TR (task register) holds a selector, which accesses a descriptor that
defines a task.
• a task is most often a procedure or application
• Allows multitasking systems to switch tasks
to another in a simple and orderly fashion.
52
53
26
2/28/2024
Paging Registers
54
55
27
2/28/2024
56
Figure 2–12 The format for the linear address (a) and a page directory or
page table entry (b).
57
28
2/28/2024
• Intel has incorporated a special type of cache called TLB (translation look-
aside buffer).
• because repaging a 4K-byte section of memory requires access to the page directory and
a page table, both located in memory
• The 80486 cache holds the 32 most recent page translation addresses.
• if the same area of memory is accessed, the address is already present in the TLB
• This speeds program execution
• Pentium contains separate TLBs for each of their instruction and data caches.
58
59
29
2/28/2024
Figure 2–13 The paging mechanism in the 80386 through Core2 microprocessors.
60
61
30
2/28/2024
Figure 2–14 The page directory, page table 0, and two memory pages. Note how the
address of page 000C8000–000C9000 has been moved to 00110000–00110FFF.
62
63
31
2/28/2024
• Real mode system is not available if the processor operates in the 64-bit
mode.
• Protection and paging are allowed in the 64-bit mode.
• The CS register is still used in the protected mode operation in the 64-bit
mode.
• Most programs today are operated in the IA32 compatible mode.
• current software operates properly, but this will change in a few years as memory
becomes larger and most people have 64-bit computers
64
65
32
2/28/2024
SUMMARY
66
SUMMARY (cont.)
•8-bit registers are AH, AL, BH, BL, CH, CL, DH, and DL.
•16-bit registers are AX, BX, CX, DX, SP, BP, DI, and SI.
•The segment registers are CS, DS, ES, SS, FS, and GS.
•32-bit extended registers are EAX, EBX, ECX, EDX, ESP, EBP, EDI,
and ESI.
67
33
2/28/2024
SUMMARY (cont.)
68
SUMMARY (cont.)
69
34
2/28/2024
SUMMARY (cont.)
70
SUMMARY (cont.)
71
35
2/28/2024
SUMMARY (cont.)
72
SUMMARY (cont.)
73
36
2/28/2024
SUMMARY (cont.)
74
SUMMARY (cont.)
75
37
2/28/2024
SUMMARY (cont.)
76
SUMMARY (cont.)
77
38
2/28/2024
SUMMARY (cont.)
78
39