<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設計應用 > ARM指令尋址方式之: 內存訪問指令尋址

          ARM指令尋址方式之: 內存訪問指令尋址

          作者: 時間:2013-09-13 來源:網(wǎng)絡 收藏

          本文引用地址:http://www.ex-cimer.com/article/257083.htm

          9.[Rn],±Rm,shift># offset_12>]

          (1)編碼格式

          指令的編碼格式如圖4.22所示。

          圖4.22 內存訪問指令——帶移位的后索引寄存器偏移尋址編碼格式

          實際的內存訪問地址為寄存器Rn的值。當指令的執(zhí)行條件滿足時,將基址寄存器值加/減一個地址偏移量產(chǎn)生新的地址值。

          (2)

          有以下5種。

          LDR|STR{cond>}{B}{T} Rd>,[Rn>],±Rm>,LSL # offset_12>

          LDR|STR{cond>}{B}{T} Rd>,[Rn>],±Rm>,LSR # offset_12>

          LDR|STR{cond>}{B}{T} Rd>,[Rn>],±Rm>,ASR # offset_12>

          LDR|STR{cond>}{B}{T} Rd>,[Rn>],±Rm>,ROR # offset_12>

          LDR|STR{cond>}{B}{T} Rd>,[Rn>],±Rm>,RRX

          其中:

          · Rn為基址寄存器,該寄存器包含內存訪問的基地址;

          · Rm>為偏移地址寄存器,包含內存訪問地址偏移量;

          · LSL表示邏輯左移操作;

          · LSR表示邏輯右移操作;

          · ASR表示算術右移操作;

          · ROR表示循環(huán)右移操作;

          · RRX表示擴展的循環(huán)右移。

          · shift_imm>為移位立即數(shù)。

          (3)操作偽代碼

          Address = Rn

          Case shift of

          0b00 /*LSL*/

          Index = Rm logic_shift_left shift_imm

          0b01 /*LSR*/

          If shift_imm = = 0 then /*LSR #32*/

          Index = 0

          Else

          Index = Rm logical_shift_right shift_imm

          0b10 /*ASR*/

          If shift_imm = = 0 then /*ASR #32*/

          If Rm[31] = = 1 then

          Index = 0xffffffff

          Else

          Index = 0

          Else

          Index = Rm Arithmetic_shift_Right shift_imm

          0b11 /* ROR or RRX*/

          If shift_imm = = 0 then /*RRX*/

          Index = (C flag Logical_shift_left 31) OR

          (Rm logical_shift_Right 1)

          Else /*ROR*/

          Index = Rm Rotate_Right shift_imm

          Endcase

          If ConditionPassed{cond} then

          If U = = 1 then

          Rn = Rn + index

          Else /*U = = 0*/

          Rn = Rn – index

          (4)說明

          ① LDRBT、LDRT、STRBT和STRT指令只支持后索引尋址。

          ② 當PC用作基址寄存器Rn或Rm時,指令執(zhí)行結果不可預知。

          ③ 當Rn和Rm是同一個寄存器時,指令的執(zhí)行結果不可預知。

          4.2.2 雜類Load/Store指令的尋址方式

          使用該類尋址方式的指令的如下。

          LDR|STR{cond>}H|SH|SB|D Rd>,addressing_mode>

          使用該類尋址方式的指令包括:(有符號/無符號)半字Load/Store指令、有符號字節(jié)Load/Store指令和雙字Load/Store指令。

          該類尋址方式分為6種類型,如表4.4所示。

          表4.4 雜類Load/Store指令的尋址方式

          格 式

          模 式

          1

          [Rn,#±offset_8>]

          立即數(shù)偏移尋址

          (Immediate offset)

          2

          [Rn,±Rm]

          寄存器偏移尋址

          (Register offset)

          3

          [Rn,#± offset_8>]!

          立即數(shù)前索引尋址

          (Immediate pre-indexed)

          4

          [Rn,±Rm]!

          寄存器前索引尋址

          (Register post-indexed)

          5

          [Rn],#± offset_8>

          立即數(shù)后索引尋址

          (Immediate post-indeded)

          6

          [Rn],±Rm>

          寄存器后索引尋址

          (Register post-indexed)



          評論


          相關推薦

          技術專區(qū)

          關閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();