620 likes | 638 Views
DLD Lecture 18 Recap. 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
E N D
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
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) on off Power switches have labels “1” for on and “0” for off.
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).
Conversion Among Bases The possibilities: Decimal Octal Binary Hexadecimal
Base 2 = Base 10 000 = 0 001 = 1 010 = 2 011 = 3 100 = 4 101 = 5 110 = 6 111 = 7 Binary In Binary, there are only 0’s and 1’s. These numbers are called “Base-2”( Example: 0102) 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. Binary to Decimal
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.
Vcc Vcc Vcc, or 1 Gnd, or 0 A Simple Switch • Here is a simple switch used to provide a logic value: There are other ways to connect a switch.
Binary digits Bit: single binary digit Byte: 8 binary digits • Bit 100101112 • Radix Byte
Number systems • Converting to decimal from binary: • Evaluate the power series • Example 5 4 3 2 1 0 1 0 1 1 1 12 1*25 0*24 1*23 1*22 + + + + 1*20 4710 1*21 = +
Review of Number systems Memorize the first ten powers of two
Number systems • Converting to binary from decimal: • Divide the decimal number by 2 repeatedly. • The remainder gives the digits of the binary number 2 746 2 373 R 0 2 186 R 1 93 R 0 2 2 46 R 1 23 R 0 2 10111010102 11 R 1 2 2 5 R 1 2 R 1 2 2 1 R 0
Number systems (Octal Numbers) Octal Numbers: [Base 8],[ 0,1,3,4,5,6,7] • Octal to Decimal Conversion: • Example:- • [2374]8 = [ ? ]10 • =4×80+7×81+3×82+2×83 • =[1276]10 • 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
Number systems (Octal Numbers) • Decimal to Octal Conversion: • The Division: • [359]10 = [ ? ]8 • By using the division system: Quotient Reminder 7 4 5 4 7 5
Number systems (Octal Numbers) • 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 1 1 0 1 0 1 = (65)8 { { 6 5
Number systems (Octal Numbers) 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 (13)8 = (001011)2
Radix Based Conversion (Example) • Convert 1234 decimal into octal Radix 8 Answer Divide by radix 8 23228
Octals • Converting to decimal from octal: • Evaluate the power series • Example 0 2 1 2 0 7 8 0*81 2*82 7*80 + + 13510 =
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: 00002 (0) to 11112 (F) • Easier than using ones and zeros for large binary values • Commonly used in computer applications • Examples: • 11002 = 1210 = C16 • 1010 0110 1100 00102 = A6 C216 Hex values can be followed by an “H” to indicate base-16. Example: A6 C2 H
Conversion Binary to Hexadecimal 1010 = 10 1100 = 12 0001 = 1 0110 = 6 A C 1 6
Radix Based Conversion (Example) • Convert 1234 decimal into hexadecimal Radix 16 Answer Divide by radix 16 4D216
Hexadecimals – Base 16 • Converting to decimal from hex: • Evaluate the power series • Example 0 2 1 2 E A 16 14*161 2*162 10*160 + + 74610 =
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
Hex to Octal Conversion Ex : Convert E8A16 to octal First convert the hex to binary: 1110 1000 10102 111 010 001 010 and re-group by 3 bits (starting on the right) Then convert the binary to octal: 7 2 1 2 So E8A16 = 72128
Octal to Hex Conversion Ex : Convert 7528 to hex First convert the octal to binary: 111 101 0102 re-group by 4 bits 0001 1110 1010 (add leading zeros) Then convert the binary to hex: 1 E A So 7528 = 1EA16
Octal to Hexadecimal Decimal Octal Binary Hexadecimal
Octal to Hexadecimal • Technique • Use binary as an intermediary
1 0 7 6 • 001 000 111 110 2 3 E Example 10768 = ?16 10768 = 23E16
Hexadecimal to Octal Decimal Octal Binary Hexadecimal
Hexadecimal to Octal • Technique • Use binary as an intermediary
1 F 0 C • 0001 1111 0000 1100 1 7 4 1 4 Example 1F0C16 = ?8 1F0C16 = 174148
Example: Hex → Octal • Example: • Convert the hexadecimal number 5AH into its octal equivalent. • Solution: • First convert the hexadecimal number into its decimal equivalent, then convert the decimal number into its octal equivalent. 5AH = 1328
Radix Based Conversion (Example) • Convert 0.6875 decimal into binary Radix 2 Multiply by radix 2 Answer 0.10112
Radix Based Conversion (Example) • Convert 0.51310 to base 16 (up to 4 fractional point) Radix 16 Multiply by radix 16 Answer 0.835316
Any base to decimal conversion (110.11)2 to decimal: (110.11)2 = 6.75.
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.
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 forward (+) 998 997 001 000 999 998 002 backward (-) 001
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 pos(+) +498 499 +497 498 497 +001 000 001 -001 000 -002 999 998 -499 neg(-) -500 501 500
3-Digit Decimal (Examples) 003 + 002 005 3 + 2 5 Disregard Overflow (-5) + 2 (-3) 6 + (-3) 3 (-2) + (-3) (-5) 995 + 002 997 998 + 997 1995 006 + 997 1003 Disregard Overflow It Works!
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.
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.
10’s Complement Examples Example #1 -003 Complement Digits Complement Digits 996 Add 1 Add 1 997 Example #2 -214 785 +1 +1 786