0% found this document useful (0 votes)
6 views

Bus,Reg, Merge

The document provides an overview of buses, registers, and addressing modes in computer organization. It explains the types of buses (data, address, control) and their functions, as well as the importance of registers for fast data processing and various addressing modes for efficient instruction execution. Additionally, it details the flag register and its role in indicating the status of the CPU after operations.

Uploaded by

mirzadimple4
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Bus,Reg, Merge

The document provides an overview of buses, registers, and addressing modes in computer organization. It explains the types of buses (data, address, control) and their functions, as well as the importance of registers for fast data processing and various addressing modes for efficient instruction execution. Additionally, it details the flag register and its role in indicating the status of the CPU after operations.

Uploaded by

mirzadimple4
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Buses , Registers and addressing mode in Computer Organization

Buses in Computer Organization

A bus is a communication system that transfers data between different components of a


computer. It consists of wires, circuits, and protocols that help in data transfer.

Why Are Buses Important?

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

Data Bus (Carries Data)

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.

Address Bus (Carries Memory Addresses)

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.

Control Bus (Carries Control Signals)

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.

Write signal: Tells memory or an I/O device to store data.


Interrupt signal: Tells the CPU that an external device needs attention.
Real-Life Example: Think of a traffic signal controlling the flow of vehicles at an
intersection. The control bus directs the data traffic.
Types of Buses Based on Location

Buses are divided into two types based on their location inside or outside the CPU:

1. Internal Bus (System Bus)


2. External Bus (I/O Bus or Expansion Bus)

These buses help in transferring data between different parts of the computer.

Internal Bus (System Bus) – Inside the CPU

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.

Parts of Internal Bus:

1. Data Bus → Transfers actual data inside the CPU.

2. Address Bus → Transfers memory addresses inside the CPU.

3. Control Bus → Transfers control signals to manage CPU operations.

Example: When the CPU processes an instruction, it uses the Internal Bus to fetch data
from memory, perform calculations, and store results.

Real-Life Example: Think of an internal telephone system in an office that connects


different departments but does not allow outside calls.

External Bus (I/O Bus or Expansion Bus) – Outside the CPU

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:

• It allows communication between the computer’s internal components and external


devices.
• It helps in expanding the computer by adding new hardware components.
Common Types of External Buses:

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.

4. HDMI (High-Definition Multimedia Interface) → Connects display screens, projectors, and


TVs.

Example: When you connect a USB flash drive to a computer, the External Bus transfers
data between the USB and the CPU.

Real-Life Example: Think of an external telephone network that connects a company’s


office phones to the outside world.

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.

Registers in Computer Organization

A register is a small, high-speed storage unit inside the CPU. It stores temporary data,
instructions, and addresses.

Why Are Registers Important?

• They help in fast processing by reducing memory access time.


• They store intermediate results of calculations.
• They control CPU operations efficiently.

Types of Registers

General-Purpose Registers (GPRs)


Used to store temporary data for processing.
Example registers in 8086 processor:
• AX (Accumulator Register): Used for arithmetic and logic operations.
• BX (Base Register): Used for memory addressing.
• CX (Counter Register): Used in loops and counting operations.
• DX (Data Register): Used for I/O operations and multiplication.
Special-Purpose Registers (For CPU Control)

a) Program Counter (PC)

Stores the address of the next instruction to be executed.


It increases automatically after each instruction.

b) Instruction Register (IR)

Stores the current instruction that is being executed.


The CPU fetches instructions from memory and stores them in IR.

c) Accumulator (AC)

Holds intermediate results of arithmetic and logic operations.


Works closely with the ALU (Arithmetic Logic Unit).

d) Stack Pointer (SP)

Points to the top of the stack in memory.


The stack is used for function calls, storing return addresses, and local variables.

e) Memory Address Register (MAR)

Holds the memory address that the CPU wants to read from or write to.
Works with the address bus.

f) Memory Data Register (MDR)

Holds the actual data that is being read or written.


Works with the data bus.

g) Status Register (Flags Register)

Stores condition flags that indicate the state of the CPU after an operation.
Important flags:

Zero Flag (Z): Set if the result is zero.

Carry Flag (C): Set if there is a carry in arithmetic operations.

Sign Flag (S): Set if the result is negative.

Overflow Flag (O): Set if an arithmetic overflow occurs.


Addressing Modes in Computer Organization and Architecture
• Addressing modes define how an instruction finds the required data (operand) for
execution. These modes help in efficient memory access and instruction execution.

1. Immediate Addressing Mode

The operand (data) is directly given in the instruction.


No memory access is needed since the value is inside the instruction itself.
Example:

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).

2. Register Addressing Mode

The operand is stored inside a register.


The instruction specifies the register containing the data.
Example:

MOV A, B

This means "copy the value of register B into register A."


Very fast (no memory access needed) but limited number of registers.

3. Direct Addressing Mode

The memory address of the operand is given directly in the instruction.


Example:

MOV A, [2000]
This means "move the value stored in memory location 2000 into register A."
Simple to understand but fixed address reduces flexibility.

4. Indirect Addressing Mode

The address of the operand is stored inside a register.


The instruction tells the CPU to fetch the actual data from the memory location stored in that
register.

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

The memory address is calculated as:


Base Address + Index
Example:

MOV A, [Base + Index]

This means "move the value stored at the calculated address into A."

Good for arrays but requires additional calculations.

6. Register Indirect Addressing Mode

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.

7. Relative Addressing Mode

Used for branching or jumping in programs.

The address is calculated relative to the Program Counter (PC).

Example:

JUMP 10

This means "jump 10 instructions ahead from the current position."


Efficient for loops and jumps but limited range of jump.
 Flag Register (FLAGS):
o Contains status flags that reflect the outcome of arithmetic and logical operations.
o Used for conditional branching and control flow.

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:

1. Carry Flag (CF)

 Set if there is a carry out of the most significant bit (MSB) in arithmetic operations.
 Used in unsigned arithmetic.

2. Parity Flag (PF)

 Set if the number of set bits in the result is even.


 Used for error checking.

3. Auxiliary Carry Flag (AF)

 Set if there is a carry out of the lower nibble (4 bits) in arithmetic operations.
 Used in BCD (Binary-Coded Decimal) arithmetic.

4. Zero Flag (ZF)

 Set if the result of an operation is zero.


 Used for conditional branching.

5. Sign Flag (SF)

 Set if the result of an operation is negative (MSB is 1).


 Indicates the sign of the result.

6. Trap Flag (TF)

 Used for single-step debugging.


 When set, the CPU generates an interrupt after each instruction.

7. Interrupt Enable Flag (IF)

 Enables or disables hardware interrupts.


 When set, interrupts are enabled.

8. Direction Flag (DF)

 Determines the direction of string operations.


 When set, string operations decrement the index registers (SI and DI).

9. Overflow Flag (OF)

 Set if there is a signed overflow in arithmetic operations.


 Used in signed arithmetic.

10. Resume Flag (RF)

 Used for debugging to control the resumption of execution after an exception.

You might also like