




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、Chapter 2 Number Systems and codes (數(shù)系與編碼)Numeric Data Number Systems and their Conversions (數(shù)值信息 數(shù)制及其轉(zhuǎn)換) Nonnumeric Data Codes (非數(shù)值信息 編碼)Digital Logic Design and Application (數(shù)字邏輯設(shè)計(jì)及應(yīng)用)1Review of Chapter 2 (第二章內(nèi)容回顧)Binary, Octal, and Hexadecimal Numbers (二進(jìn)制、八進(jìn)制、十六進(jìn)制)Positional Number System (按位計(jì)數(shù)制
2、)Digital Logic Design and Application (數(shù)字邏輯設(shè)計(jì)及應(yīng)用)2Review of Chapter 2 (第二章內(nèi)容回顧)General Positional-Number-System Conversion (常用按位計(jì)數(shù)制的轉(zhuǎn)換)A Number in any Radix to Radix 10 : Expanding the formula using radix-10 arithmetic (任意進(jìn)制數(shù) 十進(jìn)制數(shù):利用位權(quán)展開)Digital Logic Design and Application (數(shù)字邏輯設(shè)計(jì)及應(yīng)用)3Review of Cha
3、pter 2 (第二章內(nèi)容回顧)General Positional-Number-System Conversion (常用按位計(jì)數(shù)制的轉(zhuǎn)換)A Number in Radix 10 to any Radix : Radix Multiplication or Division (十進(jìn)制 其它進(jìn)制:基數(shù)乘除法)Note: Decimal Fraction Parts Conversion 注意:小數(shù)部分的轉(zhuǎn)換(誤差)Digital Logic Design and Application (數(shù)字邏輯設(shè)計(jì)及應(yīng)用)4Review of Chapter 2 (第二章內(nèi)容回顧)Addition an
4、d Subtraction of Nondecimal Numbers (非十進(jìn)制的加法和減法) (Table 2-3) 進(jìn)位輸入 Cin 、進(jìn)位輸出 Cout 、 本位和 S 借位輸入 Bin 、借位輸出 Bout 、 本位差 DDigital Logic Design and Application (數(shù)字邏輯設(shè)計(jì)及應(yīng)用)5Review of Chapter 2 (第二章內(nèi)容回顧)Representation of Negative Numbers (負(fù)數(shù)的表示) Signed-Magnitude 符號數(shù)值(原碼) Complement Number Systems (補(bǔ)碼數(shù)制)Radix
5、 Complement (基數(shù)補(bǔ)碼)Diminished Radix Complement 基數(shù)減1補(bǔ)碼(基數(shù)反碼)Digital Logic Design and Application (數(shù)字邏輯設(shè)計(jì)及應(yīng)用)6Review of Chapter 2 (第二章內(nèi)容回顧)Binary Signed-Magnitude, Ones Complement, and Twos Complement Representation (二進(jìn)制的原碼、反碼、補(bǔ)碼)正數(shù)的原碼、反碼、補(bǔ)碼表示相同負(fù)數(shù)的原碼表示:符號位為 1負(fù)數(shù)的反碼表示: 符號位不變,其余在原碼基礎(chǔ)上按位取反 在 |D| 的原碼基礎(chǔ)上按位取反
6、(包括符號位)負(fù)數(shù)的補(bǔ)碼表示:反碼 + 1Digital Logic Design and Application (數(shù)字邏輯設(shè)計(jì)及應(yīng)用)72.5.4 Twos Complement Representation (二進(jìn)制補(bǔ)碼表示法)An n-bit Twos- Complement range is (n位二進(jìn)制補(bǔ)碼表示范圍): 2 n-1 + ( 2 n-1 1) Only one representations of Zero ( 零只有一種表示 ) Obtain a Twos- Complement ( 二進(jìn)制補(bǔ)碼的求取 ): Ones Complement (反碼) + 1 (為什么
7、?) Expanding the Sign Bit ( 符號位擴(kuò)展 )Digital Logic Design and Application (數(shù)字邏輯設(shè)計(jì)及應(yīng)用)82.5 Representation of Negative Numbers (負(fù)數(shù)的表示)Example 2.5.2:Write the 8-bit signed-magnitude, twos-complement for each of these binary numbers. (分別寫出下面二進(jìn)制數(shù)的8位符號數(shù)值碼、補(bǔ)碼) ( 1101 )2 ( 0 . 1101 )2 Digital Logic Design and
8、 Application (數(shù)字邏輯設(shè)計(jì)及應(yīng)用)92.5 Representation of Negative Numbers (負(fù)數(shù)的表示)Digital Logic Design and Application (數(shù)字邏輯設(shè)計(jì)及應(yīng)用) 1、( 1101 )2 2、( 0 . 1101 )2 1、5位二進(jìn)制表示: 原碼 反碼 補(bǔ)碼1 1101 1 0010 1 00112、8位二進(jìn)制表示: 原碼 反碼 補(bǔ)碼1000 1101 1111 0010 1111 0011 D 反 反 = D D 補(bǔ) 補(bǔ) = D102.6 Twos Complement Addition and Subtractio
9、n (二進(jìn)制補(bǔ)碼的加法和減法)Addition Rules: Added by ordinary binary addition (加法:按普通二進(jìn)制加法相加)P.39Subtraction Rules: Taking its twos complement, then add (減法:將減數(shù)求補(bǔ),再相加)Digital Logic Design and Application (數(shù)字邏輯設(shè)計(jì)及應(yīng)用)112.6 Twos Complement Addition and Subtraction (二進(jìn)制補(bǔ)碼的加法和減法)Digital Logic Design and Application (
10、數(shù)字邏輯設(shè)計(jì)及應(yīng)用) 2 0010 3 1101 5 0101 5 1011 7 0111 8 11000 7 0111 1 0001 4 1100 6 1010 3 10011 5 10111213Adder/Subtractor Example: CalculatorPrevious calculator used separate adder and subtractorDIP switches108-bitregisterCALCLEDsefclkld88800888882x10110wiciAABBSScowo8-bit adder8-bit subtractor1314Adder/
11、Subtractor Example: CalculatorImprove by using adder/subtractor, and twos complement numbersDIP switches108-bit register8-bit adder/subtractorsubCALCLEDseSABfclkld108888142.6 Twos Complement Addition and Subtraction (二進(jìn)制補(bǔ)碼的加法和減法)Overflow(溢出)如果加法運(yùn)算產(chǎn)生的和超出了數(shù)制表示的范圍,則結(jié)果發(fā)生了溢出(Overflow)。 對于二進(jìn)制補(bǔ)碼,加數(shù)的符號相同,和的
12、符號與加數(shù)的符號不同。(或者,C in 與 C out 不同) P.41對于無符號二進(jìn)制數(shù),若最高有效位上發(fā)生進(jìn)位或借位,就指示結(jié)果超出范圍。 5 1011 7 0111 6 1010 3 0011 11 10101 5 10 1010 6 Digital Logic Design and Application (數(shù)字邏輯設(shè)計(jì)及應(yīng)用)1516OverflowSometimes result cant be represented with given number of bitsEither too large magnitude of positive or negativeEx. 4-b
13、it twos complement addition of 0111+0001 (7+1=8). But 4-bit twos complement cant represent number 70111+0001 = 1000 WRONG answer, 1000 in twos complement is -8, not +8Adder/subtractor should indicate when overflow has occurred, so result can be discarded1617Detecting Overflow: Method 1For twos compl
14、ement numbers, overflow occurs when the two numbers sign bits are the same but differ from the results sign bitIf the two numbers sign bits are initially different, overflow is impossibleAdding positive and negative cant exceed largest magnitude positive or negative01111000+0001sign bitsoverflow(a)1
15、1110111+0100overflow(b)10001111+1011no overflow(c)If the numbers sign bits have the same value, whichdiffers from the results sign bit, overflow has occurred.1718Detecting Overflow: Method 2Even simpler method: Detect difference between carry-in to sign bit and carry-out from sign bit01111111001000+
16、0001overflow(a)11100010111+0100overflow(b)10000001111+1011no overflow(c)If the carry into the sign bit column differs from thecarry out of that column, overflow has occurred.182.10 Binary Codes for Decimal Numbers (十進(jìn)制數(shù)的二進(jìn)制編碼)Digital Logic Design and Application (數(shù)字邏輯設(shè)計(jì)及應(yīng)用)A set of n-bit strings in
17、which different bit stringsRepresent different numbers or other things. (用于表示不同數(shù)或其它事件的一組n位二進(jìn)制碼的集合)192.10 Binary Codes for Decimal Numbers (十進(jìn)制數(shù)的二進(jìn)制編碼)How to represent a 1-bit Decimal number with a 4-bit Binary code (如何用 4位二進(jìn)制碼 表示 1位十進(jìn)制碼)? Binary Coded Decimal (BCD碼)Digital Logic Design and Applicati
18、on (數(shù)字邏輯設(shè)計(jì)及應(yīng)用)202.10 Binary Codes for Decimal Numbers (十進(jìn)制數(shù)的二進(jìn)制編碼)How to represent a Negative BCD number (負(fù)的BCD數(shù)如何表示)?Signed-Magnitude Representation: Encoding of the sign bit is arbitrary (符號數(shù)值表示:符號位的編碼任意)10s-complement: 0000 indicates plus, 1001 indicates minus. (十進(jìn)制補(bǔ)碼表示:0000正,1001負(fù))Addition of BC
19、D Digits (BCD數(shù)的加法) P.50Digital Logic Design and Application (數(shù)字邏輯設(shè)計(jì)及應(yīng)用)21Digital Logic Design and Application (數(shù)字邏輯設(shè)計(jì)及應(yīng)用)222.10 Binary Codes for Decimal Numbers (十進(jìn)制數(shù)的二進(jìn)制編碼) (Table 2-9)Digital Logic Design and Application (數(shù)字邏輯設(shè)計(jì)及應(yīng)用)BCD Code2421 CodeExcess-3 (余3碼)Biquinary Code (二五混合碼)1-out-of-10 (1
20、0中取1碼) Weighted Code (加權(quán)碼)Self-Complement Code自反碼23Digital Logic Design and Application (數(shù)字邏輯設(shè)計(jì)及應(yīng)用)248421 codeNatural code , just like 4-bit binary numbers;Each digit is weighted;It has 10 valid code words and 6 invalid code words. BCD codes25Each digit is weighted;Self-complementing;Use MSB to expr
21、ess higher/lower part;It has 10 valid codes and 6 invalid codes.2421 codesBCD codes26BCD codesExcess-3 codeIts digit is not weighted; 8421 code + “0011”; Self-complementing .27Examples: use BCD code for decimal numbers A = 19468421 code : A = 0001 1001 0100 01102421 code : A = 0001 1111 0100 1100Exc
22、ess-3 code: A = 0100 1100 0111 1001 BCD codes281-out-of-10 codeOne hot code:It is very useful in control systems.One hot codes29Two 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 !
23、30From one code to its neighbor, only one bit changed, no transition state.Temperature code312.11 Gray code(格雷碼)Digital Logic Design and Application (數(shù)字邏輯設(shè)計(jì)及應(yīng)用)322.11 Gray code(格雷碼)Digital Logic Design and Application (數(shù)字邏輯設(shè)計(jì)及應(yīng)用)特點(diǎn):任意相鄰碼字間只有一位數(shù)位變化最高位的0和1只改變一次最大數(shù)回到0也只有一位碼元不同332.11 Gray code(格雷碼)Digit
24、al Logic Design and Application (數(shù)字邏輯設(shè)計(jì)及應(yīng)用)構(gòu)造方法直接構(gòu)造 The bits of an n-bit binary cord word are numbered from right to left, from 0 to n-1. 對 n 位二進(jìn)制的碼字從右到左編號(0 n-1) Bit i of a Gray-code code word is 0 if bits i and i+1 of the corresponding binary code word are the same, else bit i is 1. (若二進(jìn)制碼字的第 i 位和
25、第 i + 1 位相同,則對應(yīng)的格雷碼碼字的第 i 位為0,否則為1。)Reflected Code(反射碼)34Gray codesTarget: code for continues changed numbers (in binary system) to prevent wrong code happened in transition time;Property : In each pair of successive code words, only one bit changes.35Gray codesFrom binary number to Gray code The wi
26、dth 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 code is 1. Examples: binary number: 1001 0010 0110 0011 Gray codes: 1101 1011 0101 001036Error-detecting codeInformation word + checking bit37Digital
27、Logic Design and Application (數(shù)字邏輯設(shè)計(jì)及應(yīng)用)2.12 Character Codes (字符編碼) ASCII碼(P36 表2-11) ASCII code:128 Keyboard signs , 7-bit Used for keyboard or display device38Digital Logic Design and Application (數(shù)字邏輯設(shè)計(jì)及應(yīng)用)2.13 Codes for Actions, Conditions, and States (動作、條件和狀態(tài)的編碼) 使用 b 位二進(jìn)制編碼來表示 n 個(gè)不同狀態(tài)Word: a
28、digital string to represent an object Use n bits, we can make 2n different words;To make n words, you must use bits.39Digital Logic Design and Application (數(shù)字邏輯設(shè)計(jì)及應(yīng)用)2.16 Codes for Serial Data Transmission and Storage (用于串行數(shù)據(jù)傳輸與存儲的編碼)Parallel way use n-line to transmit an n-bits code words ; transmit an n-bits code
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 中標(biāo)格式合同范本
- 省級課題申報(bào)書研究手段
- 買貓質(zhì)保合同范本
- 鳳爪貿(mào)易合同范本
- 烹飪課題申報(bào)書
- 2025生產(chǎn)設(shè)備大數(shù)據(jù)輕量化采集要求
- 單方面解約合同范本
- 產(chǎn)供銷合同范本
- 小學(xué)音樂類課題申報(bào)書
- 制作公司合同范本
- 2025年中央一號文件高頻重點(diǎn)考試題庫150題(含答案解析)
- 世界給予我的 課件-2024-2025學(xué)年高二下學(xué)期開學(xué)第一課主題班會
- 《十萬個(gè)為什么》整本書閱讀-課件-四年級下冊語文(統(tǒng)編版)
- 法社會學(xué)教程(第三版)教學(xué)
- (高清版)DZT 0208-2020 礦產(chǎn)地質(zhì)勘查規(guī)范 金屬砂礦類
- HGT4134-2022 工業(yè)聚乙二醇PEG
- 2023版押品考試題庫必考點(diǎn)含答案
- 2023版押品考試題庫必考點(diǎn)含答案
- 安全文明施工管理(EHS)方案(24頁)
- 投標(biāo)人基本情況一覽表格
- 磷石膏堆場污染防治技術(shù)指南
評論
0/150
提交評論