Bus,Reg, Merge
Bus,Reg, Merge
They allow the CPU to communicate with memory, input/output (I/O) devices, and other
components.
They reduce the number of physical connections by using a shared data path.
Types of Buses
Purpose: Transfers actual data between the CPU, memory, and I/O devices.
Direction: Bidirectional (data flows both ways).
Size: The width of the data bus determines how much data can be transferred at once.
Example: An 8-bit data bus can transfer 8 bits at a time.A 32-bit data bus can transfer
32 bits at a time, making it faster.
Real-Life Example: Think of a water pipeline where the size of the pipe determines how
much water can flow through at a time.
Purpose: Transfers the address of memory locations or I/O devices that the CPU wants
to read from or write to.
Direction: Unidirectional (data flows in one direction, from CPU to memory or I/O
devices).
Size:A 16-bit address bus can access 2¹⁶ = 65,536 memory locations.A 32-bit address
bus can access 2³² = 4,294,967,296 memory locations.
Real-Life Example: Think of a house address system, where each house has a unique
address. The CPU uses addresses to find data just like a postman finds houses.
Purpose: Sends control signals to manage operations like reading, writing, and interrupt
handling.
Direction: Both bidirectional and unidirectional, depending on the signal.
Common Control Signals:
Read signal: Tells memory or an I/O device to send data to the CPU.
Buses are divided into two types based on their location inside or outside the CPU:
These buses help in transferring data between different parts of the computer.
Definition: The Internal Bus, also called the System Bus, is used to transfer data inside
the CPU and between the CPU and memory.
Purpose: It connects the CPU’s internal components like the Arithmetic Logic Unit (ALU),
registers, and control unit.
It also connects the CPU and RAM (main memory) to allow fast data processing.
Example: When the CPU processes an instruction, it uses the Internal Bus to fetch data
from memory, perform calculations, and store results.
Definition: The External Bus, also called the I/O Bus or Expansion Bus, connects the
CPU to external devices like the keyboard, mouse, printer, USB drive, and hard disk.
Purpose:
1. USB (Universal Serial Bus) → Connects external devices like keyboards, mice, printers,
and flash drives.
2. PCI (Peripheral Component Interconnect) → Connects graphics cards, sound cards, and
network adapters.
3. SATA (Serial ATA) → Connects internal and external storage devices like hard drives and
SSDs.
Example: When you connect a USB flash drive to a computer, the External Bus transfers
data between the USB and the CPU.
Internal Bus = Inside the CPU → Used for fast communication between CPU and memory.
External Bus = Outside the CPU → Used for connecting external devices like USB, hard disks, and
displays.
A register is a small, high-speed storage unit inside the CPU. It stores temporary data,
instructions, and addresses.
Types of Registers
c) Accumulator (AC)
Holds the memory address that the CPU wants to read from or write to.
Works with the address bus.
Stores condition flags that indicate the state of the CPU after an operation.
Important flags:
MOV A, 5
Here the number 5 is directly given in the instruction and moved into register A.
Fast execution but limited by instruction size (only small values can be used).
MOV A, B
MOV A, [2000]
This means "move the value stored in memory location 2000 into register A."
Simple to understand but fixed address reduces flexibility.
Example:
MOV A, [R1]
This means "move the data from the memory address stored in R1 into A."
Allows dynamic memory access but slower due to extra memory access.
5. Indexed Addressing Mode
This means "move the value stored at the calculated address into A."
Similar to indirect addressing but uses a register like BX to hold the memory address.
Example:
MOV A, [BX]
This means "move the value from memory address stored in BX into A."
Flexible memory access but needs extra instruction to load address in BX.
Example:
JUMP 10
Flag Register
The flag register is a special-purpose register that contains individual bits (flags) representing the
status of the CPU or the result of operations. Below are the 10 common types of flags in the x86
architecture:
Types of Flags:
Set if there is a carry out of the most significant bit (MSB) in arithmetic operations.
Used in unsigned arithmetic.
Set if there is a carry out of the lower nibble (4 bits) in arithmetic operations.
Used in BCD (Binary-Coded Decimal) arithmetic.