720 likes | 2.43k Views
Digital Logic Design. CHAPTER 1 BINARY SYSTEMS. Digital Computers & Digital Systems. the most striking property of a digital computer is its generality. It can follow a sequence of instructions, called a program, that operates on given data.
E N D
Digital Logic Design CHAPTER 1 BINARY SYSTEMS
Digital Computers & Digital Systems • the most striking property of a digital computer is its generality. • It can follow a sequence of instructions, called a program, that operates on given data. • The user can specify and change programs and/or data according to the specify need. • general-purpose digital computers can perform a wide variety of information-processing tasks. • The general purpose digital computer is the best known example of a digital system.
Digital Computers & Digital Systems • Early digital computers were used mostly for numerical computations. • In this case the discrete elements used are the digits. From this application, the term digital computer has emerged • A more appropriate name for a digital computer would be a “discrete information processing system”.
Figure 1-1 BLOCK DIAGRAM OF A DIGITAL COMPUTER Digital Computer Processor or arithmetic unit Control unit Storage or memory unit Input devices and control Output devices and control
Digital vs. Analog • An analog system has continuous range of values • A mercury thermometer • Human eye • A digital system has a set of discrete values • Digital Thermometer • Digital camera
Digital signal Analog signal Digital vs. Analog • Cheap electronic circuits • Easier to calibrate and adjust • Resistance to noise: Clearer picture and sound
Binary System • The binary numbers system have two possible values:0 and 1 • Discrete elements of information are represented with bits called binary codes. • Example: (09)10 = (1001)2 (15)10 = (1111)2
Weights: MSD LSD Decimal Number • Review the decimal number system • Base (Radix) is 10 - symbols (0,1, . . 9) Digits • Each position carries a weight: • If we were to write 1936.25 using a power series expansion and base 10 arithmetic:
Weights: MSD LSD Binary number system • The binary number system • Base is 2 - symbols (0,1) - Binary Digits (Bits) • Each position carries a weight: • If we write 10111.01 using a decimal power series we convert from binary to decimal:
Octal/Hex number systems • The octal number system: • Its base is 8 eight digits 0, 1, 2, 3, 4, 5, 6, 7 • For example: (236.4)8 = (158.5)10 • The hexadecimal number system. • Its base is 16 first 10 digits are borrowed from the decimal system and the letters A, B, C, D, E, F are used for the digits 10, 11, 12, 13, 14, 15 • E.g. (D63FA)16 = (877562)10
1 = 18 + 0.5 0 = 9 + 0 1 = 4 + 0.5 0 = 2 + 0 0 = 1 + 0 1 = 0 + 0.5 Conversion from Decimal to Binary • It is necessary to separate the number into an integer part and a fraction: • Repeatedly divide the decimal number by 2 • e.g. Find the binary equivalent of 37.
Conversion from Decimal to Binary • Conversion from decimal fraction to binary: • Same method used for integers except multiplication is used instead of division. • e.g. convert (0.8542)10 to binary (6 digits): 0.8542 x 2 = 1 + 0.7084 a-1 = 1 0.7084 x 2 = 1 + 0.4168 a-2 = 1 0.4168 x 2 = 0 + 0.8336 a-3 = 0 0.8336 x 2 = 1 + 0.6672 a-4 = 1 0.6675 x 2 = 1 + 0.3344 a-5 = 1 0.3344 x 2 = 0 + 0.6688 a-6 = 0 (0.8542)10 = (0.110110)2
1 = 19 + 125 3 = 2 + 375 2 = 0 + 25 Conversion from Decimal to Octal • The conversion from decimal integers to any base –r system: • Similar to the binary, except that division is done by r instead of 2 • Convert decimal 153 to octal:
Conversion from Decimal to Octal • Conversion from decimal fraction to octal: • Same method used for integers except multiplication is used instead of division. • e.g. convert (0.3152)10 to octal (4 digits): 0.3152 x 8 = 2 + 0.5216 a-1 = 2 0.5216 x 8 = 4 + 0.1728 a-2 = 4 0.1728 x 8 = 1 + 0.3824 a-3 = 1 0.3824 x 8 = 3 + 0.0592 a-4 = 3 (0.3152)10 = (0.2413)8 • The conversion of decimal numbers with both integer and fraction parts is done separately and then combing the two answers together .
Octal 00 01 02 03 04 05 06 07 10 11 12 13 14 15 16 17 Numbers with different bases
Conversion using Table • Conversion from and to binary, octal, and hexadecimal plays and important part in digital computers. • Since 23 = 8 and 24 = 16 • Each octal digit corresponds to 3 binary digits • (010 111 100 . 001 011 000)2 = (274.130)8 • Each hexa digit corresponds to 4 binary digits • (0110 1111 1101 . 0001 0011 0100)2 = (6FD.134)16
Complements • Used in digital computers for subtraction operation and for logic manipulation. • There are two types of complements for each base-r system: • The r’s complement & (r-1)’s complement • 2’s and 1’s complement for binary numbers • 10’s and 9’s complement for decimal numbers
The r’s Complement • The r’s complement of N=rn –N (N is a decimal #). • The 10’s complement of (52520)10 is • 105 - 52520=47480 • The 10’s complement of (0.3267)10 is • 1- 0.3267=0.6733 • No integer part , so 10n=100=1 • The 10’s complement of (25.639)10 is • 102 - 25.639=74.361. • The 2’s complement of (101100)2 is • (26)10 – (101100)2=(1000000 - 101100)2=010100. • The 2’s complement of (0.0110)2 is • (1 – 0.0110)2 =0.1010
The r’s Complement • The 10’s complement of a decimal number can be formed by leaving all least significant zeros unchanged, subtracting the first nonzero least significant digits from 10, and then subtracting all other higher significant digits from 9. • The 2’s complement can be formed by leaving all least significant zeros and the first nonzero digit unchanged, and then replacing 1’s by 0’s and 0’s by 1’s in all other higher significant digits.
The (r - 1)’s complement • The (r-1)’s complement of N= rn - r-m- N . • The 9’s complement of (52520)10 is (105 -1- 52520)= 99999 – 52520 = 47479 No fraction part , so 10-m=100=1 • The 9’s complement of (0.3267)10 is (1- 10-4 - 0.3267)= 0.9999 – 0.3267 = 0.6732 No integer part , so 10n=100=1 • The 9’s complement of (25.639)10 is (102 – 10-3 - 25.639)= 99.999 – 25.639 = 74.360 • The 1’s complement of (101100)2 is (26 -1)– (101100)2=(111111 - 101100)2=010011 • The 1’s complement of (0.0110)2 is (1 – 2-4) - (0.0110)2 = (0.1111 – 0.0110) = 0.1001
The (r - 1)’s complement • The 9’s complement of a decimal number is formed simply by subtracting every digit from 9. • The 1’s complement of a binary number is even simpler to form : the 1’s are changed to 0’s and the 0,s to 1’s. • The r’s complement can be obtained from the (r-1)’s complement after the addition 1 to the least significant digit.
Subtraction with r’s Complements • The subtraction of two positive numbers (M-N)r, may be done as follows: • Add the minuend M to the r’s complement of the subtrahend N. • Inspect the result obtained for an end carry: • If an end carry occurs, discard it. • If an end carry does not occur, take the r’s complement of the number obtained in step 1 and place a negative sign in front.
Decimal Subtraction • Subtract 7188 – 3049 using 10’s complement: M = 7188 10’s complement of N = + 6951 Sum = 14139 Discard end carry Answer = 4139 • Subtract 150 – 2100 using 10’s complement: M = 0150 10’s complement of N = + 7900 Sum = 8050 There’s no end carry negativeAnswer = (10’s complement of 8050) = – 1950
Binary Subtraction • Subtract 1010100 – 1000100 using 2’s comp.: M = 1010100 2’s complement of N = + 0111100 Sum = 10010000 Discard end carry Answer = 10000 • Subtract 1000100 – 1010100 using 2’s comp.: M = 1000100 2’s complement of N = + 0101100 Sum = 1110000 There’s no end carry negativeAnswer = (2’s complement of 1110000) = – 10000
Subtraction with (r-1)’s Complement • The subtraction with the (r-1)’s compl. is exactly the same as the one used with the r’s complement. • Add the minuend M to the (r-1)’s complement of the subtrahend N. • Inspect the result obtained for an end carry. • If an end carry occurs, add 1 to the least significant digit (end-around carry). • If an end carry does not occur, take the (r-1)’s complement of the number obtained in step 1 and place a negative sign in front
Decimal Subtraction • Subtract 72532 – 03250 using 9’s compl.: M = 72532 9’s complement of N = + 96749 Sum = 169281 end-around carry + 1 Answer = 69282 • Subtract 03250 – 72532 using 9’s compl.: M = 03250 9’s complement of N = + 27467 Sum = 130717 There’s no end carry negativeAnswer = - (9’s complement of 30717)= - 69282
Binary Subtraction • Subtract 1010100 – 1000100 using 1’s compl.: M = 1010100 1’s complement of N = + 0111011 Sum = 10001111 end-around carry + 1 Answer = 0010000 • Subtract 1000100 – 1010100 using 1’s compl.: M = 1000100 1’s complement of N = + 0101011 Sum = 11101111 There’s no end carry negativeAnswer = - (1’s complement of 1101111)= - 10000
9 (unsigned binary) 01001 +9 (signed binary) 25 (unsigned binary) 11001 – 9 (signed binary) Signed binary numbers • To represent a negative binary number, the convention is to make the sign bit 1. [sign bit 0 is for positive]
Binary Codes • Digital systems represent and manipulate not only binary numbers, but also many other discrete elements of information. • Any discrete element of information distinct among a group of quantities can be represented by a binary code. • Red is one distinct color of the spectrum. • The latter A is one distinct latter of the alphabet. • To represent a group of 2n distinct elements in a binary code requires a minimum of n bits. This is because it is possible to arrange n bit in 2n distinct way.
Binary Codes • For example: • A group of four distinct quantities can be represented by a two-bit code, with each quantity assigned one of the following bit combinations: 00, 01, 10, 11. • A group of eight elements requires a three-bit code, with each element assigned to one of the following bit combinations: 000, 001, 010, 011, 100, 101, 110,111. • The examples show that the distinct bit combinations of an n-bit code can be found by counting in binary from 0 to (2n-1). • Some bit combinations are unassigned when the number of elements is not a multiple of the power of 2. e.g. the ten decimal digits 0,1,2,…..,9
Binary Codes • A binary code that distinguishes among ten elements must contain at least four bits: • Three bits can distinguish a maximum of eight elements. • four bits can form 16 distinct combinations, but since only ten digits are coded , the remaining six combinations are unassigned and not used
Decimal Codes • Decimal numbers are represented in a digital system using a string of bits. • This can be done in various ways. • A set of n-bit strings where different strings represent different numbers or other things is called a code. • A particular combination of n-bit values is called a code word. • A common and convenient code for decimal numbers is Binary-coded decimal (BCD).
Decimal Codes • BCD is a binary representation of decimal numbers in a form that can easily be interpreted by a person. • The weights in the BCD code are 8, 4, 2, 1. • The bit assignment 0110, for example, can be interpreted by the weights to represent the decimal digit 6 because 0x8+1x4+1x2+0x1=6 • A decimal code that has been used in some old computers is the excess-3 code. • Its code assignment is obtained from the corresponding value of BCD after the addition 3
Decimal Codes • Numbers are represented in digital computers either in binary or in decimal through a binary code. • When specifying data, the user likes to give data in decimal form. • The input decimal numbers are stored internally in the computer by means of a decimal code. • Each decimal digit requires at least four binary storage elements. • The decimal numbers are converted to binary when arithmetic operations are done internally with numbers represented in binary.
Decimal Codes • It is also possible to perform the arithmetic operations directly in decimal codes. • The decimal number 395, when converted to binary, is equal to 110001011 and consists of nine binary digits. • The same number, when represented internally in the BCD code, occupies four bits for each decimal digit, for a total of 12 bits: 001110010101.
Decimal Codes • It is very important to understand the difference between conversion of a decimal number to binary and the binary coding of a decimal number. • The bits obtained from conversion are binary digits. • Bits obtained from coding are combinations of 1’s and 0’s arranged according to the rules of of the code used. • The binary conversion of decimal 13 is 1101 ; • The coding of decimal 13 with BCD is 00010011.
Decimal Codes • The exess-3, the 2, 4, 2, 1 and the 8, 4, -2, -1 are self complementary codes. • That is, the 9’s complement of the of the decimal number is obtained by changing 1’s to 0’s and 0’s to 1’s. • For example, 395 is represented in 2, 4, 2, 1 code by 001111111011. its 9’s complement 604 is represented by 110000000100.
The Reflected Code • Used to represent the digital data converted from the analog data. • The advantage of the reflected code over pure binary numbers is that a number in the reflected code changes by only one bit as it proceeds from one number to the next. • The reflected code is also known as the Gray Code.
Alphanumeric Codes • Many application of digital computers require the handling of data that consist not only of numbers, but also of letters. • That is, it is necessary to have a binary code for the alphabet. • an alphanumeric code is a binary code of a group of elements consisting of the ten decimal digits, the 26 letters of the alphabet, and a certain number of special symbols such as $.
Alphanumeric Codes • The total number of the elements in an alphanumeric group is greater than 36. • It must be coded with a minimum of six bits. • 26 = 64, but 25 = 32 is insufficient. • The internal code is a six-bit Alphanumeric Codes. • ASCII most common code for representing alphanumeric characters. • 7-bit code. Typically stored in a byte 8 bit can be used for parity.
Error-Detecting Code • An Error-Detecting Code can be used to detect errors during transmission. • Parity bit: an extra bit included with a message to make the total number of 1’s either even or odd. • For example, with even parity with odd parity ASCII A = 1000001 01000001 11000001 ASCII T = 1010100 11010100 01010100
Binary Storage and Registers • A binary cell is a device that possesses two stable states and is capable of storing one bit of information. • A register is a group of binary cells. • Since a cell stores one bit of information, it follows that a register with n cells can store any discrete quantity of information that contains n bits. • Register Transfer • A transfer of the information stored in one register to another.
Binary Logic • Boolean algebra • Consists of binary variables and logical operations • Binary variables • The variable are designated by letters of the alphabet such as A,B,C,x,y,z, etc. • Two discrete values (true/false; yes/no; 1/0) • Logical operations • Three basic operations: AND, OR, NOT
Definition of Binary Logic • AND: this operation is represented by a dot or by the absence of an operator. • x . y =z or xy=z is read “x and y is equal to z.” • The logical operation AND is interpreted to mean that z=1 if and only if x=1 and y=1; otherwise z=0. • OR: this operation is represented by a plus sign. • x+y=z is read “x OR y is equal to z” • Meaning that z=1 if x=1 or if y=1 0r if both x=1 and y=1 . If both x=0 and y=0, then z=0
Definition of Binary Logic • NOT: this operation is represented by a prime (sometimes by a bar). • For example, x’=z (or x=z) is read “x not is equal to z,” • Meaning that z is what x is not . In other words, if x=1, then z=0; but if x=0, then z=1 • A truth table is a table of all possible combinations of the variables showing the relation between the values that the variables may take and the result of the operation
Symbols for digital logic circuits Gates with multiple inputs Logic Gates • Logic circuits that perform the logical operations of AND, OR , and NOT
Integrated Circuits • An integrated circuit (IC) is a small silicon semiconductor crystal, called a chip. • It is contain an electrical components such as transistor, diodes, resistors, and capacitors. • The various components are interconnected inside the chip to form an electronic circuit. • The chip is mounted on a metal or plastic package, and connections are welded to external pins to form the IC.