第 3 章 binary math and signed representations
DESCRIPTION
第 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 補數相加 - PowerPoint PPT PresentationTRANSCRIPT
Computer Organization and Design Fundamental
書籍作者: David Tarnoff
投影片製作者:陳鍾誠
第 3 章 Binary Math and Signed
Representations
3.1 Binary Addition
一位元加法 ( 半加器 )
一位元加法 ( 全加器 )
兩個二進位數相加
3.2 Binary Subtraction
一位元減法
借位
多位元減法
3.3 Binary Complements (二補數 )1 補數
該數與其 1 補數相加
再加上 1
二補數的秘密
二補數加減法的例子88 與 10 的二進位與二補數
88-10 的二補數減法過程
計算 2 補數的技巧
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?
3.3.3 Most Significant Bit as a Sign IndicatorA 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
3.3.4 Signed Magnitude ( 正負號位元表示法 )
3.3.5 MSB and Number of BitsSince 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.
以下位元串到底代表甚麼數字呢?
3.3.6 Issues Surrounding the Conversion of Binary Numbers
2 補數正數轉為十進位
2 補數負數轉為十進位
將 2 補數轉為 10 進位的流程圖
最大最小值2 補數
正負號位元表示法
數字系統的比較
3.4 Floating Point Binary ( 浮點數的二進位表示法 )
指數10n
2n
「浮」點的意義
浮點數的二進位編碼方式
符點數解碼請問下列 32 位元浮點數代表何值
11010110101101101011000000000000
符點數編碼請將下列二進位數編為浮點格式
0.000000110110100101
步驟 1:
步驟 2:
步驟 3:
3.5 Hexadecimal Addition (16 進位加法 )
16 進位加法範例請計算 3DA32 加上 4292F 的結果
3.7 Multiplication and Division by Powers of Two
用移位代替乘法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 的填入值
用移位代替乘法 (C 語言版 )乘以 8
除以 16
3.8 Easy Decimal to Binary Conversion Trick將 15610 轉為二進位
所以 15610 的 2 進位為 10011100
3.9 Arithmetic Overflow (溢位 )20010 = 1 1 0 0 1 0 0 0
17510 = 1 0 1 0 1 1 1 1
20010 + 17510
溢位
溢位範例 2