CPU components are not the easiest ones to understand. There is simply way too much going on in those tiny little things. An aspiring student of CPU’s may ask what component of a processor that holds instructions waiting to be processed by the ALU?
The simple answer is: Cache Levels or RAM. However, RAM is not part of the Processor; the Cache Level Memories are PART of the processor.
Read more here: Does Each Core Have Its Own L1 and L2 Cache?
Another in-depth perspective would tell you that it is stored in Registers. Specifically, the Accumulator Registers. The immediate place where the ALU fetches data from are the registers.
Before Accumulators, the instruction is stored in Current Instruction Registers and before that it is moved to Memory Data Registers and Before that, it is stored in either Cache Memory or RAM. I am sure I have confused you. In short, here are the steps:
Generally, the following components are activated in sequence before the instruction/data reaches the ALU.
- 2Memory Data Registers
- 3Current Instruction Registers
- 5Accumulator Register
As you can see, the component that holds data JUST before ALU is NOT the Cache/RAM, it is the Accumulator Register.
Accumulators vs Other Registers
There are many types of registers. However, Accumulators are the ones that hold the instructions required by the ALU immediately.
Other types of registers include, Program Counter, Current Instruction Register, Memory Address Register and Memory Data Register.
What is the Difference Between Registers and Memory?
Registers are located within CPU and are extremely fast. As a rule of thumb, all data must be first transferred to registers before it can be processed.
The primary difference between Registers and Memory is that registers hold the data that CPU will be processing IMMEDIATELY. Whereas, memory holds the data that will be required for processing at a later stage.
In essence Registers are a type of memory.
A CPU follows a general Fetch Decode and Execute cycle.
In this stage, the processor fetches the instruction from the memory, such as Cache Levels or RAM and stores them in registers. This is how it goes:
- 1Program Counter:
The Program Counter Registers holds the address for the NEXT instruction to be fetched.
- 2Memory Address Register:
This instruction is placed into the Memory Address Register. You can think of this as redundancy or a way to improve efficiency, since the Program Counter Register increments in number almost immediately after that.
- 3Memory Data Register:
Now, the contents of the memory address will be loaded. Therefore, the instructions stored in a particular Cache Level or RAM will be loaded onto to Memory Data Register.
- 4Current Instruction Register:
The instruction stored in Memory Data Register is then placed into Current Instruction Register.
At this stage, the Control Unit retrieves the Instruction from the Current Instruction Register and decodes it by determining what needs to be activated.
The content of the memory is then loaded onto Memory Data Register.
Next, the content of that Memory Data Register is then placed into the Accumulator Register.
If the next instruction is to perform a certain operation like Add or Subtract. THIS is where the ALU starts to matter.
The Data from the Accumulator is moved to the ALU and depending on whether the next instruction is i.e ADD/Subtract etc, it performs the action.
Fetch-Decode-Execute in Action
Where Does Cache Memory Fit Into This?
We now know that accumulator registers are the immediate place where the ALU takes the data from.
However, the Accumulator just stores the data TEMPORARILY. They do not themselves have any intrinsic instruction or data stored in them.
Cache Levels are the place where the most frequent instruction and Data are stored. Therefore, you wouldn’t be incorrect if you say that these are the component of a processor that holds instructions waiting to be processed by the ALU
Since there are Levels of Cache i.e (L1, L2 and L3), the most frequent ones will be stored on to the closest levels i.e (L1).
If the CPU cannot find instruction in the Cache Levels, it then fetches instructions and temporary data stored in RAM.
So What is the Name of the Component of a Processor That Holds Instructions Waiting to be Processed by the ALU?
The answer is that it depends upon your perspective. You could say that it is the accumulator register if you want to be very precise. Otherwise, Cache Level memories are generally the common answer to this question.