姜書艷 數字邏輯設計及應用ppt課件_第1頁
姜書艷 數字邏輯設計及應用ppt課件_第2頁
姜書艷 數字邏輯設計及應用ppt課件_第3頁
姜書艷 數字邏輯設計及應用ppt課件_第4頁
姜書艷 數字邏輯設計及應用ppt課件_第5頁
已閱讀5頁,還剩40頁未讀 繼續免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

1、Chapter 2 Number Systems and Chapter 2 Number Systems and codes (codes (數系與編碼數系與編碼) )Numeric DataNumeric Data Number Systems and their Number Systems and their Conversions Conversions (數值信息(數值信息 數制及其轉換)數制及其轉換) Nonnumeric Data Nonnumeric Data Codes Codes (非數值信息(非數值信息 編碼)編碼)Digital Logic Design and Ap

2、plication (數字邏輯設計及應用數字邏輯設計及應用)Review of Chapter 2 (Review of Chapter 2 (第二章內容回顧第二章內容回顧) )Binary, Octal, and Hexadecimal Numbers (二進制、八進制、十六進制二進制、八進制、十六進制)Positional Number System (按位計數制按位計數制) 1pniiirdDDigital Logic Design and Application (數字邏輯設計及應用數字邏輯設計及應用)Review of Chapter 2 (Review of Chapter 2 (

3、第二章內容回顧第二章內容回顧) )General Positional-Number-System Conversion (常用按位計數制的轉換常用按位計數制的轉換)A Number in any Radix to Radix 10 : Expanding the formula using radix-10 arithmetic (任意進制數任意進制數 十進制數:利用位權展開十進制數:利用位權展開)Digital Logic Design and Application (數字邏輯設計及應用數字邏輯設計及應用)Review of Chapter 2 (Review of Chapter 2

4、(第二章內容回顧第二章內容回顧) )General Positional-Number-System Conversion (常用按位計數制的轉換常用按位計數制的轉換)A Number in Radix 10 to any Radix : Radix Multiplication or Division (十進制十進制 其它進制:基數乘除法其它進制:基數乘除法)Note: Decimal Fraction Parts Conversion 留意:小數部分的轉換誤差)留意:小數部分的轉換誤差)Digital Logic Design and Application (數字邏輯設計及應用數字邏輯設

5、計及應用)Review of Chapter 2 (Review of Chapter 2 (第二章內容回顧第二章內容回顧) )Addition and Subtraction of Nondecimal Numbers (非十進制的加法和減法非十進制的加法和減法) (Table 2-3) 進位輸入進位輸入 Cin 、進位輸出、進位輸出 Cout 、 本位和本位和 S 借位輸入借位輸入 Bin 、借位輸出、借位輸出 Bout 、 本位差本位差 DDigital Logic Design and Application (數字邏輯設計及應用數字邏輯設計及應用)Review of Chapter

6、2 (Review of Chapter 2 (第二章內容回顧第二章內容回顧) )Representation of Negative Numbers (負數的表示負數的表示) Signed-Magnitude 符號數值原碼)符號數值原碼) Complement Number Systems (補碼數制補碼數制)Radix Complement (基數補碼基數補碼)Diminished Radix Complement 基數減基數減1補碼基數反碼)補碼基數反碼)Digital Logic Design and Application (數字邏輯設計及應用數字邏輯設計及應用)Review of

7、Chapter 2 (Review of Chapter 2 (第二章內容回顧第二章內容回顧) )Binary Signed-Magnitude, Ones Complement, and Twos Complement Representation (二進制的原碼、反碼、補碼二進制的原碼、反碼、補碼)正數的原碼、反碼、補碼表示相同正數的原碼、反碼、補碼表示相同負數的原碼表示:符號位為負數的原碼表示:符號位為 1負數的反碼表示:負數的反碼表示: 符號位不變,其余在原碼基礎上按位取反符號位不變,其余在原碼基礎上按位取反 在在 |D| 的原碼基礎上按位取反包括符號位)的原碼基礎上按位取反包括符號位

