計(jì)算機(jī)導(dǎo)論-講稿.ppt

上傳人:za****8 文檔編號:15983365 上傳時(shí)間:2020-09-15 格式:PPT 頁數(shù):88 大?。?.72MB
收藏 版權(quán)申訴 舉報(bào) 下載
計(jì)算機(jī)導(dǎo)論-講稿.ppt_第1頁
第1頁 / 共88頁
計(jì)算機(jī)導(dǎo)論-講稿.ppt_第2頁
第2頁 / 共88頁
計(jì)算機(jī)導(dǎo)論-講稿.ppt_第3頁
第3頁 / 共88頁

下載文檔到電腦,查找使用更方便

14.9 積分

下載資源

還剩頁未讀,繼續(xù)閱讀

資源描述:

《計(jì)算機(jī)導(dǎo)論-講稿.ppt》由會(huì)員分享,可在線閱讀,更多相關(guān)《計(jì)算機(jī)導(dǎo)論-講稿.ppt(88頁珍藏版)》請?jiān)谘b配圖網(wǎng)上搜索。

1、Data Representation,Chapter 2,天津大學(xué)軟件學(xué)院,2.1 DATA TYPES(數(shù)據(jù)類型),Data today come in different forms such as numbers, text, images, audio, and video. People need to process all these data types.,The computer industry uses the term“multimedia” to define information that contains numbers, text, images, audi

2、o, and video.,number:數(shù)值 text:文本 image:圖像,audio:音頻 Video:視頻 Multimedia:多媒體,Analog and Digital (模擬和數(shù)字)Information,Computers are finite(有限的). Computer memory and other hardware(硬件) devices have only so much room to store and manipulate a certain amount of data. The goal of data representation(數(shù)據(jù)表示) is

3、to represent enough of the world to satisfy our computational needs and our senses of sight and sound.,Analog and Digital Information,Information can be represented in one of two ways: analog or digital. Analog data A continuous representation, analogous to the actual information it represents. Digi

4、tal data A discrete representation, breaking the information up into separate elements.,Analog and Digital Information,A mercury thermometer exemplifies analog data as it continually rises and falls in direct proportion to the temperature. Digital displays only show discrete(離散的) information.,2.2 DA

5、TA INSIDE THE COMPUTER,All data types from outside a computer are transformed into a uniform representation when stored in a computer and then transformed back when leaving the computer. This universal format is called a bit pattern(位組合格式).,BIT(位),A bit (binary digit) is the smallest unit of data th

6、at can be stored in a computer; it is either 0 or 1.,BIT PATTERN(位組合格式),A bit pattern is a sequence, or as it is sometimes called, a string of bits that can represent a symbol. e.g.,BYTE(字節(jié)),A bit pattern of length 8 is called a byte.,Examples of bit patterns,2.3 REPRESENTING DATA,TEXT(文本),A piece o

7、f text in any language is a sequence of symbols used to represent an idea in that language. You can represent each symbol with a bit pattern. In other words, text such as “BYTE”, which is made of four symbols, can be represented as 4 bit patterns, each pattern defining a single symbol.,How many bit

8、s are needed in a bit pattern to represent a symbol in a language?,The length of the bit pattern that represents a symbol in a language depends on the number of symbols used in that language. More symbols mean a longer bit pattern.,The relationship is not linear; it is logarithmic. If you need n sym

9、bols, the length is log2n bit.,Codes(編碼),Different sets of bit patterns have been designed to represent text symbols. Each set is called a code, and the process of representing symbols is called coding. ASCII The American National Standards Institute (ANSI) developed a code called American Standard

10、 Code for Information Interchange (ASCII)(美國信息交換標(biāo)準(zhǔn)代碼). This code uses 7 bits for each symbol. This means 128 different symbols can be defined by this code. e.g.,ASCII CODEAmerican Standard Code for Information Interchange,,The Unicode Character Set(統(tǒng)一的字符編碼標(biāo)準(zhǔn),采用雙字節(jié)對字符進(jìn)行編碼),Figure 3.6 A few characters

11、 in the Unicode character set,AUDIO(音頻),Audio is converted to digital data, then we can use bit patterns to store them. Audio is by nature analog data. It is continuous (analog), not discrete (digital).,WAV, AU, AIFF, VQF, and MP3...,sampling:采樣 quantization:量化 Coding:編碼,IMAGES(圖像),Images today are

