电子科技大学:《VHDL语言与数字集成电路设计》数字逻辑2-2

Representations of signed numbers In binary systems, an n-bit string can represent 2n different numbers 01234567 4-3210123 000001010011100101110111????000001010011 3-bit string unsigned numbers 3-bit string signed numbers Unsigned: 0--2n-1 Signed:-(2n--1-2n--1
Representations of signed numbers In binary systems , an n-bit string can represent 2n different numbers ! Unsigned: 0—2 n -1 signed: -(2n-1 -1)—2 n-1 -1

Representations of signed numbers If we want to represent 2n different numbers and their negative part, we have to use n+i bits i 0001001101010111 8了765 3210 234567 ????????0000001001000110 4-bit string MSB is not a value bit, but a sign bit Negative: 1 Positive: 0
Representations of signed numbers If we want to represent 2n different numbers and their negative part, we have to use n+1 bits ! MSB is not a value bit , but a sign bit : Negative : 1 Positive : 0

How to represent negative signed numbers Signed-magnitude code(s-M code): reversal 6 5 2 34 1111110110111001011101010010000001001000110100010101100111 1000 Ones complimentary code shift 65 32 3456 100010011010101111001101111000000001001000110100010101100111 1111 Twos complimentary code shift! 65432-101 1000100110101011110011011110111100000001001000110100010101100111
How to represent negative signed numbers Signed-magnitude code(S-M code): reversal ! One’s complimentary code : shift ! Two’s complimentary code : shift !

Converting rules for signed numbers From unsigned to signed Its msb is changed to the sign bit The number must be a positive Beware the overflow i Key point a positive signed num ber with any code must be the same! Its msb is“0”!
Converting rules for signed numbers From unsigned to signed: Its MSB is changed to the sign bit. The number must be a positive ! Beware the overflow ! Key point: A positive signed number with any code must be the same ! Its MSB is “0” !

Change the sign of a signed number signed-magnitude change the sign-bit; +21:00010101-21:10010101 one's complement: change every bit; +21:00010101-21:11101010 two’ s complement: change every bit, and add l at lsB +21:00010101-21:11101010 note: keep the width of the string in addition
Change the sign of a signed number signed-magnitude : change the sign-bit; +21: 0001 0101 -21: 1001 0101 one’s complement: change every bit; +21: 0001 0101 -21: 1110 1010 two’s complement: change every bit, and add 1 at LSB; +21: 0001 0101 -21: 1110 1010 note: keep the width of the string in addition !

Conversion from one code to another Step 1: check the Msb(sign-bit); For positive number (msb=0): no changes Step 2: For negative number (MSB=1) first change its sign by the former code way then change its sign by the next code way
Conversion: from one code to another Step 1: check the MSB (sign-bit) ; For positive number (MSB =0) : no changes! Step 2: For negative number (MSB =1) : first change its sign by the former code way; then change its sign by the next code way !

Conversion: from one code to another Examples s-M =01101001 B =10101001 Cnms=11001010 B twos s-M C,=? one s
Conversion: from one code to another Examples: AS−M = 01101001 Bone's =10101001 Ctwo's =11001010 ? Atwo's = = ? BS−M ? Cone's =

Addition for signed numbers 01015 01015 01015 +1011-3 1100-3 +1101-3 00000 00011 00102 S-M code Ones code Two's code Use addition rules for unsigned numbers only 'Twos code can get right result
Addition for signed numbers Use addition rules for unsigned numbers , only Two’s code can get right result !

Rules for Twos complement addition I two numbers must be the same length keep the length in addition. 2 subtract a number means add the negative number i Examples: 1110+1010=1000 0110-0011=0110+1101=0011
Rules for Two’s complement addition 1 two numbers must be the same length, keep the length in addition. 2 subtract a number means add the negative number ; Examples: 1110 + 1010 = 1000 0110 – 0011 = 0110 + 1101 = 0011

Twos complement addition Overflow the result exceeds the number ranges condition two numbers has the same sign; checking: the sign is wrong solving increase the data bit-length Examples 0101+0101=1011 101+1010=0111
Two’s complement addition Overflow : the result exceeds the number ranges ; condition : two numbers has the same sign; checking: the sign is wrong! solving : increase the data bit-length ! Examples: 0101 + 0101 = 1011 1101 + 1010 = 0111
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- 电子科技大学:《VHDL语言与数字集成电路设计》数字逻辑2-1.ppt
- 电子科技大学:《VHDL语言与数字集成电路设计》数字逻辑1-1.ppt
- 电子科技大学:《VHDL语言与数字集成电路设计》VHDL作业安排.doc
- 电子科技大学:《VHDL语言与数字集成电路设计》第九章 用户定义数据类型.ppt
- 电子科技大学:《VHDL语言与数字集成电路设计》第八章 VHDL的构造体:architecture.ppt
- 电子科技大学:《VHDL语言与数字集成电路设计》第七章 VHDL硬件描述语言.ppt
- 电子科技大学:《VHDL语言与数字集成电路设计》第六章 逻辑综合.ppt
- 电子科技大学:《VHDL语言与数字集成电路设计》第五章 数字集成电路的设计流程.ppt
- 电子科技大学:《VHDL语言与数字集成电路设计》第四章 数字集成电路的设计流程.ppt
- 电子科技大学:《VHDL语言与数字集成电路设计》第三章 数字集成电路的设计形式.ppt
- 电子科技大学:《VHDL语言与数字集成电路设计》第二十章 VHDL 与 Verilog HDL 的对比.ppt
- 电子科技大学:《VHDL语言与数字集成电路设计》第二章 数字集成电路的结构特点.ppt
- 电子科技大学:《VHDL语言与数字集成电路设计》第十九章 存储器模块的VHDL设计.ppt
- 电子科技大学:《VHDL语言与数字集成电路设计》第十八章 有限状态机FSM的设计.ppt
- 电子科技大学:《VHDL语言与数字集成电路设计》第十七章 时序运算模块的ⅥHDL设计.ppt
- 电子科技大学:《VHDL语言与数字集成电路设计》第十六章 组合运算模块的ⅥHDL设计.ppt
- 电子科技大学:《VHDL语言与数字集成电路设计》第十五章 数字电路模块的VHDL设计.ppt
- 电子科技大学:《VHDL语言与数字集成电路设计》第十四章 VHDL中的资源:库和包集合.ppt
- 电子科技大学:《VHDL语言与数字集成电路设计》第十三章 VHDL中的子结构.ppt
- 电子科技大学:《VHDL语言与数字集成电路设计》第十二章 VHDL中的结构设计:元件例化语句.ppt
- 电子科技大学:《VHDL语言与数字集成电路设计》数字逻辑2-3.ppt
- 电子科技大学:《VHDL语言与数字集成电路设计》数字逻辑3-1.ppt
- 电子科技大学:《VHDL语言与数字集成电路设计》数字逻辑3-2.ppt
- 电子科技大学:《VHDL语言与数字集成电路设计》数字逻辑3-3.ppt
- 西安电子科技大学:《光纤通信》课程电子教案(PPT课件)第1章 概论.ppt
- 西安电子科技大学:《光纤通信》课程电子教案(PPT课件)第2章 光纤和光缆.ppt
- 西安电子科技大学:《光纤通信》课程电子教案(PPT课件)第3章 通信用光器.ppt
- 西安电子科技大学:《光纤通信》课程电子教案(PPT课件)第4章 光端机.ppt
- 西安电子科技大学:《光纤通信》课程电子教案(PPT课件)第5章 数字光纤通信系统.ppt
- 西安电子科技大学:《光纤通信》课程电子教案(PPT课件)第6章 模拟光纤通信系统.ppt
- 中国矿业大学:《数字电子技术》课程教学资源(PPT课件讲稿)第一章 数制与编码.ppt
- 中国矿业大学:《数字电子技术》课程教学资源(PPT课件讲稿)第三章 逻辑门电路.ppt
- 中国矿业大学:《数字电子技术》课程教学资源(PPT课件讲稿)第九章 半导体存储器.ppt
- 中国矿业大学:《数字电子技术》课程教学资源(PPT课件讲稿)第二章 逻辑代数基础.ppt
- 中国矿业大学:《数字电子技术》课程教学资源(PPT课件讲稿)第五章 集成触发器.ppt
- 中国矿业大学:《数字电子技术》课程教学资源(PPT课件讲稿)第八章 脉冲波形的产生与整形.ppt
- 中国矿业大学:《数字电子技术》课程教学资源(PPT课件讲稿)第六章 时序逻辑电路.ppt
- 中国矿业大学:《数字电子技术》课程教学资源(PPT课件讲稿)第十章 模数和数模转换.ppt
- 中国矿业大学:《数字电子技术》课程教学资源(PPT课件讲稿)第四章 组合逻辑电路.ppt
- 中国矿业大学:《数字电子技术》课程教学资源(PPT课件讲稿)绪论(曹国清).ppt