2019姜书艳数字逻辑设计及应用ppt课件.ppt

上传人:小飞机 文档编号:1373581 上传时间:2022-11-15 格式:PPT 页数:66 大小:979.02KB
返回 下载 相关 举报
2019姜书艳数字逻辑设计及应用ppt课件.ppt_第1页
第1页 / 共66页
2019姜书艳数字逻辑设计及应用ppt课件.ppt_第2页
第2页 / 共66页
2019姜书艳数字逻辑设计及应用ppt课件.ppt_第3页
第3页 / 共66页
2019姜书艳数字逻辑设计及应用ppt课件.ppt_第4页
第4页 / 共66页
2019姜书艳数字逻辑设计及应用ppt课件.ppt_第5页
第5页 / 共66页
点击查看更多>>
资源描述

《2019姜书艳数字逻辑设计及应用ppt课件.ppt》由会员分享,可在线阅读,更多相关《2019姜书艳数字逻辑设计及应用ppt课件.ppt(66页珍藏版)》请在三一办公上搜索。

1、1,数字逻辑设计及应用,Chapter 2 Number Systems and codes (数系与编码) 介绍在数字逻辑体系中信号的表达方式、类型,不同表达方式之间的转换,运算的规则等。,Digital Logic Design and Application (数字逻辑设计及应用),2,Review of Chapter 1 (第一章内容回顾),Analog versus Digital (模拟与数字)Digital Devices (数字器件): Gates(门电路)、 Flip-flops(触发器)Electronic and Software Aspects of Digital

2、Design (数字设计的电子技术和软件技术),Digital Logic Design and Application (数字逻辑设计及应用),3,Review of Chapter 1 (第一章内容回顾),Integrated Circuit(IC,集成电路)Programmable Logic Devices(PLA、PLD、CPLD、FPGA, 可编程逻辑器件)Application-Specific ICs(ASIC, 专用集成电路)Printed-Circuit Boards (PCB, 印制电路板),Digital Logic Design and Application (数字

3、逻辑设计及应用),4,Chapter 2 Number Systems and codes (数系与编码),Two kinds of Information (信息主要有两类): Numeric Data (数值信息) Nonnumeric Data (非数值信息),Digital Logic Design and Application (数字逻辑设计及应用), Number Systems and their Conversions (数制及其转换),- Nonnumeric Data Representation Codes (非数值信息的表征 - 编码),5,Chapter 2 Num

4、ber Systems and codes (数系与编码),数字系统只处理数字信号 0 , 1;需要将任意信息用( 0 ,1 )表达;用(0,1)表达数量: 数制 二进制 用(0,1)表达不同对象: 符号编码,Digital Logic Design and Application (数字逻辑设计及应用),6,6,How to Encode Text: ASCII, Unicode,ASCII: 7- (or 8-) bit encoding of each letter, number, or symbol,Sample ASCII encodings, ,7,7,How to Encode

5、 Text: ASCII, Unicode,Unicode: Increasingly popular 16-bit encodingEncodes characters from various world languages, ,8,8,How to Encode Numbers: Binary Numbers,Base ten (decimal)Ten symbols: 0, 1, 2, ., 8, and 9More than 9 - next positionSo each position power (幂) of 10Nothing special about base 10 -

6、 used because we have 10 fingers,Each position represents a base quantity; symbol in position means how many of that quantity,9,9,How to Encode Numbers: Binary Numbers,Base two (binary)Two symbols: 0 and 1More than 1 - next positionSo each position power(幂) of 2,Q: How much?,a,Each position represen

7、ts a base quantity; symbol in position means how many of that quantity,There are only 10 types of people in the world: those who understand binary, and those who dont.,10,10,Useful to know powers of 2:,16,8,4,2,1,512,256,128,64,32,Practice counting up by powers of 2:,11,2.1 Positional Number System

8、(按位计数制),Any Decimal Number D Can Be Represented as the Following (任意十进制数 D 可表示如下):,D = dp-1 dp-2 . d1 d0 . d-1 d-2 . d-n,推广: D2 = d i 2i D16= d i 16i,Digital Logic Design and Application (数字逻辑设计及应用),12,2.1 Positional Number System (按位计数制),按位计数制的特点 1) 采用基数(Base or Radix), R进制的基数是R 2) 基数确定数符的个数 如十进制的数

