MP - Unit 2
MP - Unit 2
February 9, 2021
Unit 1:
Introduction to 80386
February 9, 2021 3
Features of 80386DX
• Flexible 32-bit Microprocessor
– 8, 16, 32-Bit Data Types • Hardware Debugging Support
– 8 General Purpose 32-Bit Registers
– 32 bit ALU • 3 stage Pipeline
– 32 bit Data Bus(4 memory Bank)
– 32 bit Address Bus( 4 GB Memory)
• Multitasking
• Very Large Address Space • Operating Speed-16,20,25,33 MHz
– 4 Gigabyte Physical
– 64 Terabyte Virtual
– 4 Gigabyte Maximum Segment Size • SX (16 bit Data Bus)
DX(32 bit Data Bus)
• Integrated Memory Management Unit
– Segmentation and Paging
– 4 Levels of Protection
– Fully Compatible with 80286
February 9, 2021 4
80386DX Architecture
February 9, 2021 5
Central Processing Unit
80386DX Architecture
• A bus interface.
• offers address pipelining, dynamic data bus sizing, and direct Byte Enable signals for
each byte of the data bus
February 9, 2021 6
Execution Unit
• The execution unit contains the
✔ Eight 32-bit general purpose registers which are used for both address calculation, data
operations and
✔ A 64-bit barrel shifter used to speed shift, rotate, multiply, and divide operations.
• The multiply and divide logic uses a 1-bit per cycle algorithm.
• The multiply algorithm stops the iteration when the most significant bits of the multiplier are
all zero.
February 9, 2021 7
Execution Unit (Cont…)
✔ The linear address consists of two components:
• The segment base address and
• An effective address.
February 9, 2021 8
Instruction and Segmentation Unit
Instruction Unit:
The instruction unit decodes the instruction opcodes and stores them in the decoded
instruction queue for immediate use by the execution unit.
Segmentation Unit:
Segmentation allows the managing of the logical address space by providing an extra
addressing component, one that allows
✔ easy code
✔ data relocatability, and
✔ efficient sharing
February 9, 2021 9
Paging Unit
• The paging mechanism operates beneath and is transparent to the segmentation
process, to allow management of the physical address space.
February 9, 2021 10
Microprocessor
February 9, 2021 11
Unit 2:
Bus Cycles and System Architecture
February 9, 2021 12
Unit 2:
Bus Cycles and System Architecture
Initialization
February 9, 2021 13
Initialization
February 9, 2021 14
Processor State after RESET
February 9, 2021 15
Processor State after RESET
February 9, 2021 16
State of flags and other registers
February 9, 2021 18
Pin Description Table
February 9, 2021 21
Separate I/O address space
(An Isolated I/O)
✔ I/O devices treated separately from memory.
• Hardware and software architecture of
8088/8086 support separate memory I/O
address space.
✔ Page 0:
• Certain I/O instructions can only perform
operations to ports in this part of the address
range.
• Other I/O instructions can input/output data
for ports anywhere in the address space.
February 9, 2021 22
Separate I/O address space
(An Isolated I/O)
Advantages: -
✔ 1 MByte memory address space is available for use
with memory.
✔ Special instructions have been provided in the
instruction set of 8088/8086 to perform isolated
I/O input and output operations.
✔ These instructions have been tailored to maximize
I/O performance.
Disadvantages: -
✔ All input and output data transfers must take place
between AL or AX register and the I/O port
February 9, 2021 23
Memory-mapped I/O
I/O devices is placed in memory
address space of the
microcomputer.
• The memory address space is
assigned to I/O devices.
February 9, 2021 24
Memory-mapped I/O
Advantages:
✔ Many more instructions and addressing
modes are available to perform I/O
operations.
✔ I/O transfers can now take place between
I/O port and internal registers other than
just AL/AX.
Disadvantages:
✔ Memory instructions tend to execute
slower than those specifically designed
for isolated I/O.
✔ Part of the memory address space is lost
February 9, 2021 25
I/O Instructions
February 9, 2021 26
Register I/O Instructions
February 9, 2021 27
Block I/O Instructions
• The block (or string) I/O instructions INS and OUTS move blocks of
data between I/O ports and memory space.
February 9, 2021 28
Read and Write Cycles
• Data transfers occur as a result of bus cycles, • When pipelining is selected and the
classified as read or write cycles. Intel386 DX has a bus request pending
internally, the address and definition of the
• Two choices of address timing are next cycle is made available even before the
dynamically selectable: non-pipelined, or current bus cycle is acknowledged by
pipelined. READY#.
• After a bus idle state, the processor always • Terminating a read cycle or write cycle, like
uses non-pipelined address timing. any bus cycle, requires acknowledging the
cycle by asserting the READY# input.
• However, the NA# (Next Address) input may
be asserted to select pipelined address • Until acknowledged, the processor inserts
timing for the next bus cycle. wait states
February 9, 2021 29
Non-pipelined read & write cycles
• At the end of the second bus state within the bus cycle,
READY# is sampled
• Else the cycle continues another bus state (a wait state) and
READY# is sampled again at the end of that state.
February 9, 2021 31
Unit 2:
Bus Cycles and System Architecture
System Architecture
February 9, 2021 32
Systems Registers
• EFLAGS
• Control Registers
• Debug Registers
• Test Registers
February 9, 2021 33
Systems Registers
✔ EFLAGS
• Control Registers
• Debug Registers
• Test Registers
February 9, 2021 34
EFLAGS
• Control Registers
• Debug Registers
• Test Registers
February 9, 2021 36
Memory-Management Registers
• Four registers of the 80386 locate the data structures that control segmented
memory management:
✔ GDTR Global Descriptor Table Register
✔ LDTR Local Descriptor Table Register
• These registers point to the segment descriptor tables GDT and LDT.
• TR Task Register
This register points to the information needed by the processor to define the
current task.
February 9, 2021 37
Systems Registers
• EFLAGS
✔ Control Registers
• Debug Registers
• Test Registers
February 9, 2021 38
Control Registers
February 9, 2021 39
Systems Registers
• EFLAGS
• Control Registers
✔ Debug Registers
• Test Registers
February 9, 2021 40
Debug Registers
• Six registers: to control debug
features
• Accessed by variants of the MOV
instruction
• debug registers are privileged
resources
Registers are:
✔ Debug Address Registers
(DRO-DR3)
✔ Debug Status Register (DR6)
✔ Debug Control Register (DR7)
February 9, 2021 41
Systems Registers
• EFLAGS
• Control Registers
• Debug Registers
✔ Test Registers
February 9, 2021 42
Test Registers
• Two test registers are provided for the purpose of testing.
• TR6 is the test command register, and TR7 is the test data
register.
February 9, 2021 43
The Test Command Register (TR6)
• C: Command bit, two commands: ‘0’- write • V: The Valid bit for this TLB entry. The TLB uses the
entries into the TLB and ‘1’ perform TLB valid bit to identify entries that contain valid data.
lookups Entries of the TLB that have not been assigned values
have zero in the valid bit. All valid bits can be cleared
• Linear Address: by writing to CR3.
✔ on a TLB write command, a TLB entry is
allocated to this linear address and the rest of • D, D#: The dirty bit for/from the TLB entry
that TLB entry is set as per the values of TR7 • U, U#: The U/S bit for/from the TLB entry
& TR6 • W, W#: The R/W bit for/from the TLB entry
✔ on a TLB lookup command, the TLB is
interrogated as per this value and if one and Meaning of D, U, and W Bit Pairs
only one TLB entry matches, the rest of the
fields of TR6 & TR7 are set from the matching
TLB entry.
February 9, 2021 44
The Test Data Register (TR7)
Holds data read from or data to be written to the TLB
• Physical Address: This is the data field of the TLB. On a write to the TLB, the TLB
entry allocated to the linear address in TR6 is set to this value. On a TLB lookup, if
HT is set, the data field (physical address) from the TLB is read out to this field. If
HT is not set, this field is undefined.
• HT: For a TLB lookup, the HT bit indicates whether the lookup was a hit (HT <- 1)
or a miss (HT <- 0). For a TLB write, HT must be set to 1.
• REP: For a TLB write, selects which of four associative blocks of the TLB is to be
written. For a TLB read, if HT is set, REP reports in which of the four associative
blocks the tag was found; if HT is not set, REP is undefined.
February 9, 2021 45
Test Operations
✔ To write a TLB entry
• Move a doubleword to TR7 that contains the desired physical address, HT, and
REP values. HT must contain 1. REP must point to the associative block in
which to place the entry
• Move a doubleword to TR6 that contains the appropriate linear address, and
values for V, D, U, and W. Be sure C=0 for "write" command.
February 9, 2021 46
Systems Instructions
1. Verification of pointer parameters: 3. Multitasking:
• ARPL ── Adjust RPL • LTR ── Load Task Register
• LAR ── Load Access Rights • STR ── Store Task Register
• LSL ── Load Segment Limit
• VERR ── Verify for Reading
• VERW ── Verify for Writing 4. Coprocessing and Multiprocessing :
• CLTS ── Clear Task-Switched Flag
2. Addressing descriptor tables: • ESC ── Escape instructions
• LLDT ── Load LDT Register • WAIT ── Wait until Coprocessor not
• SLDT ── Store LDT Register Busy
• LGDT ── Load GDT Register • LOCK ── Assert Bus-Lock Signal
• SGDT ── Store GDT Register
February 9, 2021 47
Systems Instructions
5. Input and Output : 7. Debugging :
• IN ── Input • MOV ── Move to and from debug
• OUT ── Output INS ── Input registers
String
• OUTS ── Output String 8. TLB testing :
• MOV ── Move to and from test registers
February 9, 2021 48
February 9, 2021 49
February 9, 2021 Dr.Sable Nilesh (ICOER) 50