Data Representation (1) PDF
Document Details
Uploaded by EndearingAgate9119
Asia Pacific Institute of Information Technology (APIIT)
Tags
Summary
This presentation covers data representation in computing, differentiating between analog and digital signals, and exploring number representation in various bases (binary, decimal, octal, hexadecimal). It includes discussions about the reasons for using binary representation, positional notation, and the range of possible numbers that can be represented with different bit widths.
Full Transcript
Operating Systems & Computer Architecture CT049-3-1-OS&CA Ver: VE Data Representation Topics we will cover Digital and Analog Signals Number Representation Number Bases Number Base Arithmetic...
Operating Systems & Computer Architecture CT049-3-1-OS&CA Ver: VE Data Representation Topics we will cover Digital and Analog Signals Number Representation Number Bases Number Base Arithmetic Number Base Conversion Module Code & Module Title Slide Title SLIDE 2 CT049-3-1-OS&CA Learning Outcomes At the end of this section, YOU should be able to: Compare and differentiate between analog and digital signals Explain how data is represented, stored, and manipulated inside a computer Perform Number Base Conversions Module Code & Module Title Slide Title SLIDE 3 CT049-3-1-OS&CA Key Terms Module Code & Module Title Slide Title SLIDE 4 CT049-3-1-OS&CA Digital vs. Analog Computing systems are finite machines. They store a limited amount of information, even if the limit is very big. – The goal is to represent enough of the real world data to satisfy our computational needs and our senses of sight and sound. – The information can be represented in one or two ways: analog or digital. Module Code & Module Title Slide Title SLIDE 5 CT049-3-1-OS&CA Digital vs. Analog Analog data is a continuous representation, analogous to the actual information it represents. – For example, a mercury thermometer is an analog device. The mercury rises in a continuous flow in the tube in direct proportion to the temperature. Module Code & Module Title Slide Title SLIDE 6 CT049-3-1-OS&CA Digital vs. Analog Digital data is a discrete representation, breaking the information up into separate (discrete) elements. – Computers cannot work with analog information directly, so there is a need to digitise the analog information. – This is done by breaking the analog information into pieces and representing those pieces using binary digits. Module Code & Module Title Slide Title SLIDE 7 CT049-3-1-OS&CA Digital vs. Analog Why digital signal? – Both electronic signals (analog and digital) degrade as they move down a line. The voltage of the signal fluctuates due to environmental effects. – As soon as an analog signal degrades, information is lost. Since any voltage level within the range is valid, it is impossible to know that the original signal was even changed. – Digital signals jump sharply between two extremes (high and low state). A digital signal can degrade quite a bit until the information is lost, because any value over a certain threshold is considered high value and below the threshold is considered low value. Module Code & Module Title Slide Title SLIDE 8 CT049-3-1-OS&CA Digital vs. Analog You can still retrieve the information from a reasonably degraded digital signal. Periodically a digital signal is reclocked to regain its original shape. As long as it is reclocked before too much degradation, no information is lost. 1 1 1 1 1 1 1 1 Threshold 0 0 0 0 0 0 0 0 Digital Signal Digital Signal Degradation Analog Signal Analog Signal Degradation Module Code & Module Title Slide Title SLIDE 9 CT049-3-1-OS&CA Why Binary? Early computer design was decimal – Mark I and ENIAC John von Neumann proposed binary data processing (1945) – Simplified computer design – Used for both instructions and data Natural relationship between on/off switches and On Off True False calculation using Boolean logic Yes No 1 0 Module Code & Module Title Slide Title SLIDE 10 CT049-3-1-OS&CA Counting and Arithmetic Decimal or base 10 number system – Origin: counting on the fingers – “Digit” from the Latin word digitus meaning “finger” Base: the number of different digits including zero in the number system – Example: Base 10 has 10 digits, 0 through 9 Binary or base 2 Bit (binary digit): 2 digits, 0 and 1 Octal or base 8: 8 digits, 0 through 7 Hexadecimal or base 16: 16 digits, 0 through F – Examples: 1010 = A16; 1110 = B16 Module Code & Module Title Slide Title SLIDE 11 CT049-3-1-OS&CA Keeping Track of the Bits Bits commonly stored and manipulated in groups – 8 bits = 1 byte – 4 bytes = 1 word (in many systems) Number of bits used in calculations – Affects accuracy of results – Limits size of numbers manipulated by the computer E.g. Computer game graphics cards Module Code & Module Title Slide Title SLIDE 12 CT049-3-1-OS&CA Game Console E.g. From 8bits to 64bits and beyond Module Code & Module Title Slide Title SLIDE 13 CT049-3-1-OS&CA Numbers: Physical Representation Different numerals, same number of oranges – Cave dweller: IIIII – Roman: V – Arabic: 5 Different bases, same number of oranges – 510 – 1012 – 123 Module Code & Module Title Slide Title SLIDE 14 CT049-3-1-OS&CA Number System Roman: position independent Modern: based on positional notation (place value) – Decimal system: system of positional notation based on powers of 10. – Binary system: system of positional notation based powers of 2 – Octal system: system of positional notation based on powers of 8 – Hexadecimal system: system of positional notation based powers of 16 Module Code & Module Title Slide Title SLIDE 15 CT049-3-1-OS&CA Positional Notation: Base 10 527 = 5 x 102 + 2 x 101 + 7 x 100 100’s place 10’s place 1’s place Place 102 101 100 Value 100 10 1 Evaluate 5 x 100 2 x 10 7 x1 Sum 500 20 7 Module Code & Module Title Slide Title SLIDE 16 CT049-3-1-OS&CA Positional Notation: Octal 6248 = 40410 64’s place 8’s place 1’s place Place 82 81 80 Value 64 8 1 Evaluate 6 x 64 2x8 4x1 Sum for 384 16 4 Base 10 Module Code & Module Title Slide Title SLIDE 17 CT049-3-1-OS&CA Positional Notation: Hexadecimal 6,70416 = 26,37210 4,096’s place 256’s place 16’s place 1’s place Place 163 162 161 160 Value 4,096 256 16 1 Evaluate 6x 7 x 256 0 x 16 4x1 4,096 Sum for 24,576 1,792 0 4 Base 10 Module Code & Module Title Slide Title SLIDE 18 CT049-3-1-OS&CA Positional Notation: Binary 1101 01102 = 21410 Place 27 26 25 24 23 22 21 20 Value 128 64 32 16 8 4 2 1 Evaluate 1 x 128 1 x 64 0 x 32 1 x16 0x8 1x4 1x2 0x1 Sum for 128 64 0 16 0 4 2 0 Base 10 Module Code & Module Title Slide Title SLIDE 19 CT049-3-1-OS&CA Range of Possible Numbers R = BK where – R = range – B = base – K = number of digits Example #1: Base 10, 2 digits – R = 102 = 100 different numbers (0…99) Example #2: Base 2, 16 digits – R = 216 = 65,536 or 64K – 16-bit PC can store 65,536 different number values Module Code & Module Title Slide Title SLIDE 20 CT049-3-1-OS&CA Decimal Range for Bit Widths Bits Digits Range 1 0+ 2 (0 and 1) 4 1+ 16 (0 to 15) 8 2+ 256 10 3 1,024 (1K) 16 4+ 65,536 (64K) 20 6 1,048,576 (1M) 32 9+ 4,294,967,296 (4G) 64 19+ Approx. 1.6 x 1019 128 38+ Approx. 2.6 x 1038 Module Code & Module Title Slide Title SLIDE 21 CT049-3-1-OS&CA Base or Radix Base: – The number of different symbols required to represent any given number The larger the base, the more numerals are required – Base 10: 0,1, 2,3,4,5,6,7,8,9 – Base 2: 0,1 – Base 8: 0,1,2, 3,4,5,6,7 – Base 16: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F Module Code & Module Title Slide Title SLIDE 22 CT049-3-1-OS&CA Number of Symbols vs. Number of Digits For a given number, the larger the base – the more symbols required – but the fewer digits needed Example #1: – 6516 10110 1458 110 01012 Example #2: – 11C16 28410 4348 1 0001 11002 Module Code & Module Title Slide Title SLIDE 23 CT049-3-1-OS&CA Counting in Base 2 Binary Equivalent Decimal Number 8’s (23) 4’s (22) 2’s (21) 1’s (20) Number 0 0 x 20 0 1 1 x 20 1 10 1 x 21 0 x 20 2 11 1 x 21 1 x 20 3 100 1 x 22 4 101 1 x 22 1 x 20 5 110 1 x 22 1 x 21 6 111 1 x 22 1 x 21 1 x 20 7 1000 1 x 23 8 1001 1 x 23 1 x 20 9 1010 1 x 23 1 x 21 10 Module Code & Module Title Slide Title SLIDE 24 CT049-3-1-OS&CA Base 10 Addition Table 310 + 610 = 910 + 0 1 2 3 4 5 6 7 8 9 0 0 1 2 3 4 5 6 7 8 9 1 1 2 3 4 5 6 7 8 9 10 2 2 3 4 5 6 7 8 9 10 11 3 3 4 5 6 7 8 9 10 11 12 4 4 5 6 7 8 9 10 11 12 13 etc Module Code & Module Title Slide Title SLIDE 25 CT049-3-1-OS&CA Base 8 Addition Table 38 + 68 = 118 + 0 1 2 3 4 5 6 7 0 0 1 2 3 4 5 6 7 1 1 2 3 4 5 6 7 10 (no 8 or 9, 2 2 3 4 5 6 7 10 11 of course) 3 3 4 5 6 7 10 11 12 4 4 5 6 7 10 11 12 13 5 5 6 7 10 11 12 13 14 6 6 7 10 11 12 13 14 15 7 7 10 11 12 13 14 15 16 Module Code & Module Title Slide Title SLIDE 26 CT049-3-1-OS&CA Base 10 Multiplication Table 310 x 610 = 1810 x 0 1 2 3 4 5 6 7 8 9 0 0 1 1 2 3 4 5 6 7 8 9 2 2 4 6 8 10 12 14 16 18 3 3 6 9 12 15 18 21 24 27 4 0 4 8 12 16 20 24 28 32 36 5 5 10 15 20 25 30 35 40 45 6 6 12 18 24 30 36 42 48 54 7 7 14 21 28 35 42 49 56 63 etc. Module Code & Module Title Slide Title SLIDE 27 CT049-3-1-OS&CA Base 8 Multiplication Table 38 x 68 = 228 x 0 1 2 3 4 5 6 7 0 0 1 1 2 3 4 5 6 7 2 2 4 6 10 12 14 16 3 0 3 6 11 14 17 22 25 4 4 10 14 20 24 30 34 5 5 12 17 24 31 36 43 6 6 14 22 30 36 44 52 7 7 16 25 34 43 52 61 Module Code & Module Title Slide Title SLIDE 28 CT049-3-1-OS&CA Addition Base Problem Largest Single Digit 6 Decimal +3 9 6 Octal +1 7 6 Hexadecimal +9 F 1 Binary +0 1 Module Code & Module Title Slide Title SLIDE 29 CT049-3-1-OS&CA Addition Base Problem Carry Answer 6 Decimal +4 Carry the 10 10 6 Octal +2 Carry the 8 10 6 Hexadecimal +A Carry the 16 10 1 Binary +1 Carry the 2 10 Module Code & Module Title Slide Title SLIDE 30 CT049-3-1-OS&CA Binary Arithmetic 1 1 1 1 1 1 1 0 1 1 0 1 + 1 0 1 1 0 1 0 0 0 0 0 1 1 Module Code & Module Title Slide Title SLIDE 31 CT049-3-1-OS&CA Binary Arithmetic Addition – Boolean using XOR and AND Multiplication + 0 1 – AND – Shift 0 0 1 Division 1 1 10 x 0 1 0 0 0 1 0 1 Module Code & Module Title Slide Title SLIDE 32 CT049-3-1-OS&CA Binary Arithmetic: Boolean Logic Boolean logic without performing arithmetic – EXCLUSIVE-OR Output is “1” only if either input, but not both inputs, is a “1” – AND (carry bit) Output is “1” if and only both inputs are a “1” 1 1 1 1 1 1 1 0 1 1 0 1 + 1 0 1 1 0 1 0 0 0 0 0 1 1 Module Code & Module Title Slide Title SLIDE 33 CT049-3-1-OS&CA Converting from Base 10 Powers Table Power 8 7 6 5 4 3 2 1 0 Base 2 256 128 64 32 16 8 4 2 1 8 32,768 4,096 512 64 8 1 16 65,536 4,096 256 16 1 Module Code & Module Title Slide Title SLIDE 34 CT049-3-1-OS&CA From Base 10 to Base 2 4210 = 1010102 Power Base 6 5 4 3 2 1 0 2 64 32 16 8 4 2 1 1 0 1 0 1 0 Integer 42/32 10/16 10/8 2/4 2/2 0/1 =1 =0 =1 =0 =1 =0 Remainder 10 10 2 2 0 0 Module Code & Module Title Slide Title SLIDE 35 CT049-3-1-OS&CA From Base 10 to Base 2 Base 10 42 Remainde r 2 ) 42 ( 0 Least significant bit Quotient 2 ) 21 ( 1 2 ) 10 ( 0 2) 5 (1 2) 2 (0 2) 1 Most significant bit Base 2 101010 Module Code & Module Title Slide Title SLIDE 36 CT049-3-1-OS&CA From Base 10 to Base 16 5,73510 = 166716 Power Base 4 3 2 1 0 16 65,536 4,096 256 16 1 1 6 6 7 Integer 5,735 /4,096 1,639 / 256 103 /16 7 =1 =6 =6 Remainder 5,735 - 4,096 1,639 –1,536 103 – 96 = 1,639 = 103 =7 Module Code & Module Title Slide Title SLIDE 37 CT049-3-1-OS&CA From Base 10 to Base 16 Base 10 8,039 Remainde r 16 ) 8,039 ( 7 Least significant bit Quotient 16 ) 502 ( 6 16 ) 31 ( 15 16 ) 1 ( 1 Most significant bit 16 ) 0 Base 16 1F67 Module Code & Module Title Slide Title SLIDE 38 CT049-3-1-OS&CA From Base 8 to Base 10 72638 = 3,76310 Power 83 82 81 80 512 64 8 1 x7 x2 x6 x3 Sum for Base 10 3,584 128 48 3 Module Code & Module Title Slide Title SLIDE 39 CT049-3-1-OS&CA From Base 8 to Base 10 72638 = 3,76310 7 x8 56 + 2 = 58 x8 464 + 6 = 470 x8 3760 + 3 = 3,763 Module Code & Module Title Slide Title SLIDE 40 CT049-3-1-OS&CA From Base 16 to Base 2 The nibble approach – Hex easier to read and write than binary Base 16 1 F 6 7 Base 2 0001 1111 0110 0111 – Why hexadecimal? Modern computer operating systems and networks present variety of troubleshooting data in hex format Module Code & Module Title Slide Title SLIDE 41 CT049-3-1-OS&CA Quick Review Questions 52710 represents 5×102 +2×101 +7×100. What is the representation for 5278?What would its equivalent base 10 value be? How many different digits would you expect to find in base 6? What is the largest digit in base 6? Let z represent that largest digit. What is the next value after 21z if you’re counting up by 1’s? What is the next value after 4zz if you’re counting up by 1’s? Module Code & Module Title Slide Title SLIDE 42 CT049-3-1-OS&CA Summary Counting in bases other than 10 is essentially similar to the familiar way of counting. Each digit place represents a count of a group of digits from the next less significant digit place. The group is of size B, where B is the base of the number system being used. The least significant digit, of course, represents single units. Addition, subtraction, multiplication, and division for any number base work similarly to base 10, although the arithmetic tables look different. There are several different methods that can be used to convert whole numbers from base B to base 10. The informal method is to recognize the base 10 values for each digit place and simply to add the weighted values for each digit together. A more formal method converts from base B to base 10 using successive multiplication by the present base and addition of the next digit. The final total represents the base 10 solution to the conversion. Similar methods exist for converting from base 10 to a different number base. Module Code & Module Title Slide Title SLIDE 43 CT049-3-1-OS&CA END Q&A Module Code & Module Title Slide Title SLIDE 44 CT049-3-1-OS&CA Next Logic Gates Module Code & Module Title Slide Title SLIDE 45 CT049-3-1-OS&CA