9、符为:0、1、2、3、4、5、6、7、8、9,个数为10 二进制的数符为:0、1,个数为2 3)逢基数进一,Digital Logic Design and Application (数字逻辑设计及应用),13,2.1 Positional Number System (按位计数制),Digital Logic Design and Application (数字逻辑设计及应用),Decimal and Binary,Decimal system: base is 10, the digit may be 0 to 9,Binary system: base is 2, the digit m

10、ay be 0 or 1,bit: one digit in binary system;,14,14,Using Digital Data in a Digital System,temperature sensor,A temperature sensor outputs temperature in binaryThe system reads the temperature, outputs ASCII code:“F” for freezing (0-32)“B” for boiling (212 or more)“N” for normal,15,15,Using Digital

11、Data in a Digital System,temperature sensor,Digital System,display,N,A display converts its ASCII input to the corresponding letter,16,2.2 Octal and Hexadecimal Numbers (八进制和十六进制),基数,数码,特性,Octal Number (八,进制),8,07,逢,八,进一,Binary Number (二进制),2,0,1,逢二进一,Hexadecimal Number(十六进制),16,09,AF,逢十六进一,Digital

12、Logic Design and Application (数字逻辑设计及应用),17,说 明,Digital Logic Design and Application (数字逻辑设计及应用),选择什么数制来表示信息, 对数字系统的成本和性能影响很大, 在数字电路中多使用二进制.Most Significant Bit(MSB, 最高有效位)Least Significant Bit(LSB, 最低有效位)1011100010112MSB LSB,18,Digital Logic Design and Application (数字逻辑设计及应用),表2.1 十进制、二进制、八进制与十六进制数

13、,19,19,Base Sixteen: Another Base Used by Designers,Nice because each position represents four base-two positionsCompact way to write binary numbersKnown as hexadecimal, or just hex,Q: Write 11110000 in hex,Q: Convert hex A01 to binary,1010,0000,0001,A:,A:,20,二进制与八进制和十六进制之间的转换,位数替换法:保持小数点不变,每位八进制数对

14、应3位二进制数; 每位十六进制数对应4位二进制数;二进制转换时,从小数点开始向左右分组,在MSB前面和LSB后面可以加0;转换为二进制时,MSB前面和LSB后面的0不写;例:1011100010112=56138=B8B16 10111000.10112=207.548=B8.B16,1000110010012 = ( )8 = ( )16,Digital Logic Design and Application (数字逻辑设计及应用),21,21,Hex Example: RFID Tag,Batteryless(无电池) tag powered(功率) by radio fieldTran

15、smits(发送) unique identification(鉴定) numberExample: 32 bit id(身份证明)8-bit province number, 8-bit city number, 16-bit animal numberTag contents are in binaryBut programmers use hex when writing/reading,RFID,tag,Pr,o,vince #,City #,Animal #,Pr,o,vince,:,7,City,:,160,Animal,:,513,10100000,00000111,000000

16、10 00000001,A0,07,02 01,Tag ID in hex: 07A00201,(a),(b),(c),(d),(f),(e),22,2.3 General Positional-Number-System Conversion (常用按位计数制的转换),Digital Logic Design and Application (数字逻辑设计及应用),A Number in any Radix to Radix 10 (任意进制数 十进制数)Method: Expanding the formula using radix-10 arithmetic (方法:利用位权展开),E

17、xample 1:( 101.01 )2 = ( )10 ( 7F.8 )16 = ( )10,More easy way(更简便的方法)? ( F1AC )16 = ( ( ( F16 ) +1 ) 16 + A ) 16 + C,23,2.3 General Positional-Number-System Conversion (常用按位计数制的转换),Digital Logic Design and Application (数字逻辑设计及应用),A Number in Radix 10 to any Radix (十进制 其它进制)Method:Radix Multiplicatio

