1 / 34

第 3 章 Binary Math and Signed Representations

第 3 章 Binary Math and Signed Representations. Computer Organization and Design Fundamental 書籍 作者: David Tarnoff 投影片製作者:陳鍾誠. 3.1 Binary Addition. 一位元加法 ( 半加器 ). 一位元加法 ( 全加器 ). 兩個二進位數相加. 3.2 Binary Subtraction. 一位元減法. 借位. 多位元減法. 3.3 Binary Complements ( 二補數 ). 1 補數 該數與其 1 補數相加

liana
Télécharger la présentation

第 3 章 Binary Math and Signed Representations

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 第 3 章 Binary Math and Signed Representations Computer Organization and Design Fundamental 書籍作者:David Tarnoff 投影片製作者:陳鍾誠

  2. 3.1 Binary Addition

  3. 一位元加法 (半加器)

  4. 一位元加法 (全加器)

  5. 兩個二進位數相加

  6. 3.2 Binary Subtraction

  7. 一位元減法 借位

  8. 多位元減法

  9. 3.3 Binary Complements (二補數) • 1 補數 • 該數與其 1補數相加 • 再加上 1

  10. 二補數的秘密

  11. 二補數加減法的例子 • 88 與 10 的二進位與二補數 • 88-10 的二補數減法過程

  12. 計算 2 補數的技巧

  13. 2 補數的補數 • In decimal, the negative of 5 is -5. If we take the negative a second time, we return to the original value, e.g., the egative of -5 is 5. Is the same true for taking the 2's complement of a 2's complement of a binary number?

  14. 3.3.3 Most Significant Bit as a Sign Indicator • A binary value with a 0 in the MSB position is considered positive and a binary value with a 1 in the MSB position is considered negative

  15. 3.3.4 Signed Magnitude (正負號位元表示法)

  16. 3.3.5 MSB and Number of Bits • Since the MSB is necessary to indicate the sign of a binary value, it is vital that we know how many bits a particular number is being represented with so we know exactly where the MSB is. • 以下位元串到底代表甚麼數字呢?

  17. 3.3.6 Issues Surrounding the Conversion of Binary Numbers • 2 補數正數轉為十進位 • 2 補數負數轉為十進位

  18. 將 2 補數轉為 10 進位的流程圖

  19. 最大最小值 • 2 補數 • 正負號位元表示法

  20. 數字系統的比較

  21. 3.4 Floating Point Binary (浮點數的二進位表示法)

  22. 指數 • 10n • 2n

  23. 「浮」點的意義

  24. 浮點數的二進位編碼方式

  25. 符點數解碼 • 請問下列32 位元浮點數代表何值 11010110101101101011000000000000

  26. 符點數編碼 • 請將下列二進位數編為浮點格式 • 0.000000110110100101 步驟 1: 步驟 2: 步驟 3:

  27. 3.5 Hexadecimal Addition (16 進位加法)

  28. 16 進位加法範例 • 請計算 3DA32 加上 4292F 的結果

  29. 3.7 Multiplication and Division by Powers of Two

  30. 用移位代替乘法 • Since a shift operation is significantly faster than a multiply or divide operation, compilers will always substitute a shift operation when a program calls for a multiply or divide by a power of two. • 但在右移時必需注意 MSB 的填入值

  31. 用移位代替乘法 (C 語言版) • 乘以 8 • 除以 16

  32. 3.8 Easy Decimal to Binary Conversion Trick • 將 15610 轉為二進位 • 所以 15610 的 2 進位為 10011100

  33. 3.9 Arithmetic Overflow (溢位) • 20010 = 1 1 0 0 1 0 0 0 • 17510 = 1 0 1 0 1 1 1 1 • 20010 + 17510 溢位

  34. 溢位範例 2

More Related