📄 chap.2.infocoding.ps
字号:
2851(a)X2920(\256xed)X3138(representation.)X3758(For)X3917(an)X2 f4034(n-digit)X8 p%%Page: 8 512 s 0 xH 0 xS 2 f1 f3 f576 400(57:017)N872(CIE)X1 f2353(-)X2409(8)X2481(-)X3 f3717(Lecture)X4062(Notes)X1 f576 803(representation,)N1172(the)X1316(largest)X1599(possible)X1940(unsigned)X2313(value)X2548(is)X2 f2637(b)X9 s2697 765(n)N1 f12 s2 f9 f2765 803(-)N1 f2842(1.)X2939(For)X3097(example,)X3473(the)X3616(range)X3855(of)X3960(numbers)X576 915(representable)N1114(with)X1309(an)X1424(8-bit)X1630(binary)X1900(format)X2181(is)X2269(0)X2341(through)X2664(255.)X2856(I.e.,)X3027(2)X9 s877(8)Y12 s2 f9 f3143 915(=)N1 f3220(256,)X3412(and)X3575(256)X2 f9 f3743(-)X1 f3820(1)X2 f9 f3892(=)X1 f3969(255.)X3 f576 1139(Binary)N883(Coded)X1173(Decimal)X1534(\(BCD\))X1824(Representation)X1 f776 1279(A)N870(seldom-used)X1381(representation)X1952(for)X2089(unsigned)X2461(numbewrs)X2886(is)X2975(the)X2 f3118(Binary)X3406(Coded)X3683(Decimal)X4035(\(BCD\))X1 f576 1391(system.)N894(It)X980(is)X1071(seldom)X1376(used)X1579(because)X1911(it)X1992(is)X2083(very)X2281(dif\256cult)X2612(to)X2713(use)X2867(for)X3005(conducting)X3459(arithmetic.)X3901(None-the-)X576 1503(less,)N770(it)X850(is)X940(occasionally)X1448(encountered.)X1969(In)X2075(this)X2240(system,)X2557(each)X2760(of)X2866(the)X3010(decimal)X3342(digits)X3582(\(0-9\))X3800(is)X3890(assigned)X4248(a)X576 1615(4-bit)N782(binary)X1052(representation)X1622(as)X1726(shown)X2000(below.)X3 f864 1727(BCD)N1728(Decimal)X2089(Equivalent)X1 f864 1839(0000)N1728(0)X864 1951(0001)N1728(1)X864 2063(0010)N1728(2)X864 2175(0011)N1728(3)X864 2287(0100)N1728(4)X864 2399(0101)N1728(5)X864 2511(0110)N1728(6)X864 2623(0111)N1728(7)X864 2735(1000)N1728(8)X864 2847(1001)N1728(9)X864 2959(1010)N1728(INVALID)X864 3071(1011)N1728(INVALID)X864 3183(1100)N1728(INVALID)X864 3295(1101)N1728(INVALID)X864 3407(1110)N1728(INVALID)X864 3519(1111)N1728(INVALID)X576 3659(Note)N793(that)X968(the)X1116(values)X1392(1010)X1615(through)X1945(1111)X2168(are)X2317(unused)X2620(in)X2726(this)X2896(representation,)X3497(and)X3667(are)X3816(identi\256ed)X4211(as)X576 3771(INVALID)N1014(above.)X1307(Finally,)X1643(it)X1736(is)X1839(clearly)X2141(not)X2303(possible)X2657(to)X2771(represent)X3163(values)X3448(less)X3631(than)X3835(zero)X4039(in)X4152(this)X576 3883(scheme.)N3 f576 4107(2.2.2.2.)N912(Signed)X1213(\(Positive)X1590(and)X1768(Negative\))X2182(Numbers)X1 f776 4247(Remembering)N1348(still)X1519(that)X1690(we)X1828(only)X2026(have)X2235(1's)X2379(and)X2545(0's)X2689(to)X2791(represent)X3171(numbers,)X3553(we)X3692(now)X3884(review)X4173(the)X576 4359(various)N889(ways)X1116(that)X1291(negative)X1648(numbers,)X2033(as)X2143(well)X2339(as)X2449(positive,)X2808(can)X2972(be)X3093(represented.)X3591(For)X3754(the)X3901(most)X4117(part,)X576 4471(our)N732(discussion)X1160(will)X1338(focus)X1574(on)X1698(base)X1897(two,)X2093(but)X2244(wherever)X2631(possible,)X2999(results)X3279(will)X3458(be)X3578(stated,)X3856(and)X4024(formu-)X576 4583(lae)N713(given,)X975(for)X1111(conversions)X1594(in)X1693(a)X1760(generic)X2068(form)X2279(that)X2448(will)X2622(be)X2737(valid)X2954(for)X3090(any)X3253(base)X3448(of)X3552(arithmetic.)X3 f576 4807(2.2.2.3.)N912(Sign-and-Magnitude)X1783(\(S/M\))X2042(Representation)X1 f776 4947(The)N973(\256rst)X1169(way)X1377(we)X1537(examine)X1912(for)X2072(representing)X2596(negative)X2971(numbers)X3350(simply)X3660(takes)X3906(the)X4072(most-)X576 5059(signi\256cant)N1007(bit)X1139(of)X1249(our)X1407(n-bit)X1619(representation)X2195(and)X2364(interprets)X2758(it)X2842(as)X2952(a)X3025(sign.)X3239(Thus,)X3485(a)X3557(1)X3634(in)X3738(the)X3885(high-order)X576 5171(bit)N702(position)X1036(implies)X1344(a)X1411(negative)X1762(value,)X2019(and)X2182(a)X2249(0)X2321(implies)X2629(a)X2696(positive)X3025(value.)X3282(For)X3439(example:)X1056 5331(27)N2 f9 f1176(=)X1 f1253(00011011)X2 f9 f1056 5427(-)N1 f1109(27)X2 f9 f1229(=)X1 f1306(10011011)X1056 5523(97)N2 f9 f1176(=)X1 f1253(01100001)X2 f9 f1056 5619(-)N1 f1109(97)X2 f9 f1229(=)X1 f1306(11100001)X9 p%%Page: 9 612 s 0 xH 0 xS 1 f3 f576 400(57:017)N872(CIE)X1 f2353(-)X2409(9)X2481(-)X3 f3717(Lecture)X4062(Notes)X1 f576 803(However,)N988(now)X1189(the)X1343(range)X1593(of)X1709(representable)X2259(values)X2541(has)X2705(become)X2 f9 f3041(-)X1 f3094(127)X9 f(->)174 987 oc1 f3333(127.)X3538(There)X3800(are)X3955(also)X4147(two)X576 915(ways)N797(to)X896(represent)X1273(zero.)X1487(I.e.,)X2 f9 f1056 1075(+)N1 f1109(0)X2 f9 f1181(=)X1 f1258(00000000)X2 f9 f1056 1227(-)N1 f1109(0)X2 f9 f1181(=)X1 f1258(10000000.)X576 1415(The)N755(rules)X972(for)X1114(adding)X1406(and)X1575(subtracting)X2033(S/M)X2228(representation)X2804(are)X2952(broken)X3249(into)X3429(8)X3507(cases,)X3764(depending)X4195(on)X576 1527(the)N720(signs)X943(of)X1049(the)X1193(numbers)X1550(to)X1651(be)X1768(added)X2024(or)X2130(subtracted)X2552(\(positive)X2915(or)X3020(negative\))X3404(and)X3568(the)X3711(operation)X4100(to)X4200(be)X576 1639(performed)N1004(\(adding)X1325(or)X1432(subtracting\).)X1943(Consider)X2317(adding)X2606(or)X2713(subtracting)X3168(two)X3339(values,)X3636(A)X3732(and)X3898(B.)X4013(Denote)X576 1751(the)N719(magnitudes)X1188(of)X1293(A)X1387(and)X1550(B)X1638(\(i.e.,)X9 f1836(|)X1 f1855(A)X9 f1924(|)X1 f1967(and)X9 f2130(|)X1 f2149(B)X9 f2213(|)X1 f2232(\))X2288(as)X2392(`a')X2523(and)X2686(`b')X2822(respectively.)X3336(Then)X3558(the)X3700(following)X4098(eight)X576 1863(cases)N803(exist:)X3 f1008 1975(Case)N2016(Operand)X2408(A)X2592(Operation)X3168(Operand)X3560(B)X3744(ActionResult)X4301(Sign)X1 f1152 2087(1)N1584(POS)X2217(+)X2736(POSa)X2978(+)X3056(b+)X1152 2199(2)N1584(POS)X2217(+)X2736(NEG)X9 f2933(|)X1 f2952(a)X3019(-)X3075(b)X9 f(|)S1 f3142(*)X1152 2311(3)N1584(POS)X2217(-)X2736(POS)X9 f2911(|)X1 f2930(a)X2997(-)X3053(b)X9 f(|)S1 f3120(*)X1152 2423(4)N1584(POS)X2217(-)X2736(NEGa)X3000(+)X3078(b+)X1152 2535(5)N1584(NEG)X2217(+)X2736(POS)X9 f2911(|)X1 f2930(a)X2997(-)X3053(b)X9 f(|)S1 f3120(*)X1152 2647(6)N1584(NEG)X2217(+)X2736(NEGa)X3000(+)X3078(b-)X1152 2759(7)N1584(NEG)X2217(-)X2736(POSa)X2978(+)X3056(b-)X1152 2871(8)N1584(NEG)X2217(-)X2736(NEG)X9 f2933(|)X1 f2952(a)X3019(-)X3075(b)X9 f(|)S1 f3142(*)X1152 2983(*)N1224(Note,)X1459(in)X1558(cases)X1785(2,)X1881(3,)X1977(5,)X2073(and)X2236(8)X2308(the)X2450(result)X2688(sign)X2872(is)X2960(the)X3102(sign)X3286(of)X1152 3095(the)N1294(larger)X1543(of)X1647(the)X1789(two)X1957(magnitudes.)X576 3235(In)N689(cases)X925(1)X1006(and)X1178(4,)X1284(the)X1436(two)X1614(operand)X1958(magnitudes)X2436(are)X2588(added,)X2876(and)X3049(the)X3201(result)X3449(is)X3547(always)X3848(positive.)X4211(In)X576 3347(cases)N806(6)X881(and)X1047(7,)X1146(the)X1291(two)X1462(operand)X1799(magnitude)X2233(values)X2506(are)X2651(added,)X2932(and)X3098(the)X3242(result)X3482(will)X3658(be)X3775(negative,)X4152(and)X576 3459(in)N676(cases)X904(2,)X1001(3,)X1098(5,)X1195(and)X1359(8,)X1456(the)X1599(magnitudes)X2068(are)X2211(subtracted,)X2656(and)X2820(the)X2963(result)X3203(carries)X3486(the)X3630(sign)X3816(of)X3922(the)X4066(larger)X576 3571(of)N686(the)X834(two)X1008(magnitudes.)X1506(While)X1772(the)X1920(existence)X2308(of)X2417(these)X2644(three)X2866(cases)X3098(may)X3293(not)X3445(appear)X3731(problematic)X4221(at)X576 3683(this)N753(time,)X987(such)X1201(a)X1282(complex)X1652(multi-case)X2092(structure)X2467(has)X2634(adverse)X2967(impacts)X3306(on)X3441(hardware)X3838(design,)X4152(and)X576 3795(software)N931(which)X1190(must)X1401(deal)X1586(with)X1781(the)X1923(cases.)X3 f576 4019(2.2.2.4.)N912(Radix-Complement)X1741(Representation)X1 f776 4159(While)N1045(the)X1196(operation)X1593(of)X1706(negating)X2071(a)X2147(number)X2474(in)X2582(S/M)X2781(format)X3072(is)X3170(simple,)X3485(the)X3637(disadvantages)X4211(of)X576 4271(having)N866(two)X1038(ways)X1263(to)X1366(represent)X1747(zero,)X1964(and)X2130(the)X2275(complicated)X2774(set)X2908(of)X3015(cases)X3245(for)X3384(adding)X3673(and)X3839(subtracting,)X576 4383(send)N781(us)X895(in)X999(search)X1274(of)X1383(a)X1455(better)X1704(format.)X2038(The)X2217(\256rst)X2395(of)X2504(our)X2661(alternatives)X3135(is)X3228(called)X3 f3488(Radix)X3763(Complement)X1 f576 4495(since)N803(it)X886(is)X979(based)X1227(on)X1352(an)X1472(operation)X1865(that)X2039(is)X2132(a)X2203(function)X2552(of)X2660(the)X2806(base)X3005(\(or)X3145(radix\))X3403(of)X3511(the)X3657(arithmetic)X4077(being)X576 4607(used.)N811(In)X926(base)X1132(2,)X1239(this)X1413(method)X1737(is)X1836(known)X2133(by)X2265(a)X2344(possibly)X2700(more)X2934(familiar)X3276(name)X3521(\320)X3 f3653(Two's)X3939(Comple-)X576 4719(ment)N1 f784(.)X856(Formally,)X1257(we)X1393(de\256ne)X1652(the)X1794(radix)X2016(complement)X2517(of)X2621(an)X2 f2736(n)X1 f(-digit,)S3065(base)X2 f3260(b)X1 f3332(number,)X2 f3674(A)X1 f3757(as:)X2 f9 f1056 4879(-)N2 f1109(A)X9 f1200(=)X2 f1277(b)X9 s1337 4841(n)N12 s9 f1405 4879(-)N2 f1482(A.)X1 f4131(\(11\))X576 5067(Don't)N824(forget)X1078(this)X1241(de\256nition!)X776 5207(For)N940(example,)X1322(if)X1412(we)X1555(want)X1773(to)X1879(\256nd)X2059(the)X2208(8-bit,)X2445(2`s)X2594(complement)X3103(representation)X3681(of)X2 f9 f3793(-)X1 f3846(45,)X3998(we)X4142(\256rst)X576 5319(begin)N823(by)X952(\256nding)X1257(the)X1407(unsigned)X1786(binary)X2064(representation)X2642(of)X2754(45.)X2906(This)X3109(is)X3205(00101101.)X3645(Since)X2 f3891(b)X1 f2 f9 f3971(=)X1 f4048(2,)X4152(and)X2 f576 5431(n)N1 f2 f9 f656(=)X1 f733(8,)X829(then)X2 f1019(b)X9 s1079 5393(n)N1 f12 s2 f9 f1147 5431(=)N1 f1224(2)X9 s5393(8)Y12 s2 f9 f1340 5431(=)N1 f1417(100000000.)X1897(Thus)X2113(we)X2249(form)X2460(the)X2602(difference)X7 f1040 5591 0.4219(100000000)AN1040 5703 0.4219(-00101101)AN1040 5743 0.4219(_________)AN1098 5855(11010011)N1736(<-)X1910(2`s)X2142(comp.)X2490(repr.)X2838(of)X3012(-45)X10 p%%Page: 10 712 s 0 xH 0 xS 7 f3 f576 400(57:017)N872(CIE)X1 f2329(-)X2385(10)X2505(-)X3 f3717(Lecture)X4062(Notes)X1 f576 803(to)N677(\256nd)X852(the)X996(``2's)X1203(complement)X2 f1706(representation)X1 f2293(of)X2 f9 f2399(-)X1 f2452(45.'')X2686(Note,)X2923(this)X3088(is)X3178(not)X3327(the)X3471(same)X3695(as)X3801(saying)X4078(``\256nd)X576 915(the)N725(2's)X873(complement)X1381(of)X2 f9 f1492(-)X1 f1545(45.'')X1760(The)X1941(difference)X2363(between)X2715(these)X2944(two)X3119(statements)X3556(is)X3650(that)X3825(the)X3973(\256rst)X4152(one)X576 1027(expresses)N997(the)X1168(intention)X1565(to)X2 f1694(represent)X2111(a)X2213(value)X1 f2476(a)X2573(particular)X2997(way,)X3235(and)X3428(the)X3600(second)X3921(statement)X576 1139(expresses)N968(the)X1110(intention)X1477(to)X2 f1576(apply)X1814(an)X1934(operator)X1 f2270(.)X776 1279(Now,)N
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -