版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、<p> 11 Shift Instructions</p><p> 11.1 Overview of Shift Instructions</p><p> 11.1.1 Description</p><p> You can use the Shift instructions to move the contents of input I
2、N bit by bit to the left or the right (see also CPU Registers).Shifting to the left multiplies the contents of input IN by 2 to the power n (2n);shifting to the right divides the contents of input IN by 2 to the power n
3、(2n).</p><p> The number that you supply for input parameter N indicates the number of bits by which to shift.The bit places that are vacated by the Shift instruction are either filled with zeros or with th
4、e signal state of the sign bit (a0 stands for positive and a1 stands for negative).The signal state of the bit that is shifted last is loaded into the CC1 bit of the status word.The CC0 and OV bits of the status word are
5、 reset to 0.You can use jump instructions to evaluate the CC1 bit.</p><p> The following shift instructions are available:</p><p> SHR_I Shift Right Integer</p><p> SHR_DI Shift
6、Right Double Integer</p><p> SHL_W Shift Left Word</p><p> SHR_W Shift Right Word</p><p> SHL_DW Shift Left Double Word</p><p> SHR_DW Shift Right Double Word</p
7、><p> 11.2 SHR_I Shift Right Integer</p><p> 11.2.1 Symbol</p><p> 11.2.2 Description</p><p> SHR_I(Shift Right Integer) is activated by a logic "1" at the E
8、nable (EN) Input.The SHR_I instruction is used to shift bits 0 to 15 of input IN bit by bit to the right.Bits 16 to 31 are not affected.The input N specifies the number of bits by which to shift.If N is larger than 16,th
9、e command acts as if N were equal to 16.The bit positions shifted in from the left to fill vacated bit positions are assigned the logic state of bit 15 (sign bit for the integer).This means these bit positions are ass<
10、;/p><p> ENO has the same signal state as EN.</p><p> 11.2.3 Example</p><p> The SHR_I box is activated by logic "1" at I0.0.MW0 is loaded and shifted right by the number
11、of bits specified with MW2.The result is written to MW4. 4.0 is set. </p><p> 11.3 SHR_DI Shift Right Double Integer</p><p> 11.3.1 Symbol</p><p> 11.3.2 Description</p>&
12、lt;p> SHR_DI (Shift Right Double Integer) is activated by a logic "1" at the Enable (EN) Input.The SHR_DI instruction is used to shift bits 0 to 31 of input IN bit by bit to the right. The input N specifie
13、s the number of bits by which to shift. If N is larger than 32,the command acts as if N were equal to 32.The bit positions shifted in from the left to fill vacated bit positions are assigned the logic state of bit 31 (si
14、gn bit for the double integer).This means these bit positions are assigned "0" i</p><p> ENO has the same signal state as EN.</p><p> 11.3.3 Status word</p><p> 11.4 SH
15、L_W Shift Left Word</p><p> 11.4.1 Symbol</p><p> 11.4.2 Description</p><p> SHL_W (Shift Left Word) is activated by a logic "1" at the Enable (EN) Input.The SHL_W inst
16、ruction is used to shift bits 0 to 15 of input IN bit by bit to the left.Bits 16 to 31 are not affected.The input N specifies the number of bits by which to shift.If N is larger than 16,the command writes a "0"
17、 at output OUT and sets the bits CC0 and OV in the status word to "0".N zeros are also shifted in from the right to fill vacated bit positions. </p><p> 11.4.3 Example</p><p> The SH
18、L_W box is activated by logic "1" at I0.0.MW0 is loaded and shifted left by the number of bits specified with MW2.The result is written to MW4. Q4.0 is set.MW0 is loaded and shifted left by the number of bits s
19、pecified with MW2.</p><p> 11.4.4 Status word</p><p> 11.5 SHR_W Shift Right Word</p><p> 11.5.1 Symbol</p><p> 11.5.2 Description</p><p> SHR_W (Shif
20、t Right Word) is activated by a logic "1" at the Enable (EN) Input.The SHR_W instruction is used to shift bits 0 to 15 of input IN bit by bit to the right.Bits 16 to 31 are not affected.The input N specifies th
21、e number of bits by which to shift.If N is larger than 16, the command writes a "0" at output OUT and sets the bits CC0 and OV in the status word to "0".N zeros are also shifted in from the left to fi
22、ll vacated bit positions.The result of the shift instruction can be scanned at </p><p> ENO has the same signal state as EN.</p><p> 11.5.3 Example</p><p> The SHR_W box is activ
23、ated by logic "1" at I0.0.MW0 is loaded and shifted right by the number of bits specified with MW2.The result is written to MW4. Q4.0 is set.</p><p> 11.6 SHL_DW Shift Left Double Word</p>
24、<p> 11.6.1 Symbol</p><p> 11.6.2 Description</p><p> SHL_DW (Shift Left Double Word) is activated by a logic "1" at the Enable (EN) Input. The SHL_DW instruction is used to sh
25、ift bits 0 to 31 of input IN bit by bit to the left.The input N specifies the number of bits by which to shift.If N is larger than 32,the command writes a "0" at output OUT and sets the bits CC0 and OV in the s
26、tatus word to "0".N zeros are also shifted in from the right to fill vacated bit positions.The result double word of the shift instruction can be scanned at output OUT.</p><p> ENO has the same si
27、gnal state as EN.</p><p> 11.6.3 Example</p><p> The SHL_DW box is activated by logic "1" at I0.0.MD0 is loaded and shifted left by the number of bits specified with MW4.The result i
28、s written to MD10.Q4.0 is set.</p><p> 11.7 SHR_DW Shift Right Double Word</p><p> 11.7.1 Symbol</p><p> 11.7.2 Description</p><p> SHR_DW (Shift Right Double Word)
29、 is activated by a logic "1" at the Enable (EN)Input.The SHR_DW instruction is used to shift bits 0 to 31 of input IN bit by bit to the right.The input N specifies the number of bits by which to shift.If N is l
30、arger than 32, the command writes a "0" at output OUT and sets the bits CC0 and OV in the status word to "0". The result double word of the shift instruction can be scanned at output OUT.</p>&
31、lt;p> ENO has the same signal state as EN.</p><p> 11.7.3 Example</p><p> The SHR_DW box is activated by logic "1" at I0.0.MD0 is loaded and shifted right by the number of bits s
32、pecified with MW4.The result is written to MD10.Q4.0 is set.</p><p> 11.7.4 Status word</p><p><b> 11 移位指令</b></p><p> 11.1.移位指令概述</p><p> 11.1.1 描述 <
33、;/p><p> 可使用移位指令向左或向右逐位移動(dòng)輸入IN的內(nèi)容(另請(qǐng)參閱CPU寄存器)。向左移n位會(huì)將輸入IN的內(nèi)容乘以2的n次冪(2n);向右移n位則會(huì)將輸入IN的內(nèi)容除以2的n次冪(2n)。例如,如果將十進(jìn)制數(shù)值“3”的等效二進(jìn)制數(shù)左移3位,則累加器中的結(jié)果是十進(jìn)制數(shù)“24”的二進(jìn)制數(shù)。</p><p> 您為輸入?yún)?shù)N提供的數(shù)值指示要移動(dòng)的位數(shù)。由移位指令移空的位會(huì)用零或符號(hào)位的信
34、號(hào)狀態(tài)(“0”表示“正”,“1”表示“負(fù)”)補(bǔ)上。最后移動(dòng)的位的信號(hào)狀態(tài)會(huì)被載入狀態(tài)字的CC1位中。狀態(tài)字的CC0位和OV位會(huì)被復(fù)位為0。可以使用跳轉(zhuǎn)指令來(lái)評(píng)估CC1位。輸入?yún)?shù)N提供的數(shù)值表示移動(dòng)的位數(shù)。狀態(tài)字的CC0和OV位清零。</p><p> 可使用如下移位指令:</p><p> SHR_I 整數(shù)右移 </p><p> SHR_DI
35、 長(zhǎng)整數(shù)右移 </p><p> SHL_W 字左移 </p><p> SHR_W 字右移 </p><p> SHL_DW 雙字左移 </p><p> SHR_DW 雙字右移 </p><p> 11.2 SHR_I整數(shù)右移</p>
36、<p><b> 11.2.1 符號(hào)</b></p><p> 11.2.2 描述 </p><p> SHR_I(整數(shù)右移)指令通過使能(EN)輸入位置上的邏輯“1”來(lái)激活。SHR_I指令用于將輸入IN的0至15位逐位向右移動(dòng)。16位到31位不受影響。輸入N用于指定移位的位數(shù)。如果輸入N值大于16,命令將按照N等于16的情況執(zhí)行。自左移入的、用于填補(bǔ)
37、空出位的位位置將被賦予位15的邏輯狀態(tài)(整數(shù)的符號(hào)位)。這意味著,當(dāng)該整數(shù)為正時(shí),這些位將被賦值“0”,而當(dāng)該整數(shù)為負(fù)時(shí),則被賦值為“1”??稍谳敵鯫UT位置掃描移位指令的結(jié)果。如果N不等于0,則SHR_I會(huì)將CC0位和OV位設(shè)為“0”。</p><p> ENO與EN具有相同的信號(hào)狀態(tài)。</p><p><b> 11.2.3 實(shí)例</b></p>
38、<p> 如果I0.0為邏輯“1”,則SHR_I方塊激活。MW0裝入,并右移使用MW2指定的位數(shù)。其結(jié)果被寫入MW4中。Q4.0置位。</p><p> 11.3 SHR_DI右移長(zhǎng)整數(shù)</p><p><b> 11.3.1 符號(hào)</b></p><p> 11.3.2 描述 </p><p>
39、SHR_DI(雙整數(shù)右移指令)可以由使能(EN)輸入端的邏輯“1”信號(hào)激活。SHR_DI指令用于將輸入IN位的位0到位31逐位右移。輸入N指定移位的位數(shù)。如果N大于32,則該命令的作用和N等于32時(shí)一樣。從左邊到需填充空出位的所有移位都根據(jù)位31的信號(hào)狀態(tài)填充(這是一個(gè)整數(shù)的符號(hào)位)。這就意味著,如果整數(shù)為正值,則這些位被賦值“0”;如果整數(shù)為負(fù)值,則這些位被賦值“1”。移位操作的結(jié)果可以在輸出OUT中掃描。如果N不等于“0”,則通過S
40、HR_DI指令將CC0位和OV位清零。結(jié)果在輸出OUT得出。</p><p> ENO和EN具有相同的信號(hào)狀態(tài)。</p><p> 11.3.3 狀態(tài)字</p><p> 11.4 SHL_W字左移</p><p><b> 11.4.1 符號(hào)</b></p><p> 11.4.2 描
41、述 </p><p> SHL_W(字左移)指令通過使能(EN)輸入位置上的邏輯“1”來(lái)激活。SHL_W指令用于將輸入IN的0位至15位逐位向左移動(dòng)。輸入N用于指定移位的位數(shù)。若N大于16,命令將按照N等于16的情況執(zhí)行。此命令會(huì)在輸出OUT位置上寫入“0”,并將狀態(tài)字中的CC0和OV位設(shè)置為“0”。將自右移入N個(gè)零,用以補(bǔ)上空出的位位置??稍谳敵鯫UT位置掃描移位指令的結(jié)果。如果N不等于0,則SHL_W會(huì)將C
42、C0位和OV位設(shè)為“0”。</p><p> ENO與EN具有相同的信號(hào)狀態(tài)。</p><p><b> 11.4.3 實(shí)例</b></p><p> SHL_W框由I0.0位置上的邏輯“1”激活。裝載MW0并將其左移由MW2指定的位數(shù)。結(jié)果將被寫入MW4。所得的結(jié)果將置位Q4.0。</p><p><b&g
43、t; 11.4.4狀態(tài)字</b></p><p> 11.5 SHR_W字右移</p><p><b> 11.5.1 符號(hào)</b></p><p> 11.5.2 描述 </p><p> SHR_W(字右移指令)可以由使能(EN)輸入端的邏輯“1”信號(hào)激活。SHR_W指令用于將輸入IN位的位0到
44、位15逐位右移。位16到位31不受影響。輸入N指定移位的位數(shù)。如果N大于16,該命令將“0”寫入輸出OUT,并將狀態(tài)字中的位CC0和OV清零。從左邊到需填充空出位的所有位將填入N個(gè)零。移位操作的結(jié)果可以在輸出OUT中掃描。如果N不等于“0”,則通過SHR_W指令將CC0位和OV位清零。</p><p> ENO和EN具有相同的信號(hào)狀態(tài)。</p><p><b> 11.5.3
45、 實(shí)例</b></p><p> SHR_W框由I0.0位置上的邏輯“1”激活。裝載MW0并將其右移由MW2指定的位數(shù)。結(jié)果將被寫入MW4。置位Q4.0。</p><p> 11.6 SHL_DW雙字左移</p><p><b> 11.6.1 符號(hào)</b></p><p> 11.6.2 描述 &l
46、t;/p><p> SHL_DW(雙字左移指令)可以由使能(EN)輸入端的邏輯“1”信號(hào)激活。SHL_DW指令用于將輸入IN位的位0到位31逐位左移。輸入N指定移位的位數(shù)。如果N大于32,該命令將“0”寫入輸出OUT,并將狀態(tài)字中的位CC0和OV清零。從右邊到需填充空出位的所有位將填入N個(gè)零。雙字移位操作的結(jié)果可以在輸出OUT中掃描。如果N不等于“0”,則通過SHL_DW指令將CC0位和OV位清零。</p&g
47、t;<p> ENO和EN具有相同的信號(hào)狀態(tài)。</p><p><b> 11.6.3 實(shí)例</b></p><p> SHL_DW框由I0.0位置上的邏輯“1”激活。裝載MD0并將其左移由MW4指定的位數(shù)。結(jié)果將被寫入MD10。置位Q4.0。</p><p> 11.7 SHR_DW雙字右移</p><
48、;p><b> 11.7.1 符號(hào)</b></p><p> 11.7.2 描述 </p><p> SHR_DW(雙字右移指令)可以由使能(EN)輸入端的邏輯“1”信號(hào)激活。SHR_DW 指令用于將輸入IN位的位0到位31逐位右移。輸入N指定移位的位數(shù)。如果N大于32,該命令將“0”寫入輸出OUT,并將狀態(tài)字中的位CC0和OV清零。從左邊到需填充空出位的
49、所有位將填入N個(gè)零。雙字移位操作的結(jié)果可以在輸出OUT中掃描。如果N不等于“0”,則通過 SHR_DW指令將CC 0位和OV位清零。</p><p> ENO和EN具有相同的信號(hào)狀態(tài)。</p><p><b> 11.7.3 實(shí)例</b></p><p> SHR_DW框由I0.0位置上的邏輯“1”激活。裝載MD0并將其右移由MW4指定的
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 眾賞文庫(kù)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 計(jì)算機(jī)控制技術(shù)外文翻譯
- 計(jì)算機(jī)控制
- 計(jì)算機(jī)控制汽車安全語(yǔ)音提示系統(tǒng)外文翻譯
- 鍋爐的計(jì)算機(jī)控制畢業(yè)論文外文翻譯
- 計(jì)算機(jī)控制裝置
- 計(jì)算機(jī)控制答案
- 計(jì)算機(jī)控制技術(shù)
- 計(jì)算機(jī)控制答案
- 計(jì)算機(jī)控制試題匯總
- 計(jì)算機(jī)控制系統(tǒng)
- 計(jì)算機(jī)控制b卷
- 計(jì)算機(jī)控制技術(shù)論文
- 計(jì)算機(jī)控制技術(shù) 習(xí)題.
- 計(jì)算機(jī)控制理論答案
- 計(jì)算機(jī)控制技術(shù)習(xí)題
- 計(jì)算機(jī)控制技術(shù)論文
- 計(jì)算機(jī)控制課程設(shè)計(jì)---達(dá)林算法計(jì)算機(jī)控制系統(tǒng)設(shè)計(jì)
- 外文翻譯---計(jì)算機(jī)控制插齒刀加工橢圓齒輪齒形
- 外文翻譯---計(jì)算機(jī)控制插齒刀加工橢圓齒輪齒形
- 外文翻譯---計(jì)算機(jī)控制插齒刀加工橢圓齒輪齒形
評(píng)論
0/150
提交評(píng)論