ImageVerifierCode 换一换
格式:DOC , 页数:8 ,大小:84KB ,
资源ID:8275241      下载积分:10 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.docduoduo.com/d-8275241.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录   微博登录 

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(Number System and Coding.doc.doc)为本站会员(hwpkd79526)主动上传,道客多多仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知道客多多(发送邮件至docduoduo@163.com或直接QQ联系客服),我们立即给予删除!

Number System and Coding.doc.doc

1、CS1104 Computer Organization 1Number System and Coding Number system consists of an ordered set of digits, with relations defined for +, -, * and /. The radix (r) or base of a number system indicates the total number of digits allowed in the number system. Common number system include:- decimal- bin

2、ary- octal - hexadecimalPositional NotationsWeighted-Positional notation Decimal Number System - symbols used: 0,1,2,3, 9 Position of each digit is important.e.g. (40982) = 4x10 + 0X10 + 9X10 + 8X10 +2X10In general: (an an-1 an-2 a0)10 = (anx10 ) + (an-1x10 )+(a0x10 )FractionsFractions are written i

3、n decimal numbers after the decimal point.e.g. 333/4 = (33.75)10= (3x10 ) + (3x10 ) + (7x10 ) + (5x10 )In case of recurring fraction, use for recurring position.e.g. 21/3 = (2.333333)10= (2.3)10In general, (an an-1a0.f1 f2 fm)10 = (anx10 )+(an-1x10 )+(a0x10 )+(f1x10 )+(fmx10 )Conversion Between Base

4、s In general, conversion between bases can be done via:104 3 2 1 0n n-1 01202-12-22.n n-1 0 -1 -mBase-2Base-3Base-rBase-2Base-3Base-rDecimal.CS1104 Computer Organization 2Base r DecimalBinary(base 2) DecimalGeneral: (an an-1 an-2 a0.f1 f2fm)2 = (anx2 ) + (an-1x2 )+(a0x2 )+ (f1x2 )+(f2x2 )+(fmx2 )e.g

5、 (10110.01)2 = (1x2 )+(1x2 )+(1x2 )+(1x2 )= (22.25)10Octal(base 8) Decimale.g. (47.5)8 = (4x8 )+(7x8 )+(5x8 )= (39.625)10Hexadecimal(base 16) Decimale.g (BAD2.C)16 = (11x16 )+(10x16 )+(13x16 )+(2x16 )+(12x16 )= (47826.75)10Note: Hexadecimal digits are 0,1,2,3,4,5,6,7,8,9,A.B,C,D,E,F where A=10, B=11

6、,C=12,D=13,E=14,F=15.Generally, for Base r Decimal,(an an-1 an-2 a0.f1 f2fm)r = (an x r ) + (an-1 x r )+(a0 x r )+ (f1 x r )+(f2 x r )+(fm x r )Decimal Base rGenerally, (an an-1 a0.f1 f2 fp)10 (bm bm-1 b0.g1 g2 gq)rNote that Integers(whole number) and fractions are converted separately.i.e. (an an-1

7、 a0)10 (bm bm-1 b0)r(f1 f2 fp)10 (g1 g2 gq)rDecimal Binary(base 2)e.g. convert (41.375)10 to binary representation1.Integer partmethod: Coefficients obtained from remainders of successive division by 2. The first remainder is the least significant bit(LSB) and the last remainder is the most signific

8、ant bit(MSB).(41)10 = (101001)241/2 =20 rem 120/2 =10 rem 010/2 =5 rem 05/2 =2 rem 1n2n-2202-12-22-m2422212-2212n2-1232221202-1202n-1202 -12-22-m2Integer partFraction partCS1104 Computer Organization 32/2 =1 rem 01/2 =0 rem 1Hence result: (101001)2 2.Fractional partmethod: Coefficients of binary fra

9、ction obtained by successive multiplication of decimal fraction by 2. Coefficient will appear as integer portion of successive multiplication.(.375)10 = (.011)2 .375 x 2 = 0.75 0 MSB.75 x 2 = 1.5 1.5 x 2 = 1.0 1 LSBHence result: (.011)2In general: Decimal Base r- whole number: repeated division by r

10、- fractions : repeated multiplication by rBinary Octal / Hexadecimal ConversionOctal- 1 octal digit = 3 binary digits(bits)e.g. (001)2 = (1)8 (101)2 = (5)8(010)2 = (2)8 (111)2 = (7)8Techniques for converting binary octal group 3-bits and convert into corresponding octal digit.e.g. (10 110 001 101 01

11、1 111 100 000 1)2=(2 6 1 5 3 7 4 0 4)8Hexadecimal- 1 hexadecimal digit = 4 bitse.g. (1111)2 = (F)16 (1000)2 = (8)16(1010)2 = (A)16 (0010)2 = (2)16Techniques for converting binary hexadecimal group 4-bits and convert into corresponding hexadecimal digit.e.g. (10 1100 0110 1011 . 1111 0000 01)2 =(2 C

12、6 B F 0 4)16CS1104 Computer Organization 4Negative NumbersSign&MagnitudeNegative numbers are usually written by prepending a MINUS SIGN(-) in front.e.g. (7)10, -(0111)2In computer memory of fixed width, this sign is usually represented by a bit.- 0 for +- 1 for - Given a 8-bit number, MSB is the sig

