GATE Computer ScienceHardGATE CS (PYQ pattern)

A RISC machine has 32-bit (4-byte) instructions at word-aligned addresses and a PC-relative branch with a 12-bit signed offset field counted in words. The target is computed as (address of branch + 4) + 4 × offset. What are the largest forward and backward distances of a target from the branch instruction's own address?

  1. A. +8196 bytes forward, −8192 bytes backward
  2. B. +2048 bytes forward, −2048 bytes backward
  3. C. +8188 bytes forward, −8192 bytes backward
  4. D. +8192 bytes forward, −8188 bytes backward

Correct answer: D. +8192 bytes forward, −8188 bytes backward

Offset ranges −2048..+2047 words. Forward: 4 + 4·2047 = 8192 bytes. Backward: 4 − 4·2048 = −8188 bytes. The extra +4 is because PC has already advanced.

More Computer Organization and Architecture questions

Exams that ask this topic