range of BL instruction in arm state is + or - 32MB as per instruction set.how...........?
What the B/BL instructions do is branch (or jump) to a different address. At an instruction level the destination of the branch is encoded as an offset from the current address. So current destination = address + offset. The range of the instruction is therefore determined by the number of bits available to encode the offset.
ARM instructions are 32 bits long.Some of those bits are needed to encode that it's a branch instruction, and others to encode the condition. What that leaves you in 24 bits to encode the offset. That works out as a range of +/- 32MB from the current location (based on the explanation above).
Thanks for the answer. But i believe the range of jump should just have been mentioned in Words, as thats what is the alignment of instructions. So for a 24bit offset, the branch can have range of plus/minus 8Million Words.i.e. it can go ahead or behind by 8Million instructions , thats it. The reference to 32MByte is slightly confusing for beginners.
i.e. it can go ahead or behind by 8Million instructions , thats it.
Consider for a moment, however obtuse it may seem, that the 16MiB of memory before and after the current instruction may not actually be other instructions. Code and data may live in the same underlying address space. To say that you branch over a certain 'count' of 'instructions' isn't specific, and is in fact somewhat misleading.
In a true Harvard architecture all that can be in the memory either side of the branch is instructions/code space, so you will be branching a number of potential instructions away. But ARM architecture is not a true Harvard architecture.. and even in a Harvard architecture you can leave your instruction address space unpopulated, with no instructions at all. So, a branch range in (Mega)bytes is obviously more specific and less open to confusion, in terms of specification.
Aside from the mixture of instruction and data, Thumb instructions could also be existing in memory within the range of the branch offset. So, the alignment of instructions and instruction count are unsuitable bases in specifying the size and unit of the branch range.