8、)負數的補碼表示:反碼負數的補碼表示:反碼 + 1Digital Logic Design and Application (數字邏輯設計及應用數字邏輯設計及應用)2.5.4 Twos 2.5.4 Twos Complement Representation Complement Representation ( (二進制補碼表示法二進制補碼表示法) )An n-bit Twos- Complement range is (n位二進制補碼表示范圍位二進制補碼表示范圍): 2 n-1 + ( 2 n-1 1) Only one representations of Zero ( 零只有一種表示零

9、只有一種表示 ) Obtain a Twos- Complement ( 二進制補碼的求取二進制補碼的求取 ): Ones Complement (反碼反碼) + 1 (為什(為什么?)么?) Expanding the Sign Bit ( 符號位擴展符號位擴展 )Digital Logic Design and Application (數字邏輯設計及應用數字邏輯設計及應用)2.5 Representation of Negative Numbers 2.5 Representation of Negative Numbers ( (負數的表示負數的表示) )Example 2.5.2:W

10、rite the 8-bit signed-magnitude, twos-complement for each of these binary numbers. (分別寫出下面二進制數的分別寫出下面二進制數的8位符號位符號數值碼、數值碼、補碼補碼) ( 1101 )2 ( 0 . 1101 )2 Digital Logic Design and Application (數字邏輯設計及應用數字邏輯設計及應用)2.5 Representation of Negative Numbers 2.5 Representation of Negative Numbers ( (負數的表示負數的表示)

11、 )Digital Logic Design and Application (數字邏輯設計及應用數字邏輯設計及應用) 1 1、( ( 1101 )2 1101 )2 2 2、( ( 0 . 1101 )2 0 . 1101 )2 1 1、5 5位二進制表示:位二進制表示: 原碼原碼 反碼反碼 補碼補碼1 1101 1 0010 1 00111 1101 1 0010 1 00112 2、8 8位二進制表示:位二進制表示: 原碼原碼 反碼反碼 補碼補碼1000 1101 1111 0010 1111 00111000 1101 1111 0010 1111 0011 D D 反反 反反 = D

12、 = D D D 補補 補補 = D = D2.6 Twos 2.6 Twos Complement Addition and Complement Addition and Subtraction (Subtraction (二進制補碼的加法和減法二進制補碼的加法和減法) )Addition Rules: Added by ordinary binary addition (加法:按普通二進制加法相加加法:按普通二進制加法相加)P.39Subtraction Rules: Taking its twos complement, then add (減法:將減數求補,再相加減法:將減數求補,再

13、相加)Digital Logic Design and Application (數字邏輯設計及應用數字邏輯設計及應用)2.6 Twos 2.6 Twos Complement Addition and Complement Addition and Subtraction (Subtraction (二進制補碼的加法和減法二進制補碼的加法和減法) )Digital Logic Design and Application (數字邏輯設計及應用數字邏輯設計及應用) 2 0010 3 1101 5 0101 5 1011 7 0111 8 11000 7 0111 1 0001 4 1100 6

14、 1010 3 10011 5 101113Adder/Subtractor Example: CalculatorAdder/Subtractor Example: CalculatorPrevious calculator used separate adder and subtractorDIP swi tches108-bitregisterCALCLEDsefclkld88800888882x10110wiciAABBSScowo8-bit adder8-bit subt ractor14Adder/Subtractor Example: CalculatorAdder/Subtra

15、ctor Example: CalculatorImprove by using adder/subtractor, and twos complement numbersDIP switches108-bit register8-bit adder/subtractorsubCALCLEDseSABfclkld1088882.6 Twos 2.6 Twos Complement Addition and Complement Addition and Subtraction (Subtraction (二進制補碼的加法和減法二進制補碼的加法和減法) )Overflow溢出)溢出)如果加法運算

