




版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
1、Cha2. Addition and Subtraction of Binary I,原則:,逢二進一(加) 借一當二(減),(i-1)s Carry/Borrow,Augend/Minuend,Addend/Subtrahend,Sum,carry,difference,borrow,無符號加減,電子科技大學光電信息學院 陳德軍,Cha2. Addition and Subtraction of Binary II,EX9:,1 0 0 1 1 0 0 1,0 1 1 1 1 0 0 1,+,0,0,1,1,0,0,0,0,1,1,1,0,1,0,1,0,1,1,逢2進1,153,+,121
2、,274,1 0 0 1 1 0 0 1,0 1 1 1 1 0 0 1,-,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,借1當2,153,-,121,32,2,2,電子科技大學光電信息學院 陳德軍,Cha2: Representation of Negative Numbers III,Signed-magnitude system:,A symbol (+ or -) + magnitude原碼,S-M碼,EX:,Decimal: +98 53 100 +56,S,M,The S M of binary numbers:,S:定義在最高有效位(MSB),0=正+,1=負
3、-,M:數(shù)值位 magnitude,電子科技大學光電信息學院 陳德軍,Cha2: Representation of Negative Numbers IV,EX:,+410=,01002,+ Signed,-410=,11002,- Signed,(4-bit),+410=,000001002,-410=,100001002,(8-bit),+12710=011111112,-12710=111111112,010=000000002=100000002,+0 Negative: “1”+radix-complement Twos complement can +,Ones Compleme
4、nt Representation(反碼):,positive:=S-M system,符號位0 Magnitude, change it into its complement; 2. Implement the addition by addition rules,The result exceeds the range of the number system. The range : -2n-1,2n-1-1, n is the number of digit;,Overflow:,電子科技大學光電信息學院 陳德軍,數(shù)制與編碼.二進制補碼的加減法(2),EX:,+53 +49,+,Pe
5、rform the addition operation with 8-bit twos complement,+102,-53 -49,+,-102,+53 -49,+,+4,+49 -53,+,-4,00110101 00110001,+,01100110,11001011 11001111,+,10011010,00110101 11001111,+,00000100,00110001 11001011,+,11111100,電子科技大學光電信息學院 陳德軍,數(shù)制與編碼.二進制補碼的加減法(3),減法規(guī)則:,首先將減號變負號,再對數(shù)值其求補數(shù),在依據(jù)加法規(guī)則進行運算,前提:,不超過記數(shù)系
6、統(tǒng)的范圍,EX:,Perform the operation of subtration with 4-bit twos complement,+2 +5,-,-3,+2 -5,-,+7,-2 -5,-,+3,-5 +2,-,-7,0010,+,0101,1011,1101,0010,+,1011,0101,0111,1110,+,1011,0101,0011,1011,+,0010,1110,1001,數(shù)制與編碼.二進制補碼加減法(4),+3,+4,+,+7,0011,0100,+,0111,兩個正數(shù)相加,-2,-6,+,-8,1110,1010,+,1000,兩個正數(shù)相加,1,+3,-4,
7、+,-1,0011,1100,+,1111,一正一負相加,+3,+7,-4,0011,0111,+,1100,兩個數(shù)相減,-,1001,求補,-3,-5,+2,1101,1011,+,0010,兩個數(shù)相減,-,0101,求補,1,數(shù)制與編碼.二進制補碼的加減法溢出(overflow)判定(1),The reason of Overflow,The addition operation produces a result that exceeds the range of the number system,電子科技大學光電信息學院 陳德軍,How to detect the overflow
8、in addition,1.If the augends sign is different from the addends, no overflow;otherwise, perhaps overflow,2.If augends sign = addends is 0 or 1, but the sum s sign is 1 or 0, two signs are different, overflow!,3.If the carry bits cin into and cout out of the sign position(MSB) are different, overflow
9、!,數(shù)制與編碼.二進制補碼的加減法溢出(overflow)判定(2),EX10:,Indicate whether or not overflow occurs when adding the following with 8-bits twos complement numbers,1、53+(-79),無溢出,相加二數(shù)符號相反,2、(-53)+(-79),寫成二進制補碼相加形式:,11001011,10110001,+,01111100,1,該數(shù)的出現(xiàn)不是判定溢出的依據(jù),因為兩個加數(shù)符號相同,且和為正,加數(shù)為負,所以存在溢出,Cin=0,Cout=1,因為和的符號位 ,所以存在溢出,電子科技大學光電
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 科技與藝術未來設計的美學思考
- 2024年12月中國疾病預防控制中心公開招聘編制內25人(第二批)筆試歷年典型考題(歷年真題考點)解題思路附帶答案詳解-1
- 2024年12月2025年延安市事業(yè)單位校園公開招聘(213人)筆試歷年典型考題(歷年真題考點)解題思路附帶答案詳解-1
- 重慶智能工程職業(yè)學院《消防工程》2023-2024學年第二學期期末試卷
- 淮陰工學院《數(shù)值分析》2023-2024學年第二學期期末試卷
- 沈陽北軟信息職業(yè)技術學院《拓展運動》2023-2024學年第二學期期末試卷
- 西安財經(jīng)大學行知學院《英語電影中的西方文化》2023-2024學年第二學期期末試卷
- 貴州民用航空職業(yè)學院《英美商法》2023-2024學年第二學期期末試卷
- 廣西現(xiàn)代職業(yè)技術學院《三國法(國公、國私、國經(jīng))》2023-2024學年第二學期期末試卷
- 河西學院《比較公共行政學》2023-2024學年第二學期期末試卷
- 婚內財產(chǎn)債務協(xié)議書(通用)
- 部編版四年級下冊道德與法治 第4課 買東西的學問(第2課時) 教學課件
- 慢性活動性EB病毒課件
- 葡萄胎全面版課件
- 《冷沖壓工藝與模具設計》完整版ppt課件全套教程
- 業(yè)務招待費明細單
- 高效液相色譜法分析(三聚氰胺)原始記錄1
- 典雅中國風詩詞大會古風PPT模板
- Part 7 Formal and Informal Styles課件
- 文化差異及跨文化交際試題集
- 油畫人體張東方姑娘的極致美
評論
0/150
提交評論