18、n or Division (基数乘除法) Integer Parts (整数部分): 除 r 取余,逆序排列 Example 2:( 156 )10 = ( )2 Decimal Fraction Parts (小数部分): 乘 r 取整,顺序排列 Example 3:( 0.37 )10 = ( )2,24,2.3 General Positional-Number-System Conversion (常用按位计数制的转换),Digital Logic Design and Application (数字逻辑设计及应用),Example 4:Require 10-2 ,Complete

19、the following conversion ( 617.28 )10 = ( )2,2-n = 10-2,思考:任意两种进位计数制之间的转换 以十进制(二进制)作为桥梁, n = 7,25,25,Converting To/From Binary by Hand: Summary,26,26,Divide-By-2 Method Common in Automatic Conversion,Repeatedly divide decimal number by 2, place remainder in current binary digit (starting from 1s col

20、umn),Note: Works for any base Njust divide by N instead,27,27,Bytes, Kilobytes, Megabytes, and More,Byte: 8 bitsCommon metric prefixes: kilo (thousand, or 103), mega (million, or 106), giga (billion, 千兆or 109), and tera (trillion, 万亿or 1012), e.g., kilobyte, or KByte,28,28,Bytes, Kilobytes, Megabyte

21、s, and More,BUT, metric prefixes also commonly used inaccurately216 = 65536 commonly written as “64 Kbyte”Typical when describing memory sizesAlso watch out for “KB” for kilobyte vs. “Kb” for kilobit,29,29,Example: DIP-Switch Controlled Channel,Ceiling fan receiver should be set in factory to respon

22、d to channel “73”Convert 73 to binary, set DIP(指拨) switch accordingly,Desired value: 73,4,0,0,2,1,1,16,0,8,1,32,0,64,1,128,0,64,72,73,sum:,(b),(a),Q:,30,Example: DIP-Switch Controlled Channel,31,2.4 Addition and Subtraction of Nondecimal Numbers (非十进制数的加法和减法),Digital Logic Design and Application (数字

23、逻辑设计及应用),Two Binary Number Arithmetic (两个二进制数的算术运算)Addition (加法): Carry (进位) 1 + 1 = 10Subtraction (减法): Borrows (借位) 10 1 = 1,32,Carry in (进位输入): C in (P.32) Carry out ( 进位输出 ) C out Sum ( 本位和 ): S,2.4 Addition and Subtraction of Non-decimal Numbers (非十进制数的加法和减法),Digital Logic Design and Applicatio

24、n (数字逻辑设计及应用),33,Digital Logic Design and Application (数字逻辑设计及应用),表2.3.1 二进制加法真值表,34,34,Adder Example: DIP-Switch-Based Adding Calculator,Goal: Create calculator that adds two 8-bit binary numbers, specified using DIP switchesDIP switch: Dual-In-line Package switch, move each switch up or downSoluti

25、on: Use 8-bit adder,35,Adder Example: DIP-Switch-Based Adding Calculator,Solution: Use 8-bit adder,DIP switches,1,0,a7.a0,b7.b0,s7s0,8-bit carry-ripple adder,co,ci,0,CALC,LEDs,36,36,Adder Example: DIP-Switch-Based Adding Calculator,To prevent spurious(假的) values from appearing at output, can place r

26、egister at outputActually, the light flickers(闪烁) from spurious values would be too fast for humans to detectbut the principle of registering outputs to avoid spurious values being read by external devices (which normally arent humans) applies here.,37,Adder Example: DIP-Switch-Based Adding Calculat

27、or,DIP switches,1,0,a7.a0,b7b0,s7s0,8-bit adder,8-bit register,co,ci,0,CALC,LEDs,e,clk,ld,38,Borrow in ( 借位输入 ): Bin Borrow out ( 借位输出 ): Bout Difference bit ( 本位差 ): D,2.4 Addition and Subtraction of Non-decimal Numbers (非十进制数的加法和减法),Digital Logic Design and Application (数字逻辑设计及应用),39,Digital Logic

