What value is added to the PC when the bne instruction branch is taken? What is
ID: 3729377 • Letter: W
Question
What value is added to the PC when the bne instruction branch is taken?
What is the immediate value in the 16 bit field of the bne instruction?
please explain how it's 0008 and 0002
Explanation / Answer
Branch instructions use I instruction format which contains
Here immediate specifies the relative address from PC because PC is 32 bit and immediate is 16 bit. so we cannot store entire address in immediate field.
One instruction is 32 bit i.e 4 byte. So number of bytes needs to be added to PC will always be in multiple of 4 (because memory is byte addressable).
So if branch is taken then it will add (immediate*4) to PC+4.
Immediate value is number of instructions to skip starting from the instruction following the branch.
In our case there are 2 instructions to jump. So immdiate value is 2 and value added to PC+4 is (2*4) i.e 8
Opcode rs rt ImmediateRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.