Download presentation
Presentation is loading. Please wait.
Published byGiles Roberts Modified over 8 years ago
1
1 DLD Lecture 18 Recap
2
2 Recap °Number System/Inter-conversion, Complements °Boolean Algebra °More Logic Functions: NAND, NOR, XOR °Minimization with Karnaugh Maps °More Karnaugh Maps and Don’t Cares °NAND and XOR Implementations °Circuit Analysis and Design Procedures °Binary Adders and Subtractors °Magnitude Comparators and Multiplexers °Encoders, Decoders and DeMultiplexers
3
3 Digital Signals °Decimal values are difficult to represent in electrical systems. It is easier to use two voltage values than ten. °Digital Signals have two basic states: 1 (logic “high”, or H, or “on”) 0 (logic “low”, or L, or “off”) °Digital values are in a binary format. Binary means 2 states. °A good example of binary is a light (only on or off) onoff Power switches have labels “1” for on and “0” for off.
4
4 Number Systems °Decimal is the number system that we use °Binary is a number system that computers use °Octal is a number system that represents groups of binary numbers (binary shorthand). It is used in digital displays, and in modern times in conjunction with file permissions under Unix systems. °Hexadecimal (Hex) is a number system that represents groups of binary numbers (binary shorthand). Hex is primarily used in computing as the most common form of expressing a human- readable string representation of a byte (group of 8 bits).
5
5 Number Systems SystemBaseSymbols Used by humans? Used in computers? Decimal100, 1, … 9YesNo Binary20, 1NoYes Octal80, 1, … 7No Hexa- decimal 160, 1, … 9, A, B, … F No
6
6 Conversion Among Bases The possibilities: Hexadecimal DecimalOctal Binary
7
7 Binary Base 2 = Base 10 000 = 0 001 = 1 010 = 2 011 = 3 100 = 4 101 = 5 110 = 6 111 = 7 In Binary, there are only 0’s and 1’s. These numbers are called “Base-2” ( Example: 010 2 ) Binary to Decimal We count in “Base-10” (0 to 9) °Binary number has base 2 °Each digit is one of two numbers: 0 and 1 °Each digit is called a bit °Eight binary bits make a byte °All 256 possible values of a byte can be represented using 2 digits in hexadecimal notation.
8
8 Binary as a Voltage °Voltages are used to represent logic values: °A voltage present (called Vcc or Vdd) = 1 °Zero Volts or ground (called gnd or Vss) = 0 A simple switch can provide a logic high or a logic low.
9
9 A Simple Switch °Here is a simple switch used to provide a logic value: Vcc Gnd, or 0 Vcc Vcc, or 1 There are other ways to connect a switch.
10
10 Binary digits Bit: single binary digit Byte: 8 binary digits 10010111 2 Bit Byte Radix
11
11 Converting to decimal from binary: °Evaluate the power series Example 1 0 1 1 1 1 2 543021 0*2 4 1*2 5 + 1*2 3 ++ 1*2 2 + 1*2 1 + 1*2 0 = 47 10 Number systems
12
12 Review of Number systems Memorize the first ten powers of two
13
13 Review of Number systems
14
14 Number systems Converting to binary from decimal: –Divide the decimal number by 2 repeatedly. –The remainder gives the digits of the binary number 7462 2 2 2 2 2 2 2 2 373 R 0 186 R 1 93 R 0 93 R 0 46 R 1 46 R 1 23 R 0 23 R 0 11 R 1 11 R 1 5 R 1 5 R 1 2 2 R 1 2 R 1 1 R 0 1 R 0 1011101010 2
15
15 Decimal 2 Binary
16
16 Octal Numbers: [Base 8],[ 0,1,3,4,5,6,7] Octal to Decimal Conversion: Example:- [2374] 8 = [ ? ] 10 =4×8 0 +7×8 1 +3×8 2 +2×8 3 =[1276] 10 Number systems () Number systems (Octal Numbers) °Octal number has base 8 °Each digit is a number from 0 to 7 °Each digit represents 3 binary bits °Was used in early computing, but was replaced by hexadecimal
17
17 Decimal to Octal Conversion: The Division: [359] 10 = [ ? ] 8 By using the division system: 7 4 5 74 5 Reminder Number systems () Number systems (Octal Numbers) Quotient
18
18 Binary to Octal Conversion: Example:- [110101] 2 = [ ? ] 8 Here we will take 3 bits and convert it from binary to decimal by using the decimal to binary truth table: BinaryDecimal 1106 1015 1 1 01 0 1= (65) 8 { 65 { Number systems () Number systems (Octal Numbers)
19
19 Octal to Binary Conversion: Example:- [13] 8 = [ ? ] 2 Here we will convert each decimal digit from decimal to binary (3 bits) using the decimal to binary truth table: Decimal Binary 1001 3011 (13) 8 = (001011) 2 Number systems () Number systems (Octal Numbers)
20
20 Radix Based Conversion (Example) °Convert 1234 decimal into octal Radix 8Answer 2322 8 Divide by radix 8 81234 81542 8192 23
21
21 Octals Converting to decimal from octal: –Evaluate the power series Example 2 0 7 8 0 21 0*8 1 2*8 2 + 7*8 0 + = 135 10
22
22 Hexadecimal °Hexadecimal is used to simplify dealing with large binary values: Base-16, or Hexadecimal, has 16 characters: 0-9, A-F Represent a 4-bit binary value: 0000 2 (0) to 1111 2 (F) Easier than using ones and zeros for large binary values Commonly used in computer applications °Examples: 1100 2 = 12 10 = C 16 1010 0110 1100 0010 2 = A6 C2 16 Hex values can be followed by an “H” to indicate base-16. Example: A6 C2 H
23
23 Hex Values in Computers
24
24 Decimal to Hexadecimal DecimalHex 00 11 22 33 44 55 66 77 88 99 10A 11B 12C 13D 14E 15F
25
25 Conversion Binary to Hexadecimal 1010110000010110 1010 = 101100 = 120001 = 10110 = 6 AC16
26
26 Radix Based Conversion (Example) °Convert 1234 decimal into hexadecimal Radix 16Answer 4D2 16 Divide by radix 16 161234 16772 4D
27
27 Hexadecimals – Base 16 Converting to decimal from hex: –Evaluate the power series Example 2 E A 16 0 21 14*16 1 2*16 2 + 10*16 0 + = 746 10
28
28 Octal to Hex Conversion To convert between the Octal and Hexadecimal numbering systems Convert from one system to binary first Then convert from binary to the new numbering system
29
29 Hex to Octal Conversion Ex : Convert E8A 16 to octal First convert the hex to binary: 1110 1000 1010 2 111010001010and re-group by 3 bits (starting on the right) Then convert the binary to octal: 7 2 1 2 So E8A 16 = 7212 8
30
30 Octal to Hex Conversion Ex : Convert 752 8 to hex First convert the octal to binary: 111 101 010 2 re-group by 4 bits 0001 1110 1010 (add leading zeros) Then convert the binary to hex: 1 E A So 752 8 = 1EA 16
31
31 Octal to Hexadecimal Hexadecimal DecimalOctal Binary
32
32 Octal to Hexadecimal °Technique Use binary as an intermediary
33
33 Example 1076 8 = ? 16 1 0 7 6 001 000 111 110 2 3 E 1076 8 = 23E 16
34
34 Hexadecimal to Octal Hexadecimal DecimalOctal Binary
35
35 Hexadecimal to Octal °Technique Use binary as an intermediary
36
36 Example 1F0C 16 = ? 8 1 F 0 C 0001 1111 0000 1100 1 7 4 1 4 1F0C 16 = 17414 8
37
37 Example: Hex → Octal Example: °Convert the hexadecimal number 5A H into its octal equivalent. 5A H = 132 8 5A 16 1 16 0 161 80+10 = 90 10 Solution: °First convert the hexadecimal number into its decimal equivalent, then convert the decimal number into its octal equivalent.
38
38 Fractions (Example)
39
39 Fractions (Example)
40
40 Radix Based Conversion (Example) °Convert 0.6875 decimal into binary Radix 2 Answer0.1011 2 FractionRadixTotal (Fraction x Radix)IntegerFraction 0.687521.37510.375 20.750 21.510.5 2110 Multiply by radix 2
41
41 FractionRadix Total (Fraction x Radix)IntegerFraction 0.513168.20880.208 163.32830.328 165.24850.248 163.96830.968 Radix Based Conversion (Example) °Convert 0.513 10 to base 16 (up to 4 fractional point) Radix 16 Answer0.8353 16 Multiply by radix 16
42
42 Any base to decimal conversion (110.11) 2 to decimal: (110.11) 2 = 6.75.
43
43
44
44 Complement °It has already been studied that °subtracting one number from another is the same as making one number negative and just adding them. °We know how to create negative numbers in the binary number system. °How to perform 2’s complement process. °How the 2’s complement process can be use to add (and subtract) binary numbers. °Digital electronics requires frequent addition and subtraction of numbers. You know how to design an adder, but what about a subtracter? °A subtracter is not needed with the 2’s complement process. The 2’s complement process allows you to easily convert a positive number into its negative equivalent. °Since subtracting one number from another is the same as making one number negative and adding, the need for a subtracter circuit has been eliminated.
45
45 3-Digit Decimal A bicycle odometer with only three digits is an example of a fixed-length decimal number system. The problem is that without a negative sign, you cannot tell a +998 from a -2 (also a 998). Did you ride forward for 998 miles or backward for 2 miles? Note: Car odometers do not work this way. 999 998 997 001 000 999 998 002 001 forward (+) backward (-)
46
46 Negative Decimal How do we represent negative numbers in this 3- digit decimal number system without using a sign? Cut the number system in half. Use 001 – 499 to indicate positive numbers. Use 500 – 999 to indicate negative numbers. Notice that 000 is not positive or negative. 499 498 497 001 000 999 998 501 500 pos(+) neg(-) +499 +498 +497 +001 000 -002 -499 -500
47
47 3-Digit Decimal (Examples) 3 + 2 5 003 + 002 005 (-5) + 2 (-3) 995 + 002 997 6 + (-3) 3 (-2) + (-3) (-5) 006 + 997 1 003 Disregard Overflow 998 + 997 1 995 Disregard Overflow It Works!
48
48 Complex Problem °The previous examples demonstrate that this process works, but how do we easily convert a number into its negative equivalent? °In the examples, converting the negative numbers into the 3-digit decimal number system was fairly easy. To convert the (-3), you simply counted backward from 1000 (i.e., 999, 998, 997). °This process is not as easy for large numbers (e.g., -214 is 786). How did we determine this? °To convert a large negative number, you can use the 10’s Complement Process.
49
49 The 10’s Complement process uses base-10 (decimal) numbers. Later, when we’re working with base-2 (binary) numbers, you will see that the 2’s Complement process works in the same way. First, complement all of the digits in a number. A digit’s complement is the number you add to the digit to make it equal to the largest digit in the base (i.e., 9 for decimal). The complement of 0 is 9, 1 is 8, 2 is 7, etc. Second, add 1. Without this step, our number system would have two zeroes (+0 & -0), which no number system has.
50
50 10’s Complement Examples -003 +1 996 997 -214 +1 785 Example #1 Example #2 Complement DigitsAdd 1Complement DigitsAdd 1 786
51
51 8-Bit Binary Number System Apply what you have learned to the binary number systems. How do you represent negative numbers in this 8- bit binary system? Cut the number system in half. Use 00000001 – 01111111 to indicate positive numbers. Use 10000000 – 11111111 to indicate negative numbers. Notice that 00000000 is not positive or negative. 51 01111111 01111110 01111101 00000001 00000000 11111111 11111110 10000001 10000000 +127 +126 +125 +1 0 -2 -127 -128
52
52 Sign Bit What did do you notice about the most significant bit of the binary numbers? The MSB is (0) for all positive numbers. The MSB is (1) for all negative numbers. The MSB is called the sign bit. In a signed number system, this allows you to instantly determine whether a number is positive or negative. 01111111 01111110 01111101 00000001 00000000 11111111 11111110 10000001 10000000 pos(+) neg(-) +127 +126 +125 +1 0 -2 -127 -128
53
53 2’S Complement Process The steps in the 2’s Complement process are similar to the 10’s Complement process. However, you will now use the base two. First, complement all of the digits in a number. A digit’s complement is the number you add to the digit to make it equal to the largest digit in the base (i.e., 1 for binary). In binary language, the complement of 0 is 1, and the complement of 1 is 0. Second, add 1. Without this step, our number system would have two zeroes (+0 & -0), which no number system has.
54
54 2’s Complement Examples Example #1 Example #2 Complement Digits Add 1 5 = 00000101 -5 = 11111011 11111010 +1 Complement Digits Add 1 -13 = 11110011 13 = 00001101 00001100 +1
55
55 Using The 2’s Compliment Process 9 + (-5) 4 (-9) + 5 - 4 (-9) + (-5) - 14 9 + 5 14 POS + POS POS + NEG POS NEG + POS NEG + NEG NEG Use the 2’s complement process to add together the following numbers.
56
56 POS + POS → POS Answer If no 2’s complement is needed, use regular binary addition. 00001001 9 + 5 14 00001110 00000101 +
57
57 POS + NEG → POS Answer Take the 2’s complement of the negative number and use regular binary addition. 00001001 9 + (-5) 4 11111011 + 00000101 11111010 +1 11111011 2’s Complement Process 1]00000100 8 th Bit = 0: Answer is Positive Disregard 9 th Bit
58
58 POS + NEG → NEG Answer Take the 2’s complement of the negative number and use regular binary addition. 11110111 (-9) + 5 -4 00000101 + 00001001 11110110 +1 11110111 2’s Complement Process 11111100 8 th Bit = 1: Answer is Negative 11111100 00000011 +1 00000100 To Check: Perform 2’s Complement On Answer
59
59 NEG + NEG → NEG Answer Take the 2’s complement of both negative numbers and use regular binary addition. 11110111 (-9) + (-5) -14 11111011 + 2’s Complement Numbers, See Conversion Process In Previous Slides 1]11110010 8 th Bit = 1: Answer is Negative Disregard 9 th Bit 11110010 00001101 +1 00001110 To Check: Perform 2’s Complement On Answer
60
60 1’s Complement
61
61 2’s Complement 1s complement with negative numbers shifted one position clockwise Only one representation for 0 One more negative number than positive number High-order bit can act as sign bit
62
62 Overflow °Overflow conditions °Add two positive numbers to get a negative number °Add two negative numbers to get a positive number
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.