28、 Design and Application (数字逻辑设计及应用),表2.3.2 二进制减法真值表,40,Subtractor Example: DIP-Switch Based Adding/Subtracting Calculator,Extend earlier calculator exampleSwitch f indicates whether want to add (f=0) or subtract (f=1)Use subtractor and 2x1 mux,41,Subtractor Example: DIP-Switch Based Adding/Subtracti

29、ng Calculator,42,2.5 Representation of Negative Numbers (负数的表示),Digital Logic Design and Application (数字逻辑设计及应用),2.5.1 Signed-Magnitude Representation 符号 数值表示法(原码)MSB as the Sign bit (0 = plus, 1 = minus) 最高有效位表示符号位( 0 = 正,1 = 负)01111111127 111111111270010111046 1010111046000000000 100000000,43,2.5

30、Representation of Negative Numbers (负数的表示),Digital Logic Design and Application (数字逻辑设计及应用),2.5.1 Signed-Magnitude Representation 符号 数值表示法(原码)Two possible representations of Zero 零有两种表示(+ 0、 0)An n-bit signed-magnitude integer range is (n位二进制整数表示范围): ( 2n-1 1) + ( 2n-1 1),44,2.5 Representation of Ne

31、gative Numbers (负数的表示),2.5.2 Complement Number Systems (补码数制)Radix Complement (基数补码)Diminished Radix Complement 基数减1补码 (反码) ,Digital Logic Design and Application (数字逻辑设计及应用),45,2.5 Representation of Negative Numbers (负数的表示),2.5.3 Radix Complement Representation ( 基数补码表示法) The complement of an n-digi

32、t number is obtained by subtracting it from r n (n位数的补码等于从 r n 中减去该数)Example : Table 2-4 P.36,Digital Logic Design and Application (数字逻辑设计及应用),46,2.5 Representation of Negative Numbers (负数的表示),Diminished Radix Complement Representation 基数减1补码表示法(反码): The Diminished Radix Complement of an n-digit num

33、ber is obtained by subtracting it from r n -1 n位数的反码等于从 r n 1 中减去该数Example : Table 2-4 2-5 P.36,Digital Logic Design and Application (数字逻辑设计及应用),47,47,Tens Complement,Before introducing twos complement, lets consider tens complementBut, be aware that computers DO NOT USE TENS COMPLEMENT. Introduced

34、for intuition(直觉) only.Complements for each base ten number shown to right. Complement is the number that when added results in 10,48,48,Tens Complement,Nice feature of tens complementInstead of subtracting a number, adding its complement results in answer exactly 10 too muchSo just drop(丢下) the 1 r

35、esults in subtracting using addition only,4,6,10,7,0,10,20,3,13,13,3,0,10,1,2,3,4,5,6,7,8,9,9,8,7,6,5,4,3,2,1,complements,74=3,7+6=13,Adding the complement results in an answer that is,exactly 10 too much dropping the tens column gives,the right answer.,49,2.5.4 Twos Complement Representation (二进制补码

36、表示法),The MSB of a number in this system serves as the sign bit(最高有效位用做符号位);The weight of the MSB is -2n-1 instead of + 2n-1 (MSB的权是-2n-1 而不是+ 2n-1 )Obtain a Twos- Complement ( 二进制补码的求取 ): Ones Complement (反码) + 1 (Why?),Digital Logic Design and Application (数字逻辑设计及应用),50,2.5.4 Twos Complement Repres

37、entation (二进制补码表示法),Digital Logic Design and Application (数字逻辑设计及应用),例2.5.1 若约定字长是一个字节,试求119的补码。解:因119的绝对值11901110111,则补码可以通过下式算法得到: 全1码: 1 1 1 1 1 1 1 1 减去119绝对值: 0 1 1 1 0 1 1 1 119的反码: 1 0 0 0 1 0 0 0 加1: 1 119补码: 1 0 0 0 1 0 0 1,51,2.5.4 Twos Complement Representation (二进制补码表示法),Only one represe

