Discussion
Consider a processor P 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 Z = X + Y ?
Note: X, Y, and Z are memory operands. R0, R1, and R2 are registers.
Answer: D
The correct sequence is LOAD R0, X / LOAD R1, Y / ADD R2, R0, R1 / STORE Z, R2.
In a load-store architecture only LOAD and STORE may access memory; arithmetic instructions work on registers only. So both operands must first be loaded into registers, added register to register, and the result stored back to Z.
ADD Z, X, Y uses three memory operands. 'LOAD R0, X / ADD Z, R0, Y' still has the ADD reading Y from memory and writing Z to memory. 'ADD R0, X, Y / STORE Z, R0' has the ADD reading X and Y from memory. Each breaks the load-store rule.
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development