-
Consider a RISC machine where each instruction is exactly 4 bytes long. 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. Consider the following instruction sequence
If the target of the branch instruction is i, then the decimal value of the Offset is ______.
-
- –16
- –6
- –13
- None of the above
Correct Option: A
In program storage,
Assuming the starting address (EA) is 0000, then
where, I4 is as branch instruction I1 as a target location.
So, PC-relative addressing mode is: (EA) = (PC) + relative value Relative value = (EA) – (PC) = 0000 – 0016 = –16.