LOGIC DESIGN By Mustafa Saied INTRODUCTION digital has become part of our everyday vocabulary computers, automation, robots, medical science and technology, transportation, entertainment, space exploration, and on and on exciting educational journey NUMERICAL REPRESENTATIONS Quantities There are basically two ways of representing the numerical value of quantities: analog and digital. ANALOG REPRESENTATIONS represented by a voltage, current, or meter movement that is proportional to the value of that quantity Speedometer mercury thermometer audio microphone they can vary over a continuous range of values DIGITAL REPRESENTATIONS the quantities are represented not by proportional quantities but by symbols called digits digital watch time of day changes continuously, but the digital watch reading does not change continuously discrete steps analog = continuous digital = discrete (step by step) Because of the discrete nature of digital representations, there is no ambiguity when reading the value of a digital quantity, whereas the value of an analog quantity is often open to interpretation. DIGITAL AND ANALOG SYSTEMS digital system is a combination of devices designed to manipulate logical information or physical quantities that are represented in digital form digital computers Calculators digital audio and video equipment telephone system analog system contains devices that manipulate physical quantities that are represented in analog form. audio amplifiers magnetic tape recording and playback equipment light dimmer switch ADVANTAGES OF DIGITAL TECHNIQUES Digital systems are generally easier to design Information storage is easy Accuracy and precision are greater Operation can be programmed Digital circuits are less affected by noise More digital circuitry can be fabricated on IC chips There is really only one major drawback when using digital techniques: The real world is mainly analog We are in the habit of expressing these quantities digitally as when we say that the temperature is 64° (63.8° when we want to be more precise); but we are really making a digital approximation to an inherently analog quantity. Convert the real-world analog inputs to digital form. Process (operate on) the digital information. Convert the digital outputs back to real-world analog form. EXAMPLES sounds from instruments and human voices produce an analog voltage signal in a microphone this analog signal is converted to a digital format using an analog-to-digital conversion process the digital information is stored on the CD's surface during playback, the CD player takes the digital information from the CD surface and converts it into an analog signal which is then amplified and fed to a speaker where it can be picked up by the human ear Complexity Expense extra time electrical power NUMBER SYSTEMS AND CODES decimal Binary Octal hexadecimal systems DECIMAL SYSTEM composed of 10 numerals or symbols base-10 system using these symbols as digits positional-value system 453 digit 4 actually represents 4 hundreds, the 5 represents 5 tens, and the 3 represents 3 units most significant digit (MSD) least significant digit (LSD) 2745.214 , (2 * 10+3) + (7 * 10+2) + (4 * 101) + (5 * 100)+ (2 * 10-1) + (1 * 10-2) + (4 * 10-3) DECIMAL COUNTING N places or digits we can count through -------- different numbers, starting with and including zero. The largest number will always be ---------. BINARY SYSTEM It is very easy to design simple, accurate electronic circuits that operate with only two voltage levels almost every digital system uses the binary (base-2) number system as the basic number system of its operations only two symbols or possible digit values base-2 system positional-value system (1011.101)2, = (1 * 23) + (0 * 22) + (1 * 21) + (1 X 2°) + (1 * 2-1) + (0 * 2-2) + (1 * 2-3) = 8 + 0 + 2+1 + 0.5 + 0 + 0.125 = (11.625)10 The most significant bit (MSB) The least significant bit (LSB) BINARY COUNTING HEXADECIMAL NUMBER SYSTEM 16 possible digit symbols base 16 represents a group of four binary digits positional-value system BINARY-TO-DECIMAL CONVERSIONS procedure is to find the weights (i.e., powers of 2) for each bit position that contains a 1, and then to add them up 1 0 1 1 0 1 0 1 DECIMAL-TO-BINARY CONVERSIONS OCTAL-TO-DECIMAL CONVERSION DECIMAL-TO-OCTAL CONVERSION OCTAL-TO-BINARY CONVERSION performed by converting each octal digit to its three-bit binary equivalent Octal Digit Binary Equivalent 0 000 1 001 2 010 3 011 4 100 5 101 6 110 7 111 54318 BINARY-TO-OCTAL CONVERSION The bits of the binary number are grouped into groups of three bits starting at the LSB 1 0 0 1 1 1 0 1 0 0 1 1 0 1 0 1 1 0 HEX-TO-DECIMAL CONVERSION A hex number can be converted to its decimal equivalent by using the fact that each hex digit position has a weight that is a power of 16 35616 = 3 * l62 + 5 * 161 + 6 * 16° = 768 + 80 + 6 = 85410 2AF16 = 2 * 162 + 10 * 161 + 15 * 16° = 512 + 160 + 15 = 68710 DECIMAL-TO-HEX CONVERSION Recall that we did decimal-to-binary conversion using repeated division by 2, and decimal-to-octal using repeated division by 8. Likewise, decimalto-hex conversion can be done using repeated division by 16 HEX-TO-BINARY CONVERSION Each hex digit is converted to its four-bit binary equivalent 9F2l6 BA6l6 BINARY-TO-HEX CONVERSION The binary number is grouped into groups of four bits, and each group is converted to its equivalent hex digit 1010111112 SUMMARY OF CONVERSIONS Right now your head is probably spinning as you try to keep straight all of these different conversions from one number system to another. You probably realize that many of these conversions can be done automatically on your calculator just by pressing a key, but it is important for you to master these conversions so that you understand the process. Besides, what happens if your calculator battery dies at a crucial time and you have no handy replacement? The following summary should help you, but nothing beats practice, practice, practice! When converting from binary [or octal or hex] to decimal, use the method of taking the weighted sum of each digit position. When converting from decimal to binary [or octal or hex], use the method of repeatedly dividing by 2 [or 8 or 16] and collecting remainders. 3- When converting from binary to octal [or hex], group the bits in groups of three [or four], and convert each group into the correct octal [or hex] digit. 4. When converting from octal [or hex] to binary, convert each digit into its three-bit [or four-bit] equivalent. 5. When converting from octal to hex [or vice versa], first convert to binary; then convert the binary into the desired number system BCD numbers, letters, or words special group of symbols encoded code straight binary coding. Binary-Coded-Decimal Code each digit of a decimal number is represented by its binary equivalent four bits are required 8 7 4 (decimal) 1000 0111 0100 (BCD) 9 4 3 (decimal) 1001 0100 0011 (BCD) BCD each digit of the decimal number by a four-bit binary number 1010, 1011, 1100, 1101, 1110, and 1111 does not If it happen??? BCD is not another number system like binary, octal, decimal, and hexadecimal 137 10001001 8bits 0001 0011 0111 12 bits Inefficient relative ease of converting to and from decimal Decimal Binary Octal Hexadecimal BCD 0 0 0 0 0000 1 1 1 1 0001 2 10 2 2 0010 3 11 3 3 0011 4 100 4 4 0100 5 101 5 5 0101 6 110 6 6 0110 7 111 7 7 0111 8 1000 10 8 1000 9 1001 11 9 1001 10 1010 12 A 0001 0000 11 1011 13 B 0001 0001 12 1100 14 C 0001 0010 13 1101 15 D 0001 0011 14 1110 16 E 0001 0100 15 1111 17 F 0001 0101 LOGIC GATES OR Gate AND Gate NOT Gate NOR Gate NAND Gate OR GATE x = A + B , x = A + B + C is read as (x equals A OR B OR C) (Truth table) x is a logic 1 for every combination of input levels where one or more inputs are 1 OR operation produces 1 + 1 = 1, not 1 + 1 = 2 A B x=A+B 0 0 0 0 1 1 1 0 1 1 1 1 EXAMPLE AND GATE x=A.B x is a logic 1 only when both A and B are at the logic 1 level. For any case where one of the inputs is 0, the output is 0 A B x=A•B 0 0 0 0 1 0 1 0 0 1 1 1 we have x = A . B . C = ABC. This is read as "x equals A AND B AND C," (Truth Table) NOT GATE Single input variable x=A "x equals NOT A" or "x equals the inverse of A' or "x equals the complement of A“ A x=A NOT A 0 1 Inverter 1 0 ♦x=A Presence of small circle always denotes inversion NOR GATE A B A+B A+B 0 0 0 1 0 1 1 0 1 0 1 0 1 1 1 0 NAND GATE AB AB AB 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1 0 TIMING DIAGRAMS