# GATE | Sudo GATE 2020 Mock II (10 January 2019) | Question 41

Consider the following instruction sequence in a RISC machine :

Conditional and unconditional branch instructions use PC- relative addressing mode with Offset specified in bytes to the target location of the branch instruction. Further the Offset is always with respect to the address of the next instruction in the program sequence. If the target of the branch instruction is i, then the decimal value of the Offest is __________ .
(A) -16
(B) 18
(C) 1000
(D) None of the above

Explanation: Let’s address of first instruction is 1000. Therefore,

Question says that the target of branch instruction is ‘i’ which is at 1000 in our example.
So, we need to go to address 1000 from address 1016 (which is currently pointed by PC)
1016 – 1000 = 16
Therefore, we have to specify Offset as -16 which would mean that 16 should be subtracted from next address instruction (1000).

Alternative way –

```Instruction            Bytes
i		   	0-3
i+1		   	4-6
i+2		     	7-11
i+3		     	12-12
i+3			13-15
Next Instruction	16
```
```Instruction            Bytes
i		   	0-3
i+1		   	4-6
i+2		     	7-11
i+3		     	12-12
i+3			13-15
Next Instruction	16
```

According to PC Relative Mode,

0(i) = 16 + offset
0-16 = offset

Offset = -16
Option (A) is correct.

Quiz of this Question

My Personal Notes arrow_drop_up
Article Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.