12、represented in a computer by one of two methods: bitmap graphic or vector graphic. Bitmap Graphic(位圖) In this method, an image is divided into a matrix of pixels (picture elements), where each pixel is a small dot. The size of the pixel depends on what is called the resolution. After dividing an i

13、mage into pixels, each pixel is assigned a bit pattern. The size and the value of the pattern depend on the image.,pixel:像素 resolution:分辨率,To represent color images, each colored pixel is decom-posed into three primary colors: red, green, and blue (RGB). Then the intensity of each color is measured,

14、 and a bit pattern (usually 8 bits) is assigned to it. In other words, each pixel has three bit patterns: one to represent the intensity of the red color, one to represent the intensity of the green color, and one to represent the intensity of the blue color.,BMP, GIF, JPEG, PNG, TIFF, XBM, and PCX

15、,three primary colors:三基色,Digitized Images,Vector Graphic The vector graphic method does not store the bit patterns. An image is decomposed into a combination of curves and lines. Each curve or line is represented by a mathematical formula. For example, a line may be described by the coordinates o

16、f its endpoints, and a circle may be described by the coordinates of its center and the length of its radius. The combination of these formulas is stored in a computer. When the image is to be displayed or printed, the size of the image is given to the system as an input. The system redesigns the i

17、mage with the new size and uses the same formula to draw the image. In this case, each time an image is drawn, the formula is reevaluated.,WMF, PICT, EPS, SVG, SWF, and TrueType fonts,curve:曲線, mathematical formula:數(shù)學(xué)公式,Representing Video,To simulate motion, movies need to record (and play back) at

18、least 12 frames per second. However, good sound quality requires 24 frames/s. 24 frames/s = 1440 frames/minute= 46400 frames/hour,If each frame has a resolution of 1024 x 768*there are 786,432 pixels in a frame. If the colour of each pixel is stored as 24 bits (3 bytes) of data, one frame alone requ

19、ires 2,359,296 bytes (2 MB) of memory. An hour of film then, requires 203,843,174,400 bytes (194,400 MB more than 190 Gigabytes) of storage just for the images.,video:視頻 frame:禎,Data Compression(數(shù)據(jù)壓縮),It is important that we find ways to store and transmit data efficiently, which leads computer scie

20、ntists to find ways to compress it. Data compression is a reduction in the amount of space needed to store a piece of data. Compression ratio is the size of the compressed data divided by the size of the original data.,Data compression :數(shù)據(jù)壓縮 Compression ratio:壓縮比,Data Compression,A data compression

21、technique can be lossless, which means the data can be retrieved without any loss of the original information, lossy, which means some information may be lost in the process of compaction. As examples, consider these 3 techniques: keyword encoding(關(guān)鍵字編碼) run-length encoding(掃描寬度編碼) Huffman encoding(

22、霍夫曼編碼),Lossless:無損 Lossy:有損,Numbers, text, images, audio, and video are all forms of data. Computers need to process all types of data. All data types are transformed into a uniform representation called a bit pattern for processing by computers. A bit is the smallest unit of data that can be stored

23、 in a computer. A bit pattern is a sequence of bits that can represent a symbol. A byte is 8 bits.,SUMMARY,Coding is the process of transforming data into a bit pattern. ASCII is a popular code for symbols. Images use the bitmap graphic or vector graphic method for data representation. The image is

24、broken up into pixels which can then be assigned bit patterns. Audio data are transformed to bit patterns though sampling, quantization, and coding. Video data are a set of sequential images.,SUMMARY (continued),EXERCISES,2-1;2-2; 2-11;2-12;2-13;2-14;2-15 2-23;2-24;2-25;2-26;2-27 2-34;2-35;2-36;2-37

25、;2-38;2-39,Number Representation,Chapter 3,天津大學(xué)軟件學(xué)院,Number System, The Decimal system is based on 10,0-9; The binary system is based on 2,0-1; Octal notation is based on 8,0-7; Hexadecimal notation is based on 16 ,0-9,A-F。,Decimal system:十進(jìn)制 binary system:二進(jìn)制 Octal notation:八進(jìn)制 Hexadecimal notation:

