![]() |
VOOZH | about |
General Register-Based CPU Organization, uses multiple general-purpose registers instead of a single accumulator.
Each instruction in this organization typically includes two or three address fields. These address fields specify:
Any register can be used as a source or destination, making programs shorter and faster.
A three-address instruction explicitly specifies two source operands and one destination operand:
For example:
MULT R1, R2, R3 ; R1 ← R2 × R3
R2andR3contain the operands.- The result of
R2 × R3is stored inR1.
This format:
A two-address instruction specifies one source and one destination, but one of them also serves as both source and destination:
For example: MULT R1, R2 ; R1 ← R1 × R2
- R1 and R2 contains operands.
- The result of R1 x R2 is stored in R1 itself.
This format:
The CPU contains a register file, which is a collection of high-speed storage elements. These registers can hold:
Having multiple registers means frequently used data can remain inside the CPU, avoiding repeated fetching from memory.
Accessing data stored in registers is much faster than accessing data from main memory. Since most arithmetic and logical operations use operands stored in registers, execution time per instruction is reduced.
Example:
If a CPU takes:
- 1 cycle to access a register, and
- 100 cycles to access memory,
then avoiding unnecessary memory access can dramatically improve performance.
ALU can directly operate on data stored in registers. This eliminates the need for temporary memory transfers.
For example:
- ADD R1, R2, R3
is faster than:
- LOAD R2, M1
- LOAD R3, M2
- ADD R1, R2, R3
- STORE M3, R1
because the first case avoids memory fetches altogether.
In multitasking systems, the CPU saves the contents of all registers to memory during a context switch and restores them later to ensure each process resumes correctly.