Consider a processor whose instruction set architecture is the load-store architecture. The instruction format is such that the first operand of any instruction is the destination operand.
Which one of the following sequences of instructions corresponds to the high-level language statement ?
Note: X, Y, and Z are memory operands. R, R, and R are registers.
View worked solution
Answer: D
In a load-store architecture (such as RISC), arithmetic and logical instructions (like ADD) cannot directly access memory operands. They can only operate on processor registers. Memory access is strictly restricted to dedicated LOAD and STORE instructions.
Let's analyze the given high-level statement: , where , , and are memory operands.
- Load into a register:
LOAD R0, X(loads the value of memory location into register ) - Load into another register:
LOAD R1, Y(loads the value of memory location into register ) - Perform the addition using registers:
ADD R2, R0, R1(computes ) - Store the result back to memory location :
STORE Z, R2(stores the value of register into memory location )
Evaluating the options:
- Option A:
ADD Z, X, Yattempts to perform addition directly on memory operands, which is invalid in a load-store architecture. - Option B:
ADD Z, R0, Yattempts to use memory operands and directly in anADDinstruction, which is invalid. - Option C:
ADD R0, X, Yattempts to use memory operands and directly in anADDinstruction, which is invalid. - Option D: Correctly adheres to the load-store architecture constraints by loading operands into registers first, performing the addition on registers, and then storing the result back to memory.
Free practice · Your answers on this page are not saved.
