Understanding Instruction Cycle?

Click For Summary

Discussion Overview

The discussion revolves around the instruction cycle in computer architecture, specifically focusing on the significance and function of the Memory Access (MA) stage. Participants explore the stages of the instruction cycle, their dependencies, and the conditions under which certain stages may or may not occur. The conversation includes technical reasoning and examples related to load/store architectures.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • Some participants outline the basic stages of the instruction cycle, emphasizing that the MA stage involves memory reads, while the Write Back (WB) stage involves writing back to memory.
  • Others argue that the MA and WB stages do not always occur, particularly in operations that only involve registers, suggesting that the instruction cycle consists of "possible" stages rather than fixed ones.
  • A participant mentions that memory access can be complex, involving data movement between different levels of memory, depending on the instruction type.
  • There is a discussion about the order of the MA stage relative to the Execute (EX) stage, with some suggesting that MA should occur before EX to provide necessary data.
  • Participants provide examples of load and store instructions, questioning how the MA stage operates in these contexts and what it entails.
  • One participant clarifies that in a load/store architecture, all operations must involve loading data from memory into registers before any computation can occur.
  • Another participant seeks validation for their understanding of how the MA stage functions for specific instructions, indicating a need for clarification on the role of memory access in the instruction cycle.

Areas of Agreement / Disagreement

Participants express differing views on the necessity and order of the MA stage within the instruction cycle. There is no consensus on the fixed nature of the stages, and multiple interpretations of the MA stage's role are present.

Contextual Notes

Participants highlight that the execution of certain instructions may not require memory access, which introduces uncertainty regarding the necessity of the MA stage in various contexts. The discussion also reflects dependencies on specific instruction sets and architectural designs.

Who May Find This Useful

This discussion may be useful for students and professionals interested in computer architecture, instruction cycles, and the intricacies of load/store architectures.

22990atinesh
Messages
143
Reaction score
1
A basic instruction cycle consists of these 5 stages.

1. IF - Instruction Fetch
2. RD - Instruction Decode and Register Read
3. EX - Execute
4. MA - Memory Access
5. WB - Write Back

I understood the meaning of all the stages accept 4th MA (Memory access), what's the significance of this stage.
 
  • Like
Likes   Reactions: Medicol
Technology news on Phys.org
Step 4 Memory access - implies memory reads, since step 5 includes write back, which I assume means write back to memory.

Step 2 - register read - this doesn't always happen, at least not at step 2. Take the case of an add immediate to memory / subtract immediate from memory / compare immediate with memory. The memory read needs to occur before the add / subtract / compare can occur.
 
  • Like
Likes   Reactions: Medicol
steps 4 and 5 also do not always happen. If, for example, you perform an operation that just changes a register or moves one register's value to another register or stuff like that, there is no need for any memory access beyond the instruction fetch.

SO ... your statement really should say "A basic instruction cycle consists of these 5 POSSIBLE stages."
 
Last edited:
  • Like
Likes   Reactions: Medicol and jim mcnamara
Everything starts in memory, even the program instructions. Your example is getting data that the program needs. As @phinds says, the memory access you are referring to may not be necessary for some instructions. Many instructions need to use some data that is stored in memory. When data from memory is needed, it can be quite involved. It may require moving data from the slowest level of memory, to an intermediate speed memory, to the fastest access memory. The processor may have looked ahead and began pulling the data in several cycles early so it would be immediately available in the fastest memory when this instruction is executed.
 
  • Like
Likes   Reactions: Medicol
Yeah Surely MA stage wouldn't do anything, if we have to operate operands from registers itself.
Over Internet what I've found is this

MA(Memory Access) does following operation

• If load or store instruction, then access memory
• If branch instruction, replace PC with destination address

##2^{nd}## point is clear, I'm confused with ##1^{st}## point.

Suppose we have load and store instruction like this
##R_1 \leftarrow m[A_1##]
##m[A_2] \rightarrow R_2##
##R_3 \leftarrow m[A_3] + m[A_4]##
what MA stage will do for the above instructions
 
I think you have the MA out of order. It should be before EX if it refers to getting the data that EX needs for its operation. Maybe the instruction set you are using does not exactly match up with the conceptual partitioning of your original post, but data must be brought from memory somewhere in your notation.
 
22990atinesh said:
what MA stage will do for the above instructions
I think I must be missing something in your question. You seem to be asking "when the instruction requires a memory fetch, what does the memory fetch do?" It fetches from memory.
 
phinds said:
I think I must be missing something in your question. You seem to be asking "when the instruction requires a memory fetch, what does the memory fetch do?" It fetches from memory.

Actually The exam I'm preparing for, asks questions on pipe-lining on load and store architecture. So it is irrelevant to mention

##R_3 \leftarrow m[A_3] + m[A_4]##

because a load/store architecture only allows memory to be accessed by load and store operations, and all values for an operation need to be loaded from memory and be present in registers. So a load/store architecture only allows operations like

##(I) R_1 \leftarrow m[A_1]##
##(II) m[A_2] \leftarrow R_2##
##(III) R_3 \leftarrow R_4 + R_5##

Now, I've this following concept in my mind. Please suggest whether I'm right or wrong.

1. For instruction (I) MA stage will fetch data from memory from a particular address and will write back into register ##R_1## at WB stage.
2. For instruction (II) MA stage will store data of register ##R_2## into memory at specified address.
 

Similar threads

  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 14 ·
Replies
14
Views
5K
Replies
25
Views
10K
  • Sticky
  • · Replies 13 ·
Replies
13
Views
8K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 1 ·
Replies
1
Views
1K