OpenCores
no use no use 1/1 no use no use
Question about branch (l.bf) instruction
by Unknown on Apr 28, 2004
Not available!
Dear all,

In the branch instruction (l.bf),
the effective address = exts(Immediate
The Immediate is 26bits [25:0].

My question is :
When shifting left by 2 bit , will bit [25] and bit [24] be ignored ? Or just
keep it in the sign extended 32bit result ?

Thank you very much for your help !!

Regards,
Yu Chi Wai
Question about branch (l.bf) instruction
by Victor on May 3, 2004
Victor
Posts: 9
Joined: Mar 1, 2002
Last seen: Jul 3, 2002
Hi,

maybe you are having a little misunderstanding with the function of
the shift in the branch instruction, I'll give a quick example:

immediate field --> [25:0]
Address of the branch instruction--> [31:0]

shift left 2 the imm field leaves us with this 28 bit number:
[25:0] & "00"
which means that the bits 25 and 24 are still there, but they are 4
times more significant (they have been shifted 2 bits to the left)

So if the branch is taken the Program Counter will be updated to:
PC
which means that if for instance the Immediate is a 1, then 24 zeros
and a last 1 then the immediate will be like this:

10000000000000000000000001

We shift it left by 2 (forming a 28 bit number!!!) :

1000000000000000000000000100

Then we sign-extend it (supposing a 32 bit OpenRISC) forming a 32 bit
number:

11111000000000000000000000000100

This quantity will be added to the BranchInstructionAddress to form the
Target Address of the branch (btw notice that the quantity has sign 1
which means it is negative, so the branch target is before the branch
itself). Maybe it was not all that quick but it is thorough ;). Hope I
didn't miss the point of your question. Regards,

Victor Lopez

Dear all,

In the branch instruction (l.bf),
the effective address = exts(Immediate
The Immediate is 26bits [25:0].

My question is :
When shifting left by 2 bit , will bit [25] and bit [24] be ignored ?

Or just
keep it in the sign extended 32bit result ? Thank you very much for your help !! Regards, Yu Chi Wai _______________________________________________ http://www.opencores.org/mailman/listinfo/openrisc






no use no use 1/1 no use no use
© copyright 1999-2026 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.