38、ntations of Zero ( 零只有一种表示 ) 00 0 0 0 0 0 0 0 逐位取反 1 1 1 1 1 1 1 1 1约定8位 0 0 0 0 0 0 0 00,Digital Logic Design and Application (数字逻辑设计及应用),52,2.5.4 Twos Complement Representation (二进制补码表示法),An n-bit Twos- Complement range is (n位二进制补码表示范围): 2 n-1 + ( 2 n-1 1) 约定字长(8比特)后,补码表示数的范围128127,Digital Logic D

39、esign and Application (数字逻辑设计及应用),53,2.5.4 Twos Complement Representation (二进制补码表示法),Positive number has the same: Sign-Magnitude, Ones Complement, and Twos- Complement ( 正数的原码、反码、补码相同),Digital Logic Design and Application (数字逻辑设计及应用),54,表2-6 1位十进制数与4位二进制数,55,2.5 Representation of Negative Numbers (

40、负数的表示),2.5.6 Ones Complement Representation (二进制反码表示法) The Sign Bit doesnt change, Other Bits converse based on the Signed-Magnitude. (符号位不变,其余在原码基础上按位取反),Digital Logic Design and Application (数字逻辑设计及应用),56,56,Representing Negative Numbers: Twos Complement,Big advantage: Allows us to perform subtrac

41、tion using additionThus, only need adder component, no need for separate subtractor component,57,Twos Complement Subtractor Built with an Adder,Using twos complement A B = A + (-B) = A + (twos complement of B) = A + invert_bits(B) + 1So build subtractor using adder by inverting Bs bits, and setting

42、carry in to 1,58,Twos Complement Subtractor Built with an Adder,1,Cin,B,A,Adder,S,B,A,N-bit,59,Summary of this class (本堂课小结),Binary, Octal, and Hexadecimal Numbers (二进制、八进制、十六进制),Positional Number System (按位计数制),Digital Logic Design and Application (数字逻辑设计及应用),60,General Positional-Number-System Con

43、version (常用按位计数制的转换)A Number in any Radix to Radix 10 : Expanding the formula using radix-10 arithmetic (任意进制数 十进制数:利用位权展开),Digital Logic Design and Application (数字逻辑设计及应用),Summary of this class (本堂课小结),61,General Positional-Number-System Conversion (常用按位计数制的转换)A Number in Radix 10 to any Radix : Ra

44、dix Multiplication or Division (十进制 其它进制:基数乘除法)Note: Decimal Fraction Parts Conversion 注意:小数部分的转换(误差),Digital Logic Design and Application (数字逻辑设计及应用),Summary of this class (本堂课小结),62,Addition and Subtraction of Nondecimal Numbers (非十进制的加法和减法) (Table 2-3) 进位输入 Cin 、进位输出 Cout 、 本位和 S 借位输入 Bin 、借位输出 B

45、out 、 本位差 D,Digital Logic Design and Application (数字逻辑设计及应用),Summary of this class (本堂课小结),63,Representation of Negative Numbers (负数的表示) Signed-Magnitude 符号数值(原码) Complement Number Systems (补码数制),Digital Logic Design and Application (数字逻辑设计及应用),Summary of this class (本堂课小结),64,Binary Signed-Magnitud

46、e, Ones Complement, and Twos Complement Representation (二进制的原码、反码、补码)正数的原码、反码、补码表示相同负数的原码表示:符号位为 1负数的反码表示: 符号位不变,其余在原码基础上按位取反 在 |D| 的原码基础上按位取反(包括符号位)负数的补码表示:反码 + 1,Digital Logic Design and Application (数字逻辑设计及应用),Summary of this class (本堂课小结),65,第2章作业(P5052),Digital Logic Design and Application (数字逻

47、辑设计及应用),2.1 (e) (i)2.2 (e)2.3 (e)2.42.5 (e) (j)2.6 (f) 补充:(125.17)10=?22.7 (a),2.8 (a)2.9 (b)2.10 (c)2.11 +25 422.18 (b) (d)2.19,66,A Class Problem,Write the 8-bit Signed-magnitude, Twos-complement, and Ones- complement for each of these decimal numbers: +115 -100,Digital Logic Design and Application (数字逻辑设计及应用),

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 生活休闲 > 在线阅读


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号