Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7667357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:04:54+00:00 2026-05-31T15:04:54+00:00

I am new to Assembly language . I was reading about MIPS architecture and

  • 0

I am new to Assembly language. I was reading about MIPS architecture and I am stuck with Jump Target Address and Branch Target Address and how to calculate each of them.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T15:04:56+00:00Added an answer on May 31, 2026 at 3:04 pm

    In the diagrams and text below, PC is the address of the branch instruction itself. PC+4 is the end of the branch instruction itself, and the start of the next instruction (the branch delay slot in a MIPS that uses delay slots).

    Except in the absolute jump diagram where we actually take the high 4 bits of the address of the instruction following the jump. That’s only different at the end of a 256 MiB region. The diagrams are inconsistent with each other in what they call PC, or perhaps were created with the simplification that PC+4 has the same top 4 bits as PC.

    1. Branch Address Calculation

    In MIPS branch instruction has only 16 bits offset to determine next instruction. We need a register added to this 16 bit value to determine next instruction and this register is actually implied by architecture. It is PC register since PC gets updated (PC+4) during the fetch cycle so that it holds the address of the next instruction.

    We also limit the branch distance to -2^15 to +2^15 - 1 instructions. However, this is not real issue since most branches are local anyway.

    So step by step :

    • Sign extend the 16 bit offset value to preserve its value.
    • Multiply resulting value with 4. The reason behind this is that If we are going to branch some address, and PC is already word aligned, then the immediate value has to be word-aligned as well. However, it makes no sense to make the immediate word-aligned because we would be wasting low two bits by forcing them to be 00.
    • Now we have a 32 bit relative offset. Add this value to PC + 4 and that is your branch address.

    Branch address calculation


    2. Jump Address Calculation

    For Jump instruction MIPS has only 26 bits to determine Jump location. Jumps are relative to PC in MIPS. Like branch, immediate jump value needs to be word-aligned; therefore, we need to multiply 26 bit address with four.

    Again step by step:

    • Multiply 26 bit value with 4.
    • Since we are jumping relative to PC+4 value, concatenate first four bits of PC+4 value to left of our jump address.
    • Resulting address is the jump value.

    In other words, replace the lower 28 bits of the PC + 4 with the lower 26 bits of the fetched instruction shifted left by 2 bits.

    enter image description here

    Jumps are absolute within the region containing the branch-delay slot, not necessarily the branch itself. In the diagram above, PC has already advanced to the branch delay slot before the jump calculation. (In a classic-RISC 5 stage pipeline, the BD was fetched in the same cycle the jump is decoded, so that PC+4 next instruction address is already available for jumps as well as branches, and calculating relative to the jump’s own address would have required extra work to save that address.)

    Source: Bilkent University CS 224 Course Slides

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am very new to Assembly language . I was reading about MIPS architecture
I am very new to Assembly language . I was reading about MIPS architecture
I am relatively new to assembly language. I have found so many tutorials that
I'm new to assembly language, and would like to learn. I have Vista-64 (will
I am pretty new to assembly language and I want to interface with a
I was reading The Art of Assembly Language (Randall Hyde, link to Amazon )
I have new problem. I'm working with strings in assembly language and I want
I am new to assembly language. I have written a program for taking an
I am new to assembly language. It seems that gcc doesn't have _bittestandset function
I am new to x86 assembly language, I have a signed integer saved in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.