Week 3 Flashcards
Intel 8086 MPU
The DNA of the chip (x86 architecture) is likely at the centre of every computer
8086 Architecture block diagram
The 8086 has a 2-stage pipeline so was designed to have 2 units: BIU and EU.
Process of “fetching next instruction while executing next instruction”
Bus interface unit (BIU)
BIU communicates with external devices and peripherals including memory via the bus.
The left x block has something to do with memory segmentation.
The right side of the BIU has a buffer of queue to keep the BIU ahead of the EU which is 6 bytes long.
It generates 20-bit physical address for memory access
It fetches intructions from the memory
It transfers data to and from memory and I/O
Maintains the 6 byte prefetch instruction queue
What is memory segmentation?
An OS memory management technique dividing a computer’s primary memory into segments.
For 8086 memory is divided into 4 segments:
-Code segment
-Stack segment
-Data segment
-Extra segment
Each of these are 16 bits which add up to 64 bits in total
Code segment
Stores programs
Instructions are fetched from the code segment
It operates in “first come first serve”
Stack segment
Stores stacks
Operates in “last in first out” manner (like checking emails)
Data segment and extra segment
store general data
Why do we need memory segmentation?
-Segmentation helps to organise memory and prevent accidental overrides
-More important to work with 8086 address bus efficiently
Segmented memory addressing
-Width of address bus in 8086 is 20
-The 20-bit unique address is called physical address which is the real address
-20 bits is 2.5 bytes which is not byte compatible and is inconvenient to work with
- A virtual model of the address is created which consists of a 16-bit segment address and 16-bit offset address
- For memory access, the memory management unit (x block in x86 architecture) uses virtual addresses to generate 20 bit physical address
What are the two memory units in an 8086 microprocessor and whats their function?
BIU: bus interface unit does fetch
EU: execution unit does execute
The 8086 microprocessor has a 2 stage pipeline
What are the two virtual addresses used to generate 20 bit physical address?
-These are a 16-bit segment address and 16-bit offset address
- Segment address: gives the starting address of the segment and indicates where the segment is
- Offset address: indicates where the target memory cell is
What’s the physical address formula in terms of virtual addresses?
PA = (Segment x 10H) + Offset
Example for physical address formula
Segment address = 1234H
offset address = 0011H
PA = segment x 10H x offset
PA = 1234H x 10H x 0011H
PA = 12340H + 0011H
PA = 12351H
What’s the max size of a segment?
It is 64KB
This is because of the offset address being 16 bits
2^16 = 64KB
Programmers can create multiple code/stacks/data segments until the entire 1MB is used but only one of each type will be currently active. You can’t work on two segments simultaneously.
What are the segment address and offset registers for all 4 segments?
Code Segment:
Segment is CS (code segment)
Offset is IP (instruction pointer)
Stack Segment:
Segment is SS (stack segment)
Offset is SP/BP (stack/base pointer)
Data Segment:
Segment is DS (data segment)
Offset is SI (source index)
Extra Segment:
Segment is ES (extra segment)
Offset is DI (destination index)
Offset registers point to specific memory locations under each segment