Ch. 10 – Fundamentals of Logic Circuits So far, the circuits we’ve discussed were analog circuits, meaning that circuit parameters such as voltage and current were continuous quantities. 1
What would happen if we sample the instantaneous value at specific times? Then we would get a series of discrete values that approximate the continuous quantity. 2
Discrete values that approximate [represent] continuous functions lead to the concept of a digital circuit. The simplest digital circuits consist of two possible signal values. These circuits are binary in nature, and are represented with binary numbers. 3
Number Systems We commonly use a decimal, or Base 10, number system. Why? It turns out that the number 10 does not have very nice mathematical properties. It is rather difficult and awkward to implement a digital circuit based on the number 10. 4
Number Systems A power of the number 2 (the number of binary states) works much better. 2, 4, 8, 16, 32, 64, … We will look at two of these number systems in some detail: Base 2 (binary) and Base 16 (hexadecimal) We’ll compare/contrast them with the good old (but mathematically awkward) Base 10 (decimal) system. 5
Number Systems The decimal, binary, and hexadecimal number systems are place-valued number systems, where each digit takes on a weighting based on the place within the number that it appears. Not all number systems are place valued. Some are based on combinations of numerals. © MCMLXIV I = 1 V = 5 X = 10 L = 50 C = 100 D = 500 M =
Number Systems In Base 10, we have the following place values: s100s10s1s 1/10th 1/100th 1/1000th = 400 = 30 = 5 = 0.6 = In Base 10, we have the digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. 7
Number Systems In Base 2, we have the following place values: s4s2s1s 1/2th 1/4th 1/8th 2 -2 = 4 = 2 = 0 = In Base 2, we have the digits: 0 and 1. 8
Number Systems In Base 16, we have the following place values: s256s16s1s 1/16th 1/256th 1/4096th. 6C3.DA 6 = 1536 = 192 = 3 = = In Base 16, we have the digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9 A, B, C, D, E, and F.
Binary to decimal conversion: –Convert to decimal Decimal to binary conversion: –Convert to binary Number Conversion
Binary to decimal conversion: –Convert to decimal –16×1 + 8×0 + 4×0 + 2×1 + 1×1 = Decimal to binary conversion: –Convert to binary –32×1 + 16×0 + 8×1 + 4×1 + 2×1 + 1×1 = Number Conversion
Converting Between Base 2 and Base 16 Since 16 = 2 4, we can group binary digits into groups of 4 binary digits (bits) and convert each group of 4 bits to hexadecimal (hex) separately =11 22 8+4=12 4+2+1=7 B 2 C 7 ( ) 2 = B2C
2 0 = 2 1 = 2 2 = 2 3 = 2 4 = 2 5 = 2 6 = 2 7 = 2 8 = 2 9 = 2 10 = 2 11 = 2 12 = 2 13 = 2 14 = 2 15 = Powers of Two
2 0 = = = = = = = = 128 Handy to memorize up to = = = = = = = = Powers of Two
Converting Between Decimal, Hexa, and Binary 15
Binary Arithmetic Addition: = = = 10 sum carry One’s Complement: Toggle each bit (make each “0” a “1” and each “1” a “0”) Number: ’s Complement: Two’s Complement: One’s Complement + 1 Number: ’s Complement: ’s Complement: Subtraction: A – B = A + (– B) = A + (2’s Complement of B) OR 1 – 0 = – 101 = 001 (Borrow) MSB of a 2’s Complement number is the sign bit (0=positive, 1=negative) 16
Binary Subtraction Example (Complement) – ’s Complement – ’s Complement Check using Decimal Subtraction: = = – ignore 111 check 17
Binary Subtraction Example (Borrow) 110 – 101 Borrow from – Subtract Check using Decimal Subtraction: = = – check 18