Home » Computer Organization and Architecture » Computer organization and architecture miscellaneous » Question

Computer organization and architecture miscellaneous

Computer Organization and Architecture

Direction: Consider the following program segments. Here R1, R2 and R3 are purpose registers.

Instruction Operation Instruction size
(number of words)
MOV R1, 3000 R1 ← M [3000] 2
LOOP MOV R2 , R3 R2 ← M [R3] 1
ADD R2, R2 ← R1 + R2 1
MOV R3 , R2 M[R3] ← R2 1
INC R3 R3 ← R3 + 1 1
DEC R1 R1 ← R1 – 1 1
BNZ LOOP Branch on not zero 2
HALT Stop 1

Assume that the content of memory location 3000 is 10 and the content of the register R3 is 2000. The content of each of the memory locations from 2000 to 2010 is 100. The program is loaded from the memory location 1000. All the numbers are in decimal.

  1. Assume that the memory is byte addressable and the word size is 32 bit. If an interrupt occurs during the execution of the instruction INC R3, what return address will be pushed on to the stack?
    1. 1005
    2. 1020
    3. 1024
    4. 1040
Correct Option: C

An interrupt is checked for after the execution of the current instruction and the contents of PC (address of next instruction to be executed) is pushed on to stack.

Here, address of INC, R3 = 1000 + (2 + 1 + 1 + 1) *
32
= 1020
8

and next instruction address = 1020 + 4 = 1024 , which is pushed on to stack.



Your comments will be displayed only after manual approval.