![計(jì)算機(jī)組成結(jié)構(gòu) week02-3_第1頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-1/14/800fbd38-7715-4a01-a2bc-7ead611fb375/800fbd38-7715-4a01-a2bc-7ead611fb3751.gif)
![計(jì)算機(jī)組成結(jié)構(gòu) week02-3_第2頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-1/14/800fbd38-7715-4a01-a2bc-7ead611fb375/800fbd38-7715-4a01-a2bc-7ead611fb3752.gif)
![計(jì)算機(jī)組成結(jié)構(gòu) week02-3_第3頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-1/14/800fbd38-7715-4a01-a2bc-7ead611fb375/800fbd38-7715-4a01-a2bc-7ead611fb3753.gif)
![計(jì)算機(jī)組成結(jié)構(gòu) week02-3_第4頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-1/14/800fbd38-7715-4a01-a2bc-7ead611fb375/800fbd38-7715-4a01-a2bc-7ead611fb3754.gif)
![計(jì)算機(jī)組成結(jié)構(gòu) week02-3_第5頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-1/14/800fbd38-7715-4a01-a2bc-7ead611fb375/800fbd38-7715-4a01-a2bc-7ead611fb3755.gif)
版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、5/3/2022CDA31001Outline Announcement Review Unsigned and signed number representations Floating point number representation IEEE 754 standard Instruction set architecture concept5/3/2022CDA31002Announcement Program examples (C or MIPS) are available and will be available at /liux
2、/courses/cda3100/inclassexamples/ 1/12/2015 12:55:01 PMweek02-3.ppt3 The positive half from 0 to 2,147,483,647 The negative half from -2,147,483,648 to -132 Bit Signed Numbers in Twos Complement1/12/2015 12:55:26 PMweek02-3.ppt4General Numbering System Base X In base X, the value of Note the formula
3、 is also valid for a floating point number The value of 011ddddnn0110011110)0(dXdXdXdXXdXdXdXdXdnnnnnnniii21011.ddddddnn332211001111XdXdXdXdXdXdXdXdnnnnnniii1/12/2015 12:56:32 PMweek02-3.ppt5Unsigned Examples 101.11two= 22 + 20 + 2-1 + 2-2 = 5.75 3F.3hex = 316 + 15 160 + 316-1 = 63.18751/12/2015 12:
4、58:12 PMweek02-3.ppt6Decimal to Binary Floating Point Given a floating number in decimal, how to find its binary floating point representation? Lets take 0.1ten as example33221100111122222222ddddddddnnnnnniii1/12/2015 1:00:16 PMweek02-3.ppt7Example Convert 0.1ten to binary floating number00 0 0 1 1
5、0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 10 4 . 022 . 01 2 . 126 . 01 6 . 128 . 00 8 . 024 . 00 4 . 022 . 00 2 . 021 . 01/12/2015 1:02:04 PMweek02-3.ppt8How to Convert Decimal to Base X - Fraction We know how to do that for the integer part and here we only talk about the fraction part inputVal is the
6、fraction part of a number/liux/courses/cda3100/inclassexamples/decimal-baseX-float.c/liux/courses/cda3100/inclassexamples/baseX-decimal-float.c1/12/2015 1:02:49 PMweek02-3.ppt9Floating Point Numbers Scientific notation for decimal numbers A number is represent
7、ed by a significand (or mantissa) and an integer exponent Where F is the significand, and E the exponent Here S represents the sign Examples include ESF10) 1(421000001. 0101415926. 31/12/2015 1:03:48 PMweek02-3.ppt10Normalized Number Normalized number A scientific notation is normalized if there is
8、a single non-zero digit to the left of the floating point For example, are normalized are not normalized9ten9ten103.15576or 100 . 18ten8ten1031.5576or 1010. 01/12/2015 1:08:02 PMweek02-3.ppt11Floating Points in Binary Normalized binary scientific notation For a fixed number of bits, we need to decid
9、e How many bits for the significand (or fraction) How many bits for the exponent There is a trade-off between precision and range More bits for significand increases precision while more bits for exponent increases the rangeyyyytwoxxxxxxxxxx2. 11/12/2015 1:08:16 PMweek02-3.ppt12IEEE 754 Floating Poi
10、nt Standard Single precision Represented by 32 bits Since the leading 1 bit in the significand in normalized binary numbers is always 1, it is not represented explicitly5/3/2022CDA310013Exponent If we represent exponents using twos complement, then it would not be intuitive as small numbers appear t
11、o be larger3130292827262524232221201918171615141312111098765432100 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 03130292827262524232221201918171615141312111098765432100 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 05/3/2022CDA310014Biased Notation The most negative expo
12、nent will be represented as 0000 and the most positive as 11111 That is, we need to subtract the bias from the corresponding unassigned value The value of an IEEE 754 single precision is)127Exponent(2)Fraction. 01 () 1(S313029282726252423222120191817161514131211109876543210sexponentfraction1 bit8 bi
13、ts23 bits5/3/2022CDA310015Example 101.11two= 22 + 20 + 2-1 + 2-2 = 5.75 The normalized binary number will be 1.011122 = 1.01112(129-127) So the exponent is 129ten = 10000001As a hexadecimal number, the representation is 0 x40B80000 3130292827262524232221201918171615141312111098765432100 1 0 0 0 0 0
14、0 1 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 05/3/2022CDA310016Example So the exponent is 123ten = 01111011As a hexadecimal number, the representation is 0 x3DCCCCCC 3130292827262524232221201918171615141312111098765432100 0 1 1 1 1 0 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 012712321001. 1
15、00110 . 01 . 0twotwoten5/3/2022CDA3100170.1 Caused Serious Losses5/3/2022CDA310018IEEE 754 Double Precision It uses 64 bits (two 32-bit words) 1 bit for the sign 11 bits for the exponent 52 bits for the fraction 1023 as the bias313029282726252423222120191817161514131211109876543210sExponentfraction1
16、 bit11 bits20 bitsFraction (continued)32 bits5/3/2022CDA310019Example (Double Precision) 101.11two= 22 + 20 + 2-1 + 2-2 = 5.75 The normalized binary number will be 1.011122 = 1.01112(1025-1023) So the exponent is 1025ten = 10000000001twoAs a hexadecimal number, the representation is 0 x4017 0000 000
17、0 00003130292827262524232221201918171615141312111098765432100 1 0 0 0 0 0 0 0 0 0 1 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 03130292827262524232221201918171615141312111098765432100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 05/3/2022CDA310020Special CasesSingle precisionDouble precisi
18、onObject representedExponentFractionExponentFraction000000nonzero0nonzerodenormalized number1-254anything1-2046anythingfloating-point number255020470 infinity255nonzero2047nonzeroNaN (Not a number)In 2008, denormalized numbers are renamed to subnormal ones5/3/2022CDA310021Ranges for IEEE 754 Single
19、Precision Largest positive number Smallest positive number Floating-point number Denormalized number3130292827262524232221201918171615141312111098765432100 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 13130292827262524232221201918171615141312111098765432100 0 0 0 0 0 0 0 1 0 0 0 0 0 0
20、 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 03130292827262524232221201918171615141312111098765432100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 11/12/2015 11:17:14 PMweek02-3.ppt22Ranges for IEEE 754 Single Precision Largest positive number Smallest positive number Floating-point number - norm
21、alized Denormalized number Overflow and underflow Overflow if the exponent is too large to be represented Underflow if the exponent is too small to be represented38104128)127254(23103.4028235516925440170418348438528859813402823466222)211 (38126)1271(10175494351. 122)0 . 01 (23(0 126)14945(0.02)221.4
22、012985 10(0 126)( 1)(00.Fraction)2S5/3/2022CDA310023Ranges for IEEE 754 Double Precision Largest positive number Smallest positive number Floating-point number Denormalized number52(0 1022)1074324(0.02)224.94065646 103081022)10231(102250738585. 222)0 . 01 (3089711024)10232046(52106231577976931348. 1
23、222)211 (0 1022)( 1)(00.Fraction)2S5/3/2022CDA310024Range for Intels 80-bit Format Intels IA-32 internally uses a 80-bit floating point (extended precision representation) It includes a sign bit, a 16-bit exponent, and 63-bit significant (64-bit if the implied 1 is also included) The bias is 32767 W
24、hat is the largest positive number? What is the smallest positive number?5/3/2022CDA310025Bit Fields in C C (C+ also) allows bit fields to be defined within words All the fields must fit within a single word Fields must be integral types Starts from the right-most bit31302928272625242322212019181716
25、1514131211109876543210sexponentfraction1 bit8 bits23 bits5/3/2022CDA310026Endianness Byte ordering How a multiple byte data stored in memory Endianness (from Gullivers Travels) Big endian significant byte of a multi-byte word is stored at the memory address e.g. Sun Sparc, PowerPC Little endian sign
26、ificant byte of a multi-byte word is stored at the memory address e.g. Intel x865/3/2022CDA310027Endianness - continued Note that the bit fields depend on the endianness of the machine313029282726252423222120191817161514131211109876543210sexponentfraction1 bit8 bits23 bitsBit field direction on litt
27、le endian machinesBit field direction on big endian machines5/3/2022CDA310028Bit Fields in C The formula to compute the decimal floating point value using the bit fields is Note that the prototype for pow is defined in and the function is defined in the math library (using lm to link the math librar
28、y)5/3/2022CDA310029Meaning of Bit Patterns What a bit pattern represents depends what it is for Example, the following bit pattern A twos complement integer An unsigned integer A single precision floating-point number A MIPS instruction3130292827262524232221201918171615141312111098765432101 0 1 0 1
29、1 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 05/3/2022CDA310030Meaning of Bit Patterns What a bit pattern represents depends what it is for Example, the following bit pattern A twos complement integer An unsigned integer A single precision floating-point A MIPS instruction31302928272625242322
30、21201918171615141312111098765432101 0 1 0 1 1 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 05/3/2022CDA310031Stored Program Concept Programs consist of instructions and data Instructions are also represented as 0s and 1s Before a program runs, it will be loaded and stored in memory; it can be r
31、ead and written just like numbers A program is executed instruction by instruction These apply to all kinds of programs, operating systems, applications, games, and so on1/12/2015 10:56:39 PMweek02-3.ppt33GoogleEarth.exe1/12/2015 10:56:38 PMweek02-3.ppt34Linux Kernel1/12/2015 10:56:38 PMweek02-3.ppt
32、35Five Classic Components1/12/2015 10:56:37 PMweek02-3.ppt36Instruction Set Architectures An instruction set architecture specifies Instructions Registers Memory access Input/output An instruction set architecture provides an abstraction of the hardware implementation The hardware implementation dec
33、ides what and how instructions are implemented1/12/2015 10:56:37 PMweek02-3.ppt37Abstract View of MIPS Implementation1/12/2015 10:56:35 PMweek02-3.ppt38Instruction Execution Steps Instruction fetch step Fetch the instruction from memory and compute the address of the next sequential instruction Inst
34、ruction decode and register fetch step Decode the instruction and read registers Instruction execution Memory access / result Memory 1/12/2015 10:56:35 PMweek02-3.ppt39Instructions Note the operands for an arithmetic instruction must be from registers Reading from and storing to memory can be done using only specific instructions1/12/2015 10:56:34 PMweek02-3.ppt40Arithmetic Instruction Execution1/12/2015 10:56:34 PMweek02-3.ppt411/12/2015 10:56:24 PMweek02-3.ppt42Summary Now we know how to represent unsigned, signed, and floating points in computers Unsigned Signed using twos co
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年北京市國(guó)內(nèi)旅游合同范文
- 2025年包裝材料質(zhì)量檢測(cè)合同格式
- 2025年物流配送聯(lián)營(yíng)策劃協(xié)議示范文本
- 2025年典當(dāng)行業(yè)務(wù)許可合同范本
- 2025年農(nóng)村合作社土地承包合同
- 2025年二手汽車(chē)交易過(guò)戶手續(xù)協(xié)議
- 2025年企業(yè)知識(shí)產(chǎn)權(quán)抵押貸款合同
- 2025年勞動(dòng)合同解除與補(bǔ)償協(xié)議范本
- 2025年全球海運(yùn)代理業(yè)務(wù)合同范本
- 2025年公園綠化養(yǎng)護(hù)工程協(xié)議
- 2025年電力鐵塔市場(chǎng)分析現(xiàn)狀
- GB 12158-2024防止靜電事故通用要求
- 《教育強(qiáng)國(guó)建設(shè)規(guī)劃綱要(2024-2035年)》全文
- 山東省濱州市2024-2025學(xué)年高二上學(xué)期期末地理試題( 含答案)
- 體育老師籃球說(shuō)課
- 化學(xué)-江蘇省蘇州市2024-2025學(xué)年2025屆高三第一學(xué)期學(xué)業(yè)期末質(zhì)量陽(yáng)光指標(biāo)調(diào)研卷試題和答案
- 蛋雞生產(chǎn)飼養(yǎng)養(yǎng)殖培訓(xùn)課件
- 運(yùn)用PDCA降低住院患者跌倒-墜床發(fā)生率
- 海底撈員工手冊(cè)
- 2024CSCO小細(xì)胞肺癌診療指南解讀
- 立春氣象與生活影響模板
評(píng)論
0/150
提交評(píng)論