Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors

Write the steps in fetching a word from memory.Differentiate between a branch instruction and call sub routine instruction.

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 :

FeatureBranch InstructionCall Subroutine Instruction
PurposeAlters the sequence of program execution based on a conditionInvokes a subroutine (a specific task) and returns to the next instruction
FunctionalityChanges program flow by jumping to a different locationTransfers control to a subroutine and returns to the next instruction after completion
UsageConditional execution or loop controlModularizing code for reuse and organization
Effect on Program FlowMay cause program to skip or repeat sections based on conditionTemporarily diverts program flow to execute a specific task
ExampleIf-else statements, loops (e.g., for, while)Calling a function or method

Leave a Comment