Steps in fetching a word from memory are as follows :
Step 1 : The CPU has to perform opcode fetch cycle and operand fetch cycle.
Step 2 : The opcode fetch cycle gives the operation code of fetching a word from memory to the CPU.
Step 3 : The CPU then invokes the operand fetch cycle.
Step 4 : The opcode specifies the address of memory location where the information is stored.
Step 5 : The CPU transfers the address of required word of information to the Address Register (AR), which is connected to the address lines of the memory bus. Hence, the address is transferred to the memory.
Step 6 : The CPU activates the read signal of the memory to indicate that a read operation is needed.
Step 7 : As a result, memory copies data from the addressed register on the data bus.
Step 8 : The CPU then reads this data from the data register and loads it in the specified register.
Step 9 : Memory Functions Completed (MFC) is also used as a control signal for this memory transfer.
Step10 : Memory sets MFC to 1 to indicate that the contents of the specified location have been read and are available on the data bus.
Difference :
| Feature | Branch Instruction | Call Subroutine Instruction |
|---|---|---|
| Purpose | Alters the sequence of program execution based on a condition | Invokes a subroutine (a specific task) and returns to the next instruction |
| Functionality | Changes program flow by jumping to a different location | Transfers control to a subroutine and returns to the next instruction after completion |
| Usage | Conditional execution or loop control | Modularizing code for reuse and organization |
| Effect on Program Flow | May cause program to skip or repeat sections based on condition | Temporarily diverts program flow to execute a specific task |
| Example | If-else statements, loops (e.g., for, while) | Calling a function or method |
Discussion
Ask a question, share your thoughts or report an error.
Sign in to participate in the discussion.
Join the discussion