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

          新聞中心

          EEPW首頁(yè) > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > 協(xié)處理器及其他指令之:狀態(tài)寄存器訪問(wèn)指令

          協(xié)處理器及其他指令之:狀態(tài)寄存器訪問(wèn)指令

          作者: 時(shí)間:2013-09-13 來(lái)源:網(wǎng)絡(luò) 收藏

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

          9.2.2寫狀態(tài)寄存器指令MSR

          1.指令編碼格式

          寫狀態(tài)寄存器指令MSR(MovetoStatusRegisterfromRegister)。在處理器中,只有MSR指令可以直接設(shè)置狀態(tài)寄存器CPSR或SPSR。

          圖9.7、圖9.8分別顯示了源操作數(shù)為立即數(shù)的MSR指令和源操作數(shù)為寄存器的MSR指令的編碼格式。

          圖9.7源操作數(shù)為立即數(shù)的MSR指令編碼格式

          圖9.8源操作數(shù)為寄存器的MSR指令編碼格式

          2.指令的語(yǔ)法格式

          MSR{cond>}CPSR_fields>,#immediate>

          MSR{cond>}CPSR_fields>,Rm>

          MSR{cond>}SPSR_fields>,#immediate>

          MSR{cond>}SPSR_fields>,Rm>

          ①cond>

          為指令編碼中的條件域。它指示指令在什么條件下執(zhí)行。當(dāng)cond>忽略時(shí),指令為無(wú)條件執(zhí)行(cond=AL(Alway))。

          ②fields>

          域標(biāo)志位,是下面選項(xiàng)中的一種或幾種的組合。

          ·C:設(shè)置控制位掩碼域(bit[16])。

          ·X:設(shè)置擴(kuò)展位掩碼域(bit[17])。

          ·S:設(shè)置狀態(tài)位掩碼域(bit[18])。

          ·F:設(shè)置標(biāo)志位掩碼域(bit[19])

          ③immediate>

          將被傳送到CPSR和SPSR寄存器的立即數(shù)。此立即數(shù)可以為8位立即數(shù)(范圍在0x00~0xff之間)。

          ④Rm>

          指定的通用寄存器,此寄存器包含將要被傳送狀態(tài)寄存器中的數(shù)據(jù)。

          3.指令操作的偽代碼

          指令操作的偽代碼如下面程序段所示。

          IfConditionPassed{cond}then

          Ifopcode[25]==1

          Operand=8_bit_immediateRotate_Right{rotate_imm*2}

          Else/*opcode[25]==0*/

          Operand=Rm

          IfR==0then

          Iffield_mask[0]==1andinAprivilegedMode()then

          CPSR[7:0]=operand[7:0]

          Iffield_mask[1]==1andinAprivilegedMode()then

          CPSR[15:8]=operand[15:8]

          Iffield_mask[2]==1andinAprivilegedMode()then

          CPSR[23:16]=operand[23:16]

          Iffield_mask[3]==1andthen

          CPSR[31:24]=operand[31:24]

          Else/*R==1*/

          Iffield_mask[0]==1andCurrentModeHasSPSR()then

          SPSR[7:0]=operand[7:0]

          Iffield_mask[1]==1andCurrentModeHasSPSR()then

          SPSR[15:8]=operand[15:8]

          Iffield_mask[2]==1andCurrentModeHasSPSR()then

          SPSR[23:16]=operand[23:16]

          Iffield_mask[3]==1andCurrentModeHasSPSR()then

          SPSR[31:24]=operand[31:24]



          評(píng)論


          相關(guān)推薦

          技術(shù)專區(qū)

          關(guān)閉
          看屁屁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); })();