收藏 分享(赏)

软硬件系统编程PPT (12).pdf

上传人:职教中国 文档编号:14170359 上传时间:2022-12-22 格式:PDF 页数:16 大小:631.70KB
下载 相关 举报
软硬件系统编程PPT (12).pdf_第1页
第1页 / 共16页
软硬件系统编程PPT (12).pdf_第2页
第2页 / 共16页
软硬件系统编程PPT (12).pdf_第3页
第3页 / 共16页
亲,该文档总共16页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

1、机器数的表示与运算Representation and Operation of Machine Numbers21.Machine numbers Number in the computer is called the Machine Number Structure sign bit+true value“0”“1”The positive signThe negative sign3E.g.+52=+0110100=0 0110100-52=-0110100=1 0110100sign bitsign bittrue valuetrue value42.Representation o

2、f machine numbers Representation of machine numbers Original code Inverse code Complement5Original codeUse the most significant bit to represent the sign bit,the remaining bits to represent true value.“0”Positive 0“1”Negative 1AdvantageThe true value of the original code is equal to its numerical va

3、lue,which is easy to understand.DisadvantageIt is difficult to use the original code to do add and subtract operations in the computer0 in the original code,its representation is not unique6The original code of 0 the representation of 0 in 8 bits+0=0 0000000-0=1 00000000 has more than one representa

4、tion in original code7Inverse codeFor a machine numberX If X 0X original=X anti-If X 0 X anti-is based on its original code,the symbol bit is unchanged,and the remaining bits are reversed.8E.g.X=-52=-0110100Xoriginal=1 0110100Xanti-=1 10010119The inverse code of 0-0anti-=00000000-0anti-=111111110 ha

5、s more than one representation in inverse code10ComplementThe complement representation method If X 0X Complement=X anti=X original If X0 X Complement=X anti 111E.g X=-52=-0110100X original=10110100X anti-=11001011X Complement=X anti 1=1100110012The complement of 0=1 00000000 Complement codes is the

6、 commonly used codes in computer.+0complement=+0original=00000000-0 complement=-0 anti+1=11111111+1If the computer employed an 8-bit character code,the first bit is omitted133.Complement Arithmetic Operation Complement can convert the subtraction operation to addition operation Because:X+Y Complemen

7、t=X Complement Y ComplementX Y Complement=X+(Y)Complement=X Complement Y ComplementE.g 1.66-51=66+(-51)=15 Twos Complement arithmetic operation 14 66 Complement=66 original=01000010 51 original=10110011 51 Complement=11001101 66 Complement 51 Complement=00001111=15115E.g 2.If X=52=0110100,Y=116=1110

8、100,X+Y=?X original=10110100 XComplement=Xanti+1=11001100 Y Complement=Y original=01110100 X+Y Complement=X Complement Y Complement=11001100+01110100=01000000 X+Y=+1000000 In modern computer systems,when programming,negative numbers can be represented by-,which is converted to complement codes by the compiler.E.g.If input-3 Compiled code=FDH

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

当前位置:首页 > 高等教育 > 大学课件

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报