16、產生的和超出了數制表示的范圍,則結果如果加法運算產生的和超出了數制表示的范圍,則結果發生了溢出發生了溢出Overflow)。)。 對于二進制補碼,加數的符號相同,和的符號與加數的對于二進制補碼,加數的符號相同,和的符號與加數的符號不同。(或者,符號不同。(或者,C in 與與 C out 不同)不同) P.41對于無符號二進制數,若最高有效位上發生進位或借位,對于無符號二進制數,若最高有效位上發生進位或借位,就指示結果超出范圍。就指示結果超出范圍。 5 1011 7 0111 6 1010 3 0011 11 10101 5 10 1010 6 Digital Logic Design and

17、 Application (數字邏輯設計及應用數字邏輯設計及應用)16OverflowOverflowSometimes result cant be represented with given number of bitsEither too large magnitude of positive or negativeEx. 4-bit twos complement addition of 0111+0001 (7+1=8). But 4-bit twos complement cant represent number 70111+0001 = 1000 WRONG answer,

18、1000 in twos complement is -8, not +8Adder/subtractor should indicate when overflow has occurred, so result can be discarded17Detecting Overflow: Method 1Detecting Overflow: Method 1For twos complement numbers, overflow occurs when the two numbers sign bits are the same but differ from the results s

19、ign bitIf the two numbers sign bits are initially different, overflow is impossibleAdding positive and negative cant exceed largest magnitude positive or negative0 1 1 11 0 0 0+000 1sign bitsoverflow(a )1 1 1 10 1 1 1+010 0overflow(b)1 0 0 01 1 1 1+101 1no overflow(c)If the numbers sign bits have th

20、e same value, whichdiffers from the results sign bit, overflow has occurred.18Detecting Overflow: Method 2Detecting Overflow: Method 2Even simpler method: Detect difference between carry-in to sign bit and carry-out from sign bit01111111001000+0001overflow( a )11100010111+0100overflow( b )1000000111

21、1+1011no overflow( c )If the carry into the sign bit column differs from thecarry out of that column, overflow has occurred.2.10 Binary Codes for Decimal Numbers2.10 Binary Codes for Decimal Numbers ( (十進制數的二進制編碼十進制數的二進制編碼) )Digital Logic Design and Application (數字邏輯設計及應用數字邏輯設計及應用)A set of n-bit str

22、ings in which different bit stringsRepresent different numbers or other things. (用于表示不同數或其它事件的一組用于表示不同數或其它事件的一組n位二進制碼的集合位二進制碼的集合)2.10 Binary Codes for Decimal Numbers2.10 Binary Codes for Decimal Numbers ( (十進制數的二進制編碼十進制數的二進制編碼) )How to represent a 1-bit Decimal number with a 4-bit Binary code (如何用如

23、何用 4位二進制碼位二進制碼 表示表示 1位十進制碼位十進制碼)? Binary Coded Decimal (BCD碼)碼)Digital Logic Design and Application (數字邏輯設計及應用數字邏輯設計及應用)2.10 Binary Codes for Decimal Numbers2.10 Binary Codes for Decimal Numbers ( (十進制數的二進制編碼十進制數的二進制編碼) )How to represent a Negative BCD number (負的負的BCD數如何表示數如何表示)?Signed-Magnitude Rep

24、resentation: Encoding of the sign bit is arbitrary (符號數值表示:符號位的編碼任意符號數值表示:符號位的編碼任意)10s-complement: 0000 indicates plus, 1001 indicates minus. (十進制補碼表示:十進制補碼表示:0000正,正,1001負負)Addition of BCD Digits (BCD數的加法數的加法) P.50Digital Logic Design and Application (數字邏輯設計及應用數字邏輯設計及應用)Digital Logic Design and App

