In this type of CPU organization:
The CPU has a set of general-purpose registers (like R0, R1, … Rn).
These registers can be used for any purpose, such as holding operands for the ALU, storing temporary results, or addresses.
Most instructions can directly use registers for operations instead of memory.
Think of registers as a fast scratchpad for the CPU.
2. Basic Components in this Organization
Registers (General-Purpose Registers)
Usually 8, 16, or 32 registers.
Used for arithmetic, logic, and data storage during execution.
Example: R0, R1, …, R7.
ALU (Arithmetic and Logic Unit)
Performs operations like ADD, SUB, AND, OR, etc.
Gets inputs from registers and stores result back to a register.
Instruction Register (IR)
Holds the current instruction being executed.
Program Counter (PC)
Points to the next instruction in memory.
Memory Address Register (MAR) & Memory Data Register (MDR)
MAR: Holds memory addresses.
MDR: Holds data read from or written to memory.
**
- How It Works (Data Flow)** CPU fetches instruction from memory → stores it in IR.
Decodes instruction → determines operation and operands.
If operands are in registers, ALU executes operation.
Result is stored back in a register (or memory if needed).
Key idea: Most operations happen within registers, minimizing memory access and speeding up execution.
4. Example Operation
Suppose we want to compute:
C = A + B
In a general register-based CPU:
`- Load A into R1 → LOAD R1, A
- Load B into R2 → LOAD R2, B
- Add → ADD R3, R1, R2 (R3 = R1 + `R2)
- Store result → STORE C, R3`
Notice how all calculations happen in registers.
5. Advantages
- Faster than memory-based operations.
- Flexible: any register can hold any operand.
- Simplifies instruction format (register-to-register instructions are easier to encode).
6. Disadvantages
- Limited number of registers.
- Requires careful compiler or programmer management.
- Data still needs to be loaded/stored from memory eventually.
Top comments (0)