TM112 - Lecture 1 (1).pdf
Document Details
Uploaded by RaptExuberance6105
Arab Open University
Full Transcript
` TM112 Introduction to Computer and Information Technology 2 Lecture 1 Eng. Khaled +965 50515237 :للس تفسار عن لك ما يتعلق ابملادة تواصل مبارشة مع ا ألس تاذ خال Jabriya - Block 1B - St. 4 - Building 124 - 1st Flo...
` TM112 Introduction to Computer and Information Technology 2 Lecture 1 Eng. Khaled +965 50515237 :للس تفسار عن لك ما يتعلق ابملادة تواصل مبارشة مع ا ألس تاذ خال Jabriya - Block 1B - St. 4 - Building 124 - 1st Floor - لوكيشن المعهد Tel: 50515237 | 51086770 - أرقام التواصل Lecture 1 Binary data representation and computation Representing integers and text in binary Morse code is transmitted as representations of short and long flashes of light or short and long bleeps of sound. In any representation it is important that the symbols can be distinguished from each other. Changes in electrical voltages can cause random fluctuations, called noise, which may distort how the symbol is perceived. In a binary system there are only two symbols, so it is generally easier to make them different enough to be distinguishable The advantage of representing data in binary is that only two ranges of voltage need to be detected. ENIAC Electronic Numerical Integrator and Computer Tried to represent data using our usual base-10 system. 0 volts was used to represent the digit 0, 1 volt to represent the digit 1, and so on, all the way up to 9 volts to represent the digit 9. Converting numbers from binary to decimal notation (𝟏𝟎𝟎𝟏)𝟐 23+20 8+1 = (𝟗)𝟏𝟎 Converting numbers decimal to binary notation (𝟐𝟓)𝟏𝟎 = (𝟏𝟏𝟎𝟎𝟏)𝟐 2 Conversion Examples Convert the binary number 11000001 to decimal. Show the steps 1 1 0 0 0 0 0 1 𝟐𝟕 𝟐𝟔 𝟐 𝟓 𝟐𝟒 𝟐𝟑 𝟐𝟐 𝟐𝟏 20 𝟐𝟕 + 𝟐𝟔 + 2 0 = (𝟏𝟗𝟑)𝟏𝟎 Convert the decimal number 125 to binary. Show the steps Unsigned integers The unsigned integer is an integer that is greater than or equal to zero. An unsigned integer is sufficient for any purpose where a value does not become negative The number of unsigned decimal values that we can represent in binary depends on the number of bits we have available. In general, if we have n bits, we can represent 𝟐𝒏 unsigned integers, and the largest integer that can be represented is 𝟐𝒏 − 𝟏 If there are 3 bits available, we can represent 𝟐𝟑 = 8 values. If we want to include 0, this means that we can encode all of the unsigned integers from 0 to 7 in three bits. The largest decimal value that can be represented in 3 bits is 7. The smallest is 0 Adding unsigned integers in binary notation 3 Sign-magnitude representation The MSB (Most Significant Bit) of a binary number is kept as the “sign” of the number MSB = 1: negative number MSB = 0: positive number In an N bit word signed magnitude system 1 bit is used for the sign of the number (MSB). N-1 bits are used for the magnitude of the number. The largest integer is 𝟐𝑵−𝟏 − 𝟏 The smallest integer is −(𝟐𝑵−𝟏 − 𝟏) In an 8-bit word signed magnitude system give the decimal representation of the following numbers: 00000001, 10000001 00000001 ❖ The MSB is 0 so the number is positive ❖ The remaining 7 bits are: (𝟎𝟎𝟎𝟎𝟎𝟎𝟏)𝟐 = (𝟏)𝟏𝟎 ❖ The decimal number is + (𝟏)𝟏𝟎 10000001 ❖ The MSB is 1 so the number is negative ❖ The remaining 7 bits are: (𝟎𝟎𝟎𝟎𝟎𝟎𝟏)𝟐 = (𝟏)𝟏𝟎 ❖ The decimal number is - (𝟏)𝟏𝟎 ASCII American Standard Code for Information Interchange In the original ASCII system, upper-case and lower-case letters, numbers, punctuation and other symbols and control codes were encoded in 7 bits. As computers based on multiples of 8 bits became more common, the encoding system became an 8-bit system. UTF – 8 Unicode Transformation Format – 8 Uses a variable number of bytes (up to 6) to encode characters in use across the world. However, in order to maintain backward compatibility, the original 127 ASCII codes are preserved in UTF-8. 4 Floating-point numbers and scientific notation Represent the number 2343.56 in scientific notation = 𝟐. 𝟑𝟒𝟑𝟓𝟔 × 𝟏𝟎𝟑 Represent the number - 0.000654 in scientific notation = −𝟔. 𝟓𝟒 × 𝟏𝟎−𝟒 Representing logic operations and logic circuits Truth table ❖ A truth table for a logic operation lists all the possible combinations of input values, and for each possibility gives the output value for that operation NOT operation NOT truth table NOT Logic gate AND operation X Y X AND Y 0 0 0 X AND Y 0 1 0 1 0 0 1 1 1 AND truth table AND Logic gate OR operation X Y X OR Y 0 0 0 X OR Y 0 1 1 1 0 1 1 1 1 OR truth table OR Logic gate 5 Building logic circuits 1. Truth table for expression B > A if B is greater than A, the result is 1 (True), otherwise the result is 0 (False). A B B>A 0 0 0 0 1 1 1 0 0 1 1 0 2. Translate this into a logic expression Identify the row where the outcome (B > A) is 1. If input A → 1 → A If input B → 1 → B If input A → 0 → NOT A If input B → 0 → NOT B Join with AND A B B>A Logic expression 0 0 0 0 1 1 NOT A AND B 1 0 0 1 1 0 3. Draw the logic circuit Logic circuit outputs The output of gate 1 is: 𝒙 + 𝒚 ̅ The output of gate 2 is: 𝒚 + 𝒛 The output of gate 3 is: (𝑥 + 𝑦̅) (𝒚 + 𝒛) 6 Inside the logic gate Logic gate is made up of a combination of more fundamental components that act as on/off switches. In early computers, such devices were generally based on various designs of vacuum tube (collectively called valves). A ‘pluggable’ unit made of valves from an IBM computer of the mid-1950s In modern computers, they are based on transistors, which are formed of layers of semiconducting material such as silicon A chip containing six inverters 7 Lecture 1 Questions True or False: 1. In a binary system there are only two symbols, so it is generally easier to make them different enough to be distinguishable. True 2. In signed integer 00000011, the MSB is 0, and the number is negative. False 3. In signed integer 10000011, the MSB is 0, and the number is positive. False 4. The number 7343.22 can be represented in scientific notation as 73.4322 x 102. True 5. The smallest signed integer value that can be represented in 3 bits is -9. False 6. The smallest unsigned integer value that can be represented in 3 bits is 0. True 7. The number -0.000654 can be represented in scientific notation as -6.54 x 10 ^ - 3. False 8. An unsigned integer is sufficient for any purpose where the value does not become negative. True 9. The decimal number 29 is equal to the binary number 11101. True 10. In the truth table of the OR operation, the output is 1 only if any of the entries is one. True 11. In the truth table of the OR operation, the output is 0 only if both entries are ones. False 12. In an unsigned integer representation, the largest integer that can be represented for n bits is 2𝑛. False 13. In the truth table of the OR operation, the output is 1 if only one of the entries is one. False 14. The symbol represent the OR logic gate. False Questions Convert the decimal number 113 to binary. Show the steps = Find the decimal equivalent of the sign-magnitude number 11000001. Show the steps. The MSB is 1 so the number is negative The remaining 7 bits are: (𝟏𝟎𝟎𝟎𝟎𝟎𝟏)𝟐 = (𝟔𝟓)𝟏𝟎 The decimal number is - (𝟔𝟓)𝟏𝟎 Find the decimal equivalent of the sign-magnitude number 11000110. Show the steps. The MSB is 1 so the number is negative The remaining 7 bits are: (1000110)𝟐 = (𝟔𝟓)𝟏𝟎 The decimal number is - (𝟕𝟎)𝟏𝟎 8 Convert the binary number 110011 to decimal. Show the steps 1 1 0 0 1 1 𝟓 𝟐 𝟐𝟒 𝟐𝟑 𝟐𝟐 𝟐𝟏 20 2 5 +𝟐𝟒 + 2 1 + 2 0 = (𝟓𝟏)𝟏𝟎 Represent the number 2123.56 in scientific notation = 𝟐. 𝟏𝟐𝟑𝟓𝟔 × 𝟏𝟎𝟑 Represent the number 0.0187 in scientific notation = 𝟏. 𝟖𝟕 × 𝟏𝟎−𝟐 Using truth tables, decide whether the following two Boolean expressions are equivalent Expression One: NOT (X AND Y) Expression Two: NOT X AND NOT Y X Y X AND Y NOT (X AND Y) NOT X NOT Y NOT X AND NOT Y 0 0 0 1 1 1 1 0 1 0 1 1 0 0 1 0 0 1 0 1 0 1 1 1 0 0 0 0 ∴ 𝐓𝐡𝐞 𝐭𝐰𝐨 𝐛𝐨𝐨𝐥𝐞𝐚𝐧 𝐞𝐱𝐩𝐫𝐞𝐬𝐬𝐢𝐨𝐧𝐬 𝐚𝐫𝐞 𝐧𝐨𝐭 𝐞𝐪𝐮𝐢𝐯𝐚𝐥𝐞𝐧𝐭 Sketch the equivalent logic circuit for the following expression A AND NOT B Construct the truth tables NOT (A AND B) and NOT A OR NOT B and hence show that these two logic expressions are equivalent to each other A B A AND B NOT (A AND B) NOT A NOT B NOT A OR NOT B 0 0 0 1 1 1 1 0 1 0 1 1 0 1 1 0 0 1 0 1 1 1 1 1 0 0 0 0 ∴ 𝐓𝐡𝐞 𝐭𝐰𝐨 𝐛𝐨𝐨𝐥𝐞𝐚𝐧 𝐞𝐱𝐩𝐫𝐞𝐬𝐬𝐢𝐨𝐧𝐬 𝐚𝐫𝐞 𝐞𝐪𝐮𝐢𝐯𝐚𝐥𝐞𝐧𝐭 9 Construct the truth table and write a logic expression for B < A Sketch the equivalent logic circuit A B B