25、lication (數字邏輯設計及應用數字邏輯設計及應用)2.10 Binary Codes for Decimal Numbers2.10 Binary Codes for Decimal Numbers ( (十進制數的二進制編碼十進制數的二進制編碼) (Table 2-9) (Table 2-9)Digital Logic Design and Application (數字邏輯設計及應用數字邏輯設計及應用)BCD Code2421 CodeExcess-3 (余余3碼碼)Biquinary Code (二五混合碼二五混合碼)1-out-of-10 (10中取中取1碼碼) Weighte

26、d Code (加權碼加權碼)Self-Complement Code自反碼自反碼Digital Logic Design and Application (數字邏輯設計及應用數字邏輯設計及應用)8421 codeNatural code , just like 4-bit binary numbers;Each digit is weighted;It has 10 valid code words and 6 invalid code words. BCD codesEach digit is weighted;Self-complementing;Use MSB to express h

27、igher/lower part;It has 10 valid codes and 6 invalid codes.2421 codesBCD codesBCD codesExcess-3 codeIts digit is not weighted; 8421 code + “0011”; Self-complementing .Examples: use BCD code for decimal numbers A = 19468421 code : A = 0001 1001 0100 01102421 code : A = 0001 1111 0100 1100Excess-3 cod

28、e: A = 0100 1100 0111 1001 BCD codes1-out-of-10 codeOne hot code:It is very useful in control systems.One hot codesTwo hot codesBiquinary code 7-bits; two hot code; First 2 bits is one hot code for higher/lower range; Last 5 bits is one hot code in the range. Error-detecting property ! From one code

29、 to its neighbor, only one bit changed, no transition state.Temperature code2.11 Gray code2.11 Gray code格雷碼)格雷碼)Digital Logic Design and Application (數字邏輯設計及應用數字邏輯設計及應用)2.11 Gray code2.11 Gray code格雷碼)格雷碼)Digital Logic Design and Application (數字邏輯設計及應用數字邏輯設計及應用)特點:特點:任意相鄰碼字間只有一位數位變化任意相鄰碼字間只有一位數位變化最高

30、位的最高位的0和和1只改變一次只改變一次最大數回到最大數回到0也只有一位碼元不同也只有一位碼元不同2.11 Gray code2.11 Gray code格雷碼)格雷碼)Digital Logic Design and Application (數字邏輯設計及應用數字邏輯設計及應用)構造方法構造方法直接構造直接構造 The bits of an n-bit binary cord word are numbered from right to left, from 0 to n-1. 對對 n 位二進制的碼字從右到左編號位二進制的碼字從右到左編號0 n-1) Bit i of a Gray-c

31、ode code word is 0 if bits i and i+1 of the corresponding binary code word are the same, else bit i is 1. (若二進制碼字的第若二進制碼字的第 i 位和第位和第 i + 1 位相同,則位相同,則對應的格雷碼碼字的第對應的格雷碼碼字的第 i 位為位為0,否則為,否則為1。)Reflected Code反射碼)反射碼)Gray codesTarget: code for continues changed numbers (in binary system) to prevent wrong c

32、ode happened in transition time;Property : In each pair of successive code words, only one bit changes.Gray codesFrom binary number to Gray code The width is same, the MSB is same; From left to right, if a bit in binary number is same as its left bit, the gray code is 0, if it is different, the gray

33、 code is 1. Examples: binary number: 1001 0010 0110 0011 Gray codes: 1101 1011 0101 0010Error-detecting codeInformation word + checking bitDigital Logic Design and Application (數字邏輯設計及應用數字邏輯設計及應用)2.12 Character Codes (字符編碼字符編碼) ASCII碼碼P36 表表2-11) ASCII code:128 Keyboard signs , 7-bit Used for keyboa

34、rd or display deviceDigital Logic Design and Application (數字邏輯設計及應用數字邏輯設計及應用)2.13 Codes for Actions, Conditions, and States (動作、條件和狀態的編碼) 運用 b 位二進制編碼來表示 n 個不同狀態Word: a digital string to represent an object Use n bits, we can make 2n different words;To make n words, you must use bits.n2logDigital Logic Design and Application (數字邏輯設計及應用數字邏輯設計及應用)2.16 Codes for Serial Data Transmission and Storage (用于串行數據傳輸與存儲的編碼用于串行數據傳輸與存儲的編碼)Parallel way use n-line to transmit an n-bits code words ; transmit an n-bits code words in one time period;Serial way use one line to transmit an n-bits cod

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
  • 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論