Bus Cycle
Read · Write · Memory BankingWhat is a bus cycle
The 8086 executes a bus cycle to transfer data or fetch an instruction over the system bus. The minimum bus cycle is 4 clock periods (T-states): T1–T4. Slower devices force extra wait states, Tw, inserted between T3 and T4. Every bus cycle follows the same shape: address out → read/write + control signals → data transfer → termination.
Read cycle
Control pins
| Pin | Type | What it does |
|---|---|---|
| RD | Output | Goes LOW when 8086 reads from memory or an I/O location. |
| BHE/S7 | Output | LOW in T1 to enable AD15–AD8 (high byte). In later T-states it re-purposes as status S7. |
| DT/R | Output | HIGH = transmit, LOW = receive, through the 8286/8287 transceiver. |
| DEN | Output | LOW enables the transceiver. |
| ALE | Output | Demultiplexes AD15–AD0 into address (A15–A0) and data (D15–D0) on its high→low edge. |
| READY | Input | Slow devices pull this LOW, then HIGH once data is ready, to release the processor. |
T-state breakdown — Read
- T1: 20-bit address placed on AD15–AD0 and A16/S3–A19/S6. Processor outputs LOW on DT/R (holds until T4).
- T2: AD15–AD0 lines go tri-state. A16/S3–A19/S6 switch from address to status S3–S6. RD and DEN go LOW (hold until T4).
- T3 / Tw: Data comes in on AD15–AD0 from memory/device. If the device pulls READY LOW at the start of T3, the CPU inserts wait states (Tw) until READY goes HIGH. Data is latched at the end of this state.
- T4: Command lines disabled — bus cycle terminates.
Write cycle
Same shape as the read cycle, with two differences: the WR pin replaces RD, and DT/R is driven HIGH throughout (CPU is transmitting, not receiving).
T-state breakdown — Write
- T1: 20-bit address on AD15–AD0 / A16–A19. DT/R goes HIGH, holds until T4.
- T2: AD lines tri-state, address/status lines switch to S3–S6. WR and DEN go LOW (hold until T4).
- T3 / Tw: Data goes OUT from CPU to memory/device on AD15–AD0. Wait states inserted the same way as the read cycle if READY is pulled LOW.
- T4: Command lines disabled — bus cycle terminates.
Memory space: even/odd banking
8086 memory is split into two banks, up to 512K bytes each: the odd bank (connects to D15–D8) and the even bank (connects to D7–D0). Bank selection is controlled by BHE and A0:
| BHE | A0 | Bank(s) selected |
|---|---|---|
| 0 | 0 | Both banks (word access, even address) |
| 0 | 1 | Odd address bank only |
| 1 | 0 | Even address bank only |
| 1 | 1 | None |
Worked examples
MOV DH, [BX] — byte operation, address 20004H (even): A0=LOW, BHE=HIGH → even bank selected → byte comes off D7–D0 → DH. Single bus cycle.
MOV DH, [BX] — byte operation, address 20005H (odd): A0=HIGH, BHE=LOW → odd bank selected → byte comes off D15–D8 → DH. Single bus cycle.
MOV [BX], CX — word operation, address 20008H (even): A0=LOW, BHE=LOW → both banks selected → CL on D7–D0, CH on D15–D8, written to 20008H/20009H. Single bus cycle.
MOV [BX], CX — word operation, address 20007H (odd): needs two bus cycles. Cycle 1: A0=HIGH, BHE=LOW → odd bank → CL written to 20007H. Cycle 2: A0=LOW, BHE=HIGH → even bank → CH written to 20008H.
Interrupt System
Polling · Vector Table · Priority · INTAThe interrupt system lets the processor handle unusual circumstances and lets external hardware communicate with it, without the CPU wasting cycles constantly checking devices. Three categories: predefined interrupts, software interrupts (user-defined), and hardware interrupts (user-defined).
Polling vs. interrupt-driven I/O
Polling: the main program periodically breaks away (e.g. every 20 ms) to run the keyboard driver and check the device directly — it "asks" the keyboard every cycle whether it has data, whether or not it actually does. This wastes CPU time on empty checks.
Interrupt-driven: the keyboard itself signals the interrupt controller only when it actually has data, which triggers the appropriate ISR. The CPU runs the main program uninterrupted otherwise — no wasted checks.
Interrupt vector table
Every 8086 interrupt has a service routine. Their addresses live in a table in 0000:0000H–0000:03FFH. Each interrupt gets 4 bytes (2 for IP, 2 for CS) → the table holds 256 vectors total, one per interrupt type code (0–255).
Table address of IP = 4 × nn
Table address of CS = 4 × nn + 2
Physical address of ISR = CS × 10H + IP
Worked example — INT 2: IP is stored at table address 4×2 = 00008H; CS is stored at 4×2+2 = 0000AH. The processor reads both values, then computes the ISR's physical start address as CS×10H + IP.
Response to an interrupt — the 8 steps
- Push the existing Flag register, CS, and IP onto the stack.
- Jump to the interrupt vector table.
- Find the appropriate CS and IP in the vector table.
- Load the new CS and IP for the Interrupt Service Routine.
- Execute the Interrupt Service Routine.
- Pop the IP, CS, and Flag of the main program (via the ISR's final IRET).
- Load the popped IP, CS, and Flag.
- Resume executing the main program.
Along the way, TF and IF are cleared when the interrupt is taken, so the ISR itself isn't interrupted by single-stepping or another maskable interrupt unless it re-enables them.
Interrupt priority
| Priority | Source |
|---|---|
| 1 (highest) | Single-step mode |
| 2 | NMI pin interrupt |
| 3 | Software interrupt |
| Lowest | Hardware interrupt (only services when nothing else is active) |
The 256 interrupts & predefined types 0–4
| Type | Name | Trigger condition |
|---|---|---|
| 0 | Division by zero | Any attempted divide-by-zero. Non-maskable. |
| 1 | Single-step mode | When TF=1, fires after every instruction. |
| 2 | NMI pin | Edge-triggered, active ≥2 clock cycles on NMI pin — e.g. power failure. |
| 3 | Breakpoint | User-inserted INT 3 — used for debugging. |
| 4 | Overflow | Fires when OF=1 and INTO is executed. |
Types 5–31 and 32–255
| Range | Slide label | How it's actually invoked |
|---|---|---|
| 5–31 | Hardware (per slide header) | Two-byte instruction INT nn written into a program — e.g. INT 21H, INT 16H. |
| 32–255 | Software (per slide header), maskable | Hardware device pulls INTR pin HIGH while IF=1; after finishing the current instruction the CPU pulses INTA LOW and the device puts its type code on the bus. |
Non-maskable interrupt (NMI) — use cases
INTA sequence (for maskable / INTR-driven interrupts)
The interrupt-acknowledge sequence has two INTA bus cycles:
- ALE is issued, loading the address latches with indeterminate information.
- The first INTA cycle tells the requesting hardware that acknowledgment is in progress and to get ready.
- On the second INTA cycle, the hardware places its interrupt type code (32–255) onto the low data bus lines.
Interfacing with Memories
ROM Family · SRAM vs DRAM · 8205 DecoderInstruction processing has three basic steps: (1) fetch from memory, (2) decode, (3) execute (often needs another memory access for operands/results). Memory interfacing is about connecting memory chips to the microprocessor and reading/writing them correctly.
ROM family (PROM → EPROM → EEPROM)
| Type | Key property |
|---|---|
| ROM | Non-volatile. Data written at the factory during fabrication; can't be changed after. |
| PROM | Programmable ROM — user can program it, but only once. |
| EPROM | Erasable PROM — contents erased by exposure to ultraviolet light, then reprogrammed. |
| EEPROM | Electrically erasable PROM — no UV needed. This is the tech behind USB memory sticks. |
SRAM vs. DRAM
| SRAM | DRAM | |
|---|---|---|
| Cell structure | 4–6 transistors | 1 transistor + 1 capacitor |
| Data retention | Valid as long as power is ON — no refresh needed | Capacitor leaks → needs periodic refresh (every few ms) or data is lost |
| Speed | Faster | Slower |
| Cost / density / power | More expensive, lower density | Cheaper, higher density, lower power, less space |
| Typical use | Cache | Main memory (most prevalent) |
DRAM types
- SDRAM — synchronizes memory speed with the CPU clock; up to 133 MHz.
- RDRAM (Rambus) — popular early-2000s, video/graphics cards; up to 1 GHz.
- DDR SDRAM — "double pumping": transfers data on both the rising and falling clock edges, nearly doubling bandwidth at the same clock frequency.
- DDR1→DDR2→DDR3→DDR4 — each generation faster, but not backward-compatible. DDR4 reaches 2133/2400/2666/3200 MT/s.
DRAM packaging
| Package | Detail |
|---|---|
| SIMM | Late-1980s–1990s, now obsolete. 30- or 72-pin, 32-bit data bus. |
| DIMM | Current standard. Pins on both sides ("dual in-line"). Started at 168-pin / 64-bit bus; DDR4 DIMMs use 288-pin connectors. |
Memory interface — the three buses
| Bus | Function |
|---|---|
| Address bus | Carries the memory address (or I/O address) to the system. |
| Data bus | 16-bit; transfers data between the microprocessor and memory/I/O. |
| Control bus | Carries the signals (RD/WR) that tell memory or I/O to perform a read or write. |
A 16-bit memory word is split into high and low 8-bit banks, connected to the upper/lower halves of the data bus and selected by BHE/A0 — same logic as Lecture 9's memory banking.
ROM/EPROM vs. SRAM interfacing
- ROM/EPROM (read-only): don't need BHE/A0 at all. Address line A1-and-up connect straight to the processor's address lines; unused address lines are repurposed for chip select. They have an output-enable pin to interface with the multiplexed bus.
- Static RAM (read/write): does use BHE and A0 in its chip-select logic. Data lines connect to either AD15–AD8 or AD7–AD0. A decoder selects which RAM chip is active.
The 8205 decoder
The Intel 8205 is a common decoder for this: 3 enables (E1, E2, E3), 3 inputs (A0–A2), and 8 outputs — enough to select up to 8 RAM chips (e.g. the 2142).
Interfacing Input/Output Ports
Memory-Mapped vs I/O-Mapped · IN/OUT · 74LS245Two methods exist for interfacing I/O devices to a microprocessor: memory-mapped I/O and I/O-mapped (isolated) I/O. The 8086/8088 (and most Intel µPs) use isolated I/O; the 68HC11 is the course's example of memory-mapped I/O.
Memory-mapped vs. I/O-mapped — the class comparison table
| # | Memory Mapped I/O | I/O Mapped I/O |
|---|---|---|
| 1 | I/O device mapped to memory space | I/O device mapped to I/O space |
| 2 | Device takes a memory address | Device takes an I/O address |
| 3 | 20-bit address; 220 = 1 MB | 16-bit address; 216 = 64 KB |
| 4 | No special treatment for the I/O device | Microcontroller distinguishes memory space from I/O space |
| 5 | All memory instructions allowed | Only IN and OUT instructions allowed |
| 6 | All registers usable | Only the A register (accumulator) usable |
| 7 | 2 control signals: RD, WR | 4 control signals: MR, MW, IOR, IOW |
| 8 | Complex decoding | Simple decoding |
| 9 | Slower decoding | Faster decoding |
| 10 | Common in microcontrollers | Common in microprocessors |
Memory-mapped I/O
The I/O device is treated as an ordinary memory location — the same instructions (e.g. MOV) that access memory also access the device. Advantage: no extra instructions or control circuitry needed. Disadvantage: eats into the address space available to actual memory. Used by the 68HC11.
I/O-mapped (isolated) I/O
I/O addresses live in a separate address space from memory, reached only through dedicated port instructions. Advantage: memory keeps its full addressable space. Disadvantage: needs specific instructions and separate control signals — IOR to read from an I/O device, IOW to write to one.
The M/IO pin
The processor tells memory and I/O apart using the M/IO pin: pulled one way for a MOV (memory) instruction, the other way for an IN/OUT (I/O) instruction.
I/O ports — IN / OUT
- IN receives data from a specified port into the accumulator (AL, AH, or AX).
- OUT sends data from the accumulator to a specified port.
- Original IBM PC: 8-bit port addresses — 256 ports, 00h–FFh.
- Newer machines: 16-bit port addresses — 65,536 ports, 0000h–FFFFh.
8-bit port: address is encoded directly in the instruction (1 byte opcode + 1 byte address), carried on A0–A7. No segment register involved.
16-bit port: address must be loaded into DX first, carried on A0–A15. Still no segment register.
Transfer width: 8-bit transfers use AL; 16-bit transfers use the full AX (low byte AL → specified port, high byte AH → the next port address — little endian).
Worked assembly example (Slide 13)
An 8088 system monitors a critical temperature at input port 22h, and raises an alarm if it hits 100:
Chk: IN AL, 22h ; Read temperature from port 22h CMP AL, 100 ; Is it >= 100? JB Chk ; If not, keep monitoring CALL Alarm ; If it is, set off alarm
The 74LS245 octal bus transceiver
A common example ties switches to the 8086 through a 74LS245 — an octal bidirectional buffer/transceiver. Its DIR pin sets transfer direction, and its CS is generated by decoding the address lines together with IORD. Data moves over D0–D7; the I/O control signal (IORD) confirms the access is I/O-mapped, not memory.
Updated Microprocessors
Pipelining · Multicore · Turbo Boost · Hyper-Threading · PBOProcessor family lineage covered: 8085 → 8086 → 186 → 286 → 386 → 486 → 586 (P1–P4, Core 2 Duo → Core i7).
Pipelined vs. unpipelined execution
Unpipelined: each job (fetch → decode → execute) starts and fully finishes before the next job begins — jobs run one after another, back to back.
Pipelined: each job is broken into smaller stages (FET, DEC, EXE). While instruction I1 is in its EXE stage, I2 can already be in DEC, and I3 can already be in FET — stages overlap across a clock cycle, so throughput goes up even though any single instruction still takes 3 stages to finish.
Multi-core: what and why
A multi-core processor is a single component with two or more independent CPU cores that each read and execute ordinary instructions (add, move, branch). Multiple cores run multiple instructions at the same time, boosting throughput for parallel-friendly programs. Cores are usually integrated onto one die (a chip multiprocessor, CMP) or onto multiple dies in one package. Within each core, threads are still time-sliced, same as on a single-core processor.
Why go multi-core?
- Pushing single-core clock frequency higher runs into heat, speed-of-light propagation limits, and hard design/verification problems.
- Deeply pipelined circuits need large design teams and expensive cooling infrastructure at scale (server farms).
- Many modern applications are already multithreaded.
- General industry trend: shift toward parallelism rather than raw clock speed.
Processor family: i3 / i5 / i7
| Tier | Target market |
|---|---|
| Core i3 | Entry-level desktop/laptop |
| Core i5 | Mid-level computing |
| Core i7 | High-end / high performance |
Cache: larger L3 cache speeds up repetitive tasks and multitasking — background tasks stay "ready" in cache when you switch windows. Desktop i5: 3–8 MB L3. Desktop i7: 8–15 MB L3.
Turbo Boost
Intel's built-in "overclocking" feature: lets the processor exceed its base clock speed when only one or two cores are actually needed (e.g. a demanding single-threaded task), by effectively powering down unused cores. Both Core i5 and Core i7 support Turbo Boost; it's activated when the OS requests the highest performance state, and its frequency ceiling is highest on Core i7.
| Active cores | Mode | Base frequency | Max Turbo Boost frequency |
|---|---|---|---|
| 4 | Quad-Core | 1.73 GHz | 2.0 GHz |
| 2 | Dual-Core | 1.73 GHz | 2.8 GHz |
| 1 | Single-Core | 1.73 GHz | 3.06 GHz |
Note the pattern: base frequency stays fixed at 1.73 GHz regardless of how many cores are active, but the fewer cores in use, the higher Turbo Boost can push the active core(s).
Hyper-Threading
Intel Hyper-Threading uses multi-threading so a processor appears to have more cores than it physically does, to the OS and applications — useful for multitasking, multimedia transcoding/rendering, and web loads with several simultaneous elements.
| CPU | Hyper-Threading behavior |
|---|---|
| Core i7 (all variants) | Always uses HT. 6-core → 12 streams, 4-core → 8 streams, dual-core → 4 streams. |
| Core i5 | Uses HT to make a dual-core act like 4 threads. A 4 true-core i5 will not have HT. Tops out at 4 streams either way. |
Integrated graphics
Graphics built directly into the processor core (rather than the motherboard chipset, as in older designs). Saves power since there's no separate graphics chip drawing current on the board.
Updated microprocessors used in 2026
Precision Boost Overdrive (PBO) — AMD Ryzen
What it is: a Ryzen feature that pushes CPU frequency higher than stock boost, in real time, without manual overclocking — as long as cooling is sufficient.
How it works: increases voltage and wattage to extract more performance within the thermal limits available, going beyond default power limits. Easier to use than manual overclocking, though manual OC can still edge out slightly higher performance.
Getting the most from it: pair PBO with AMD's Curve Optimizer (CO) to adjust the voltage-frequency curve per core (or all cores) — effectively undervolting to reach higher frequencies within thermal limits.
| Adjustable PBO-related BIOS settings |
|---|
| PBO Limits |
| Precision Boost Overdrive Scalar Control |
| CPU Boost Clock Override |
| Platform Thermal Throttle Control |
| Curve Optimizer |
| Curve Shaper |
DMA & Microcontroller
DMA Module · 8-Step Sequence · Microcontroller ConceptsWhy DMA?
Programmed I/O and interrupt-driven I/O both need active CPU involvement, which caps the transfer rate and ties up the CPU. Programmed I/O gets high transfer rates but the CPU does nothing else meanwhile; interrupt I/O frees the CPU somewhat but at the cost of transfer rate. DMA (Direct Memory Access) solves both: an extra hardware module moves data directly between memory and I/O, without routing it through the processor.
DMA function
The DMA controller is an additional module on the system bus. It takes over from the CPU for I/O transfers, and must either wait to use the bus only when the CPU doesn't need it, or force the CPU to briefly suspend operation.
What the CPU tells the DMA controller (once, up front)
- Read or write
- Device address
- Starting address of the memory block
- Amount of data to transfer
After that, the CPU carries on with other work. The DMA module transfers data one word at a time, directly to/from memory, and interrupts the CPU only once — when the whole transfer is finished. So the CPU is involved only twice: at the start and at the end.
The 8-step DMA transfer sequence
- µP initializes the DMAC by giving it the starting address and the number of bytes to transfer.
- An I/O device requests the DMAC to perform a DMA transfer, through the DREQ line.
- The DMAC in turn sends a request signal to the µP, through the HOLD line.
- The µP finishes its current machine cycle and releases the system bus (disconnects from it), and acknowledges the HOLD signal through the HLDA line.
- The DMAC acquires control of the system bus, and sends the DACK signal to the I/O peripheral — the DMA transfer begins.
- After every byte transferred, the Address register is incremented (or decremented) and the Count register is decremented.
- This continues until the Count reaches zero (Terminal Count) — the DMA transfer is now complete.
- At the end, the DMAC releases the system bus by setting HOLD = 0. The µP takes back control of the system bus and continues its own operation.
DMA module diagram
Internally, the module holds a Data Count register, a Data Register, an Address Register, and Control Logic that manages the DMA Request/Acknowledge handshake, raises an interrupt when done, and drives Read/Write.
Intel 8237 DMA controller — key signals
| Signal | Function |
|---|---|
| D[7..0] | System (ISA) bus lines the µP uses to write to the 8237's internal registers. |
| A[19..0] | Carries the memory address the DMA writes transferred data to; also addresses the 8237 itself via the lower bits. |
| ALE | Address latch enable, used by the 8237 when driving the system bus. |
| MEMR / MEMW | Memory read / write, issued by the 8237 while driving the bus. |
| IOR / IOW | I/O device read / write, issued by the 8237 while driving the bus. |
| HLDA | Asserted by the µP to say it has released the system bus. |
| HRQ | Asserted by the 8237 to request the µP release the bus. |
| REQ 0–3 / ACK 0–3 | Per-channel: device requests a transfer / 8237 grants it. |
Devices that typically use DMA: floppy drive, hard drive, sound card.
DMA bus configurations
| Configuration | Behavior |
|---|---|
| 1. Single bus, detached DMA controller | Each transfer uses the bus twice (I/O→DMA, then DMA→memory). CPU suspended twice per word. Cheap but inefficient. |
| 2. Single bus, integrated DMA controller | Controller may support >1 device. Each transfer uses the bus once (DMA→memory directly). CPU suspended once. Far fewer bus cycles needed. |
| 3. Separate I/O bus | A dedicated bus supports all DMA-enabled devices. Each transfer uses the bus once; CPU suspended once. |
Microcontroller concepts
Microprocessor — a processing unit with basic I/O interfacing and off-chip memory (e.g. 8008, 8080, 8086, 80286, Pentium).
Single-chip microcomputer — a processing unit with on-chip memory, I/O devices, and often extra peripherals like timers and A/D converters (e.g. Intel 8048, 8051, Motorola 68HC11/12).
Microcontroller — an I/O-oriented single-chip microcomputer, distinguished from other single-chip microcomputers by:
- Extended I/O: sync/async communication devices, A/D and D/A converters, timers, counters, watchdogs.
- Interrupt handling: more levels of interrupt priority, and the ability to mask individual interrupts.
- Instruction set: instructions oriented toward bit-manipulation — operating on single bits of memory words or I/O ports.