26、十六進(jìn)制,3.1 DECIMAL AND BINARY,Two numbering systems are dominant today in the world of computers: decimal and binary.,DECIMAL SYSTEM,BINARY SYSTEM The binary system is based on 2. There are only two digits in the binary system, 0 and 1.,OCTAL NOTATION,Octal notation is based on 8. This means there ar

27、e 8 symbols: 0,1,2,3,4,5,6,7.,Bit Pattern------------ 000 001 010 011,Oct Digit------------ 0 1 2 3,Bit Pattern------------ 100 101 110 111,Oct Digit------------ 4 5 6 7,,Binary to octal and octal to binary transformation,HEXADECIMAL NOTATION,Hexadecimal notation is based on 16 (hexadec is Greek for

28、 16). This means there are 16 symbols (hexadecimal digits): 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E, and F. Each hexadecimal digit can represent 4 bits, 4 bits can be represented by a hexadecimal digit.,CONVERSION(轉(zhuǎn)換),Converting from a bit pattern to hexadecimal is done by organizing the pattern into groups

29、of four and finding the hexadecimal value for each group of 4 bits. For hexadecimal to bit pattern conversion, convert each hexadecimal digit to its 4-bit equivalent.,Hexadecimal notation is written in two formats. In the first format, you add a lowercase (or uppercase) x before the digits. For exa

30、mple, xA34; In another format, you indicate the base of the number (16) as the subscript after the notation. For example, (A34)16.;A34H,Show the hexadecimal equivalent of the bit pattern 1100 1110 0010.,Each group of 4 bits is translated to one hexadecimal digit. The equivalent is xCE2.,Show the hex

31、adecimal equivalent of the bit pattern 0011100010B.,Divide the bit pattern into 4-bit groups (from the right). In this case, add two extra 0s at the left to make the number of bits divisible by 4. So you have 000011100010, which is translated to 0E2H.,What is the bit pattern for x24C?,Write each hex

32、adecimal digit as its equivalent bit pattern to get 001001001100.,3.2 CONVERSION,BINARY TO DECIMAL CONVERSION Start with the binary number and multiply each binary digit by its weight. Since each binary bit can be only 0 or 1, the result will be either 0 or the value of the weight. After multiplyin

33、g all the digits, add the results.,Convert the binary number 10011 to decimal.,Write out the bits and their weights. Multiply the bit by its corresponding weight and record the result. At the end, add the results to get the decimal number. Binary 10011Weights 16 8 4 2 1 --------------

34、----------------------- 16 + 0 + 0 + 2 + 1 Decimal 19,DECIMAL TO BINARY CONVERSION To convert from decimal to binary, use repetitive division.,division:除法 quotient:商 remainder:余數(shù),Convert the decimal number 35 to binary.,Write out the number at the right corner. Divide the number conti

35、nuously by 2 and write the quotient and the remainder. The quotients move to the left, and the remainder is recorded under each quotient. Stop when the quotient is zero. 0 1 2 4 8 17 35 Dec. Binary 1 0 0 0 1 1,3.3 INTEGER REPRESENTATION(整數(shù)表示法 ),Integers are whole numbers (i.e., numbers witho

36、ut a fraction). An integer can be positive or negative. 0 + To use computer memory more efficiently, two broad categories of integer representation have been developed: unsigned integers and signed integers . Signed integers may also be represented in three distinct ways.,Integer:整數(shù) fraction:分?jǐn)?shù) un

37、signed integer:無符號整數(shù) signed integer:帶符號整數(shù),UNSIGNED INTEGERS FORMAT An unsigned integer is an integer without a sign. Most computers define a constant called the maximum unsigned integer. An unsigned integer ranges between 0 and this constant. The maximum unsigned integer depends on the number of bi

38、ts the computer allocates to store an unsigned integer.,Range: 0 ... (2N-1),N is the number of bits allocated to represent one unsigned integer.,Representation Storing unsigned integers is a straightforward process as outlined in the following step: 1. The number is changed to binary. 2. If the n

39、umber of bits is less than N, 0s are added to the left of the binary number so that there is a total of N bit.,Store 7 in an 8-bit memory location(存儲(chǔ)單元).,First change the number to binary 111. Add five 0s to make a total of N (8) bits, 00000111. The number is stored in the memory location.,Store 258

40、 in a 16-bit memory location.,First change the number to binary 100000010. Add seven 0s to make a total of N (16) bits, 0000000100000010. The number is stored in the memory location.,Overflow(溢出) If you try to store an unsigned integer such as 256 in an 8-bit memory location, you get a condition ca

