We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello.I downloaded the ARMv6 manual and there are a few things that I don't understand."For an ARM instruction, the value read [from the program counter] is the adress of the instruction plus 8 bytes. Bits [1:0] of this value are always zero, because ARM instructions are always word-aligned."So why it is "the adress + 8"? If the instruction has 4 bytes, it would be the "next next" instruction, wouldn't it?And which bits are the [1:0]? (Could you show me in a manner like this: 11010001b ?)And the phrase right below the previous one:
"For a Thumb instruction set, the value read is the adress of the instruction plus 4 bytes. Bit [0] of this value is always zero, because Thumb instructions are always halfword-aligned."
Again, why "adress plus 4" and what is the "Bit [0]".Thanks for reading.
Have a look at a diagram of a simple classical pipeline on WIkipedia at
https://en.wikipedia.org/wiki/Classic_RISC_pipeline
if the execute stage uses the address of the instruction being fetched in the fetch stage then the value used will be the pc of the instruction being executed plus 8
The address of a 32 bit ARM instructions always has the last two bits zero so they don't have to be specified in a branch instruction. The 24 bit literal is multiplied by 4 to give the displacement to be added to the pc value.