Summary Table
Register Type | Purpose |
---|---|
Accumulator (AC) | Temporary storage for ALU results. |
Program Counter (PC) | Tracks the address of the next instruction. |
Memory Address Register (MAR) | Holds memory location addresses. |
Memory Data Register (MDR) | Buffers data being transferred to/from memory. |
Instruction Register (IR) | Stores the current instruction. |
General Purpose Registers (GPRs) | Temporary storage for variables or addresses. |
Index Register (IX) | Used in indexed addressing modes. |
Stack Pointer (SP) | Tracks the top of the stack. |
Status Register | Holds flags for processor state. |
Base Register | Stores the base address of memory segments. |
I/O Registers | Buffer for data from I/O devices. |
Floating-Point Registers | Stores floating-point numbers. |
Registers are small, high-speed storage units in a computer processor that temporarily hold data, instructions, or addresses during execution. They play a crucial role in the functioning of the CPU. Here are the major types of registers used in computer organization:
1. Accumulator (AC)
- Purpose: Temporarily stores intermediate results of arithmetic and logical operations.
- Function: Acts as a default register for the Arithmetic Logic Unit (ALU) during calculations.
- Example: Used to store the result of an addition before moving it to memory.
2. Program Counter (PC)
- Purpose: Holds the address of the next instruction to be executed.
- Function: Automatically increments after fetching an instruction, ensuring sequential execution.
- Example: If the current instruction is at memory address 1000, the PC points to 1001.
3. Memory Address Register (MAR)
- Purpose: Stores the address of a memory location that is to be accessed.
- Function: Acts as a bridge between the CPU and memory during read/write operations.
- Example: If the CPU needs to fetch data from address 2000, the MAR holds “2000.”
4. Memory Data Register (MDR) / Data Register (DR)
- Purpose: Temporarily holds data being transferred to/from memory.
- Function: Acts as a buffer between the CPU and memory.
- Example: Stores the data fetched from memory before it’s processed by the CPU.
5. Instruction Register (IR)
- Purpose: Holds the current instruction being executed.
- Function: Decodes and prepares the instruction for execution.
- Example: If the fetched instruction is “ADD A, B,” the IR temporarily holds this command.
6. General Purpose Registers (GPRs)
- Purpose: Used for temporary storage of data during program execution.
- Function: Can store variables, intermediate results, or addresses.
- Example: Registers labeled as R0, R1, R2 in some CPUs.
7. Index Register (IX)
- Purpose: Holds an index value for memory addressing.
- Function: Supports indexed addressing modes, where the memory address is calculated by adding a constant value to the index register.
- Example: Accessing array elements in a loop.
8. Stack Pointer (SP)
- Purpose: Points to the top of the stack in memory.
- Function: Tracks the address of the last accessed stack location during function calls or interrupts.
- Example: When a function is called, the return address is pushed onto the stack.
9. Status Register / Flags Register
- Purpose: Indicates the current state of the processor and outcomes of operations.
- Function: Holds flags for conditions like zero (Z), carry (C), sign (S), or overflow (O).
- Example: After a subtraction, the zero flag is set if the result is zero.
10. Base Register
- Purpose: Holds the starting address of a memory segment.
- Function: Used in segmented memory addressing.
- Example: When a program is loaded, the base register points to the starting address of its memory block.
11. Input/Output Registers (I/O Registers)
- Purpose: Temporarily store data exchanged between the CPU and I/O devices.
- Function: Facilitates communication between the processor and peripherals.
- Example: Data from a keyboard or to a display.
12. Floating-Point Registers
- Purpose: Store floating-point numbers during arithmetic operations.
- Function: Used in processors that support floating-point operations (e.g., scientific calculations).
- Example: Registers in a GPU or a math co-processor.
Conclusion
Registers are essential components of a CPU, ensuring high-speed data access and smooth program execution. Each register has a specific function, contributing to the overall efficiency of the computer system.