13、n bit and the remaining 7 bits are magnitude.Note: to negate a number, just invert the sign bite.g. (0 0110010) = (1 0110010)sm(1 0111010) = (0 0111010)sm1s ComplementGiven an n-bit number, x, its negative number can be obtained in 1s complement representation using:x = 2 x 1e.g. given an 8-bit numb

14、er: (01001100)2 = (96)10= (2 96 1) 10=(159)10=(10110011)1sTechnique is INVERT all bits.(10 or 0 1) (01010101)2 = (10101010)1sNote, given a positive n-bit binary number, its 1s complement representation is still the same as the binary number.e.g. +(00011001)2 = (00011001)1s2s ComplementGiven an n-bit

15、 binary number, x, its negative number can be obtained in 2s complement representation using:x = 2 x e.g. given an 8-bit number: (01001100)2 = (96)10= (2 96)10= (160)10= (10110100)2sTechnique is INVERT all the bits and ADD 1e.g. (01010101)2 = (10101010)1s (invert)= (10101011)2s (add 1)n282n282CS1104

16、 Computer Organization 5Note: Given a positive n-bit number, its 2s complement representation is still the same as the binary number.e.g. +(00100100)2 = (00100100)2sComplementIn general, for base-r number, there are:- Diminished Radix (or r-1s) complement- Radix (or rs) complementDiminished Radix Co

17、mplementGiven an n-digit number, (N)r, its (r-1s) complement is:(r 1) Ne.g. The (r-1s) complement, or 9s complement of (15)10 is:(10 1) 15 = 99 5= (84)9sThe (r-1s) complement, or 7s complement of (327)8 is:(8 1) (327)8 = 777 327= (450)7sRadix ComplementGiven an n-digit number, (N)r, its rs complemen

18、t is:r Ne.g. The rs complement, or 10s complement of (15)10 is:10 15 = 100 15= (85)10sTechnique is use: (r-1s) complement + 1e.g. The 8s complement of (57)8 is:(8 1) (57)8 = 77 57 (7s complement)= (20)7s + 1 (add 1)= (21)8s (8s complement)Subtraction - Using r-Complement- Using r-1 ComplementSubtrac

19、tion using r-ComplementTechnique: Given 2 unsigned base-r numbers, M & N, Subtraction of (MN) is done by:1. add M to the r-complement N: M + (r N) = (MN) + r 2. if M = N, then there will be an end-carry r . So discard this end carry.3. if M N, then there will be an end-carry r . So discard this end

20、carry and add 1 to get: (MN1) + 1 = M N3. if M = N, then there is no end carry, but have ve result(incl 0): (M-N-1)+ r To get the normal form, take (r-1) complement to get: (r 1) (MN) + r ) = N-M. Then put MINUS sign in front(if result is not 0).e.g.(33)10 (22)10 = 33 +(99-22)9s= (33 + 77)9s= (110)9

21、s (discard end carry, add 1)= (10 +1)10= (11)10(10)10 (22)10 = 10 + (99 22)9s= (10 + 77)9s= (87)9s (no end carry, so complement it)= -(99 87)10= -(12)10Fixed Point NumbersSigned and unsigned numbers representation are fixed point numbers. The binary point is assumed to be at a fixed position.222222n

22、2n2n2n2n2n2 n2n2Binary point22CS1104 Computer Organization 7But the binary point can also be in other locations.e.g. 123.23, 12.323Cons of fixed point numbers: It have limited range.To represent very large numbers or very small numbers, need to use floating point numbers.e.g. 0.23 x 10 (very large p

23、ositive number)-0.1236 x 10 (very small negative number|)Floating Point Numbers- consist of 3 parts: mantissa, base and exponent.Since base is usually fixed, only need mantissa and exponent.Mantissa is usually in normalized form. i.e. 23 x 10 is normalized to 0.23 x 10 -0.0017 x 10 is normalized to

24、0.17 x 10A 32-bit number can have 24-bit mantissa and 8-bit exponent.More bits in exponent gives larger range.More bits in mantissa gives better precision.Floating Point Arithmetic Addition Steps: (i) equalise the exponents(ii) add-up the mantissa(iii) normalisee.g:(0.12 x 103)10 + (0.2 x 102)10 = (

25、0.12 x 103)10 + (0.02 x 103)10 (equalise exponents)= (0.12 + 0.02)10 x 103 (add mantissa)= (0.14 x 103)10 MultiplicationSteps: (i) multiply the mantissa(ii) add-up the exponents(iii) normalisee.g:(0.12 x 102)10 x (0.2 x 1030)10 = (0.12 x 0.2)10 x 102+30 = (0.024)10 x 1032 (normalise)= (0.24 x 1031)1

26、0 232 -102212232 212192CS1104 Computer Organization 8Error Detection Codes Errors can occur during data transmission. They should be detected, so that re-transmission can be requested. With binary numbers, usually single-bit errors occur.e.g. 0010 erroneously transmitted as 0011, or 0000, or 0110, or 1010.For single-error detection, one additional bit is needed.Parity bit.Even parity: additional bit supplied to make total number of 1s even.Odd parity: additional bit supplied to make total number of 1s odd.

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


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

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

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