41、lled overflow.,Interpretation How do you interpret an unsigned binary representation in decimal? The process is simple. Change the N bits from the binary system to the decimal system.,Interpret 00101011 in decimal if the number was stored as an unsigned integer.,Using the procedure shown in Figure

42、3.3 , the number in decimal is 43.,SIGNED INTEGERS FORMAT SIGN-AND-MAGNITUDE FORMAT(原碼),In sign-and-magnitude representation the leftmost bit defines the sign of the number. If it is 0, the number is positive. If it is 1, the number is negative,positive:正數(shù) negative:負(fù)數(shù),SIGN-AND-MAGNITUDE FORMAT,Range

43、: -(2N-1-1) +(2N-1-1),There are two 0s in sign-and-magnitude representation: positive and negative. In an 8-bit allocation: +0 00000000 -0 10000000,Representation Storing sign-and-magnitude integer is a straightforward process: 1. The number is changed to binary; the sign is ignored. 2. If th

44、e number of bits is less than N-1, 0s are added to the left of the number so that there is a total of N-1 bits. 3. If the number is positive, 0 is added to the left (to make it N bits). If the number is negative, 1 is added to the left (to make it N bits).,Store +7 in an 8-bit memory location using

45、 sign-and-magnitude representation.,First change the number to binary 111. Add four 0s to make a total of N-1 (7) bits, 0000111. Add an extra zero because the number is positive. The result is: 00000111,Store 258 in a 16-bit memory location using sign-and-magnitude representation.,First chang

46、e the number to binary 100000010. Add six 0s to make a total of N-1 (15) bits, 000000100000010. Add an extra 1 because the number is negative. The result is: 1000000100000010,Interpretation How do you interpret a sign-and-magnitude binary representation in decimal? The process is simple: 1.

47、 Ignore the first (leftmost) bit. 2. Change the N-1 bits from binary to decimal as shown at the beginning of the chapter. 3. Attach a + or a sign to the number based on the leftmost bit.,Interpret 10111011 in decimal if the number was stored as a sign-and-magnitude integer.,Ignoring the leftmost b

48、it, the remaining bits are 0111011. This number in decimal is 59. The leftmost bit is 1, so the number is 59.,ONES COMPLEMENT FORMAT(反碼) Ones complement of a number is obtained by changing all 0s to 1s and all 1s to 0s. The leftmost bit defines the sign of the number. If it is 0, the number is posit

49、ive. If it is 1, the number is negative. A positive number is presented by its SIGN-AND-MAGNITUDE FORMAT A negative number is presented by its ONES COMPLEMENT FORMAT,There are two 0s in ones complement representation: positive and negative. In an 8-bit allocation: +0 00000000 -0 11111111,Represe

50、ntation Storing ones complement integers requires the following steps: 1. The number is changed to binary; the sign is ignored. 2. 0s are added to the left of the number to make a total of N bits. 3. If the sign is positive, no more action is needed. If the sign is negative, every bit is complem

51、ented (changed from 0 to 1 or from 1 to 0).,Number of Bits ------------------- 8 16 32,-127 -0 -32767 -0 -2,147,483,647 -0,+0 +127 +0 +32767 +0 +2,147,483,647,Range -------------------------------------------------------------------,Range: -(2N-1-1) ... +(2N-1-1),Store +7 in a

52、n 8-bit memory location using ones complement representation.,First change the number to binary 111. Add five 0s to make a total of N (8) bits, 00000111. The sign is positive, so no more action is needed. The result is: 00000111,Store 258 in a 16-bit memory location using ones complement repr

53、esentation.,First change the number to binary 100000010. Add seven 0s to make a total of N (16) bits, 0000000100000010. The sign is negative, so each bit is complemented. The result is: 1111111011111101,Ones complement means reversing all bits. If you ones complement a positive number, you get

54、the corresponding negative number. If you ones complement a negative number, you get the corresponding positive number. If you ones complement a number twice, you get the original number.,Interpretation How do you interpret a ones complement binary repre-sentation in decimal? The process involves t

55、hese steps: 1. If the leftmost bit is 0 (positive number), a. Change the entire number from binary to decimal. b. Put a plus sign (+) in front of the number. 2. If the leftmost bit is 1 (negative number), a. Complement the entire number (changing all 0s to 1s, and vice versa). b. Change the entire

