前辈们,这是我截取ARM体系结构与编程中的内容。我的问题是。 指令编码的24位,IA是后增的,那么它的基址寄存器是会放入数据的,为啥24位是0,现在Rn所指的内存单元用上了啊,那不应该是包含在指令使用的内存块中额,地址寄存器所指的内存单元包含在指令所使用的代码块中啊
你好。「P」意味「预先进行的操作(previous)」,「U」意味「增加方向(upward)」。这个缘故,「P」「U」的组合和,LDM/STM的addressing mode的关系变得以下的。
IA (P,U)=(0,1) Increment After -- Rn has lower address (change is upward)IB (P,U)=(1,1) Increment Before -- Rn has lower address (change is upward)DA (P,U)=(0,0) Decrement After -- Rn has higher address (change is downward)DB (P,U)=(1,0) Decrement Before -- Rn has higher address (change is downward)
譬如,因为「IA」「操作后,(after)」变址寄存器「增加(increment)」使之做,现在的变址寄存器的价值「最下(U==1)」有。
这是你期盼的回答吗?
I'm sorry for my poor Chinese.
Best regards,
Yasuhiko Koumoto.
Koumoto-san,
You are so great, you can answer Chinese question.
Thank you very much.
Ben
Hi Ben,
an interpretation web site helped me and I am not great.
実るほど頭を垂れる稲穂かな
Hi Yzilong,
请看一下Koumoto-san的回复,是否能解决你的问题,谢谢
I know [U] means what,but I don't understand [P] means what.In the book named"ARM体系结构与编程" in page 50,the book says that [P] means whether the memory unit that the base register <Rn> points is included in the memory units that this instruction uses. I show you a picture to make you understand what I want to say.
"地址增加方向" means the address increasing in this direction.“基址”means the memory unit's address R0 points
in this picture ,we can see , the memory unit that R0 points is also used to store the data of R1.
so the memory unit that R0 points is used,but [P] = 0,and this is a contradiction.Because [P] = 0 means the memory unit that R0 points are not used,and now in instruction "STMIA",the memory unit that R0 points is used.
So what I don't konw is the meaning of [P].
Thanks for your answering.
Are you mean that [P] only means Increment or decrement is applyed after or before. [P] = 1 means before [P] = 0 means after. If what I say is right , the chinese version book I read has a mistake in this question.
So how do you define the memory unit that R0 points, the memory unit is the one before the instruction is applied or after.If after,I understand the chinese version book say what.
Hello yzilong,
Yes, I mean as you think.
Strictly speaking, I think 'P' means Pre-indexing of the start address.However, I think the Chinese book would not have a mistake.
P==0 means "the memory unit which <Rn> points is not included in the memory units that this instruction uses".
P==1 means "the memory unit which <Rn> points is included in the memory units that this instruction uses".
Please refer to the following figures.
I am sorry but I had made a wrong answer.I have re-written the previous answer.As the ARM ARM says, the meaning of 'P' should be considered with 'U'.The following descriptions are derived from ARM ARM (DDI 0100I) A5.4.1.
The P bit Has two meanings:P==0 indicates that the word addressed by Rn is included in the range of memory locations accessed, lying at the top (U==0) or bottom (U==1) of that range.P==1 indicates that the word addressed by Rn is excluded from the range of memory locations accessed, and lies one word beyond the top of the range (U==0) or one word below the bottom of the range (U==1).
The U bit Indicates that the transfer is made upwards (U==1) or downwards (U==0) from the base register.
The below shows how to define the start address.First of all, the transaction direction is always from the lower to the higher of the memory address space.If STM/LDM have M registers in the register list and Rn is the base register, then the start address of the trabsaction is defined as the following.
<Start_Address> = switch ( {P, U} ){ case 00: Rn - (4*M) +4 /* DA */ case 01: Rn /* IA */ case 10: Rn - (4*M) /* DB */ case 11: Rn + 4 /* IB */ };
<Rn of execution end> = (W==0)? Rn : switch ( {P, U} ){ case 00: Rn - (4*M) /* DA */ case 01: Rn + (4*M) /* IA */ case 10: Rn - (4*M) /* DB */ case 11: Rn + (4*M) /* IB */ };