56、 number from binary to decimal. c. Put a negative sign (-) in front of the number.,Interpret 11110110 in decimal if the number was stored as a ones complement integer.,The leftmost bit is 1, so the number is negative. First complement it . The result is 00001001. The complement in decimal is 9. So t

57、he original number was 9.,TWOS COMPLEMENT FORMAT(補(bǔ)碼),-2N-1 ... +(2N-1-1),Range of twos complement integers,Twos complement is the most common, the most important, and the most widely used representation of integers today.,Representation Storing twos complement requires the following steps: 1. The

58、number is changed to binary; the sign is ignored. 2. If the number of bits is less than N, 0s are added to the left of number so that there is a total of N bits. 3. If the sign is positive, no further action is needed. If the sign is negative, leave all the rightmost 0s and the first 1 unchanged.

59、Complement the rest of the bits.,,,Store +7 in an 8-bit memory location using twos complement representation.,First change the number to binary 111. Add five 0s to make a total of N (8) bits, 00000111.The sign is positive, so no more action is needed. The result is: 00000111,Store 40 in a 16-

60、bit memory location using twos complement representation.,First change the number to binary 101000. Add ten 0s to make a total of N (16) bits, 0000000000101000. The sign is negative, so leave the rightmost 0s up to the first 1 (including the 1) unchanged and complement the rest. The result is:

61、1111111111011000,Example of storing twos complement integers in two different computers,Interpretation How do you interpret a twos complement binary represen-tation in decimal? The process involves these steps: 1. If the leftmost bit is 0 (positive number), a. Change the whole number from binary

62、 to decimal. b. Put a plus sign (+) in front of the number . 2. If the leftmost bit is 1 (negative number), a. Leave the rightmost bits up to the first 1 (inclusive) unchanged. Complement the rest of the bits. b. Change the whole number from binary to decimal. c. Put a negative sign (-)

63、in front of the number.,Interpret 11110110B in decimal if the number was stored as a twos complement integer.,The leftmost bit is 1. The number is negative. Leave 10 at the right alone and complement the rest. The result is 00001010B. The twos complement number is 10. So the original number was 10.,

64、Summary of integer representation,3.4 EXCESS SYSTEM,Another representation that allows you to store both positive and negative numbers in a computer is called the Excess system. In this system, it is easy to transform a number from decimal to binary, and vice versa. However, operations on the number

65、s are very complicated. The only application in use today is in storing the exponential value of a fraction. This is discussed in the next section. In an excess conversion, a positive number, called the magic number, is used in the conversion process. The magic number is normally (2N-1) or (2N-1-1)

66、, where N is the bit allocation. For example, if N is 8, the magic number is either 128 or 127. In the first case, we call the representation Excess_128, and in the second case, it is Excess_127.,exponential :指數(shù)的 magic number:幻數(shù),Representation To represent a number in Excess, use the following procedure: 1. Add the magic number to the integer. 2. Change the result to binary and add 0s so that there is a total of N bits.,Represent 25 in Excess_127 using an 8-bit allocation.,First add 127 to ge

展開閱讀全文
溫馨提示:
1: 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
2: 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
3.本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
5. 裝配圖網(wǎng)僅提供信息存儲(chǔ)空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

相關(guān)資源

更多
正為您匹配相似的精品文檔
關(guān)于我們 - 網(wǎng)站聲明 - 網(wǎng)站地圖 - 資源地圖 - 友情鏈接 - 網(wǎng)站客服 - 聯(lián)系我們

copyright@ 2023-2025  zhuangpeitu.com 裝配圖網(wǎng)版權(quán)所有   聯(lián)系電話:18123376007

備案號:ICP2024067431-1 川公網(wǎng)安備51140202000466號


本站為文檔C2C交易模式,即用戶上傳的文檔直接被用戶下載,本站只是中間服務(wù)平臺,本站所有文檔下載所得的收益歸上傳人(含作者)所有。裝配圖網(wǎng)僅提供信息存儲(chǔ)空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對上載內(nèi)容本身不做任何修改或編輯。若文檔所含內(nèi)容侵犯了您的版權(quán)或隱私,請立即通知裝配圖網(wǎng),我們立即給予刪除!