Download presentation
Presentation is loading. Please wait.
1
Basic Digital Logic Systems
Review Basic Digital Logic Systems Digital Design Review
2
Outline Number Systems / Binary Encoding Boolean Algebra
Combinational Circuits Sequential Circuits Digital Design Review
3
1. Number Systems Digital Design Review
4
Positional Number System
For base-10 numbers: 289 = 2x x x100 Works for other bases Base 6: (we indicate base explicitly) = 2x62 + 3x61 + 5x60 Fractional Numbers: = 7x x x x x10-3 52.18 = 5x81 + 2x80 + 1x8-1 = /8 = Digital Design Review
5
Binary Numbers Digital Systems
Everything must be represented internally using {0,1} Base 2 or “binary” = 1x23 + 1x21 + 1x20 = = 1110 Binary digits = “bits” k-bit unsigned number represents values 0 to 2k-1 Convention: Most significant bit (MSB) Least significant bit (LSB) Digital Design Review
6
Conversion Between Bases
Like long division: Example: convert to base 6 112 (3x62) 4 (0x61) => 3046 (4x60) Digital Design Review
7
Conversion Between Bases
12.625 (1x23) 4.625 (1x22) 0.625 (0x21) (0x20) (1x2-1) 0.125 (0x2-2) (1x2-3) => Other bases Example: convert to binary Should be able to do this to understand meaning In practice: use a calculator (except simple conversions) Digital Design Review
8
Hexadecimal Base 16 is Hexadecimal (“Hex” for short) Run out of numbers for digits, so use letters For example 1A2F16 = 1x x x x160 = Why are hex numbers useful? Shorthand for binary. Going back and forth equally easy Worthwhile to memorize hex digits and binary equivalents Hex 1 2 3 4 5 6 7 8 9 A B C D E F Dec Equiv. 10 11 12 13 14 15 0000|1010|0110| binary 0 A hex Digital Design Review
9
Other Codes Binary Coded Decimal (BCD) Gray Codes ASCII
Single decimal digit maps to 4 bits Simplifies display / conversion of decimal numbers Example: = BCD More bits needed, but it is still often useful Gray Codes Adjacent numbers differ only by one bit ASCII “American Standard Code for Information Interchange” 7-bit code for alphabet and some control characters ‘A’ = 4116 or 6510, ‘.’ = 2E Decimal Gray 000 1 001 2 011 3 010 4 110 5 111 6 101 7 100 Digital Design Review
10
Unsigned Arithmetic Addition of unsigned (non-negative) of any base can be done with “elementary school” method Add 2 binary numbers, just need simple rules 0+0+0=00, 0+0+1=01, 0+1+1=10, 1+1+1= C = “carry” bit Addition of two k-bit numbers Can lead to k+1 bit number Carry in the left-most position means “overflow” has occurred 1 1 1 1 Digital Design Review
11
Signed Magnitude How do we represent negative numbers?
How about usual thing with written numbers? Use one bit to mean + (0) or – (1) Digital systems: called the “sign” bit Example: +310 =+ (0112) = 0011SM -310 =- (0112) = 1011SM Advantages: Simple. Sign and number separate Digital Design Review
12
Signed Magnitude Disadvantages Arithmetic with signed magnitude
Two representations of 0 Arithmetic more complicated Arithmetic with signed magnitude 5 + (-2) = 5 – 2 = 3 5 – (-2) = = 7 -5 – 1 = - (5 + 1) = -6 Must consider signs and do add/sub accordingly Digital Design Review
13
2s Complement Use the usual positional notation, but we invert sign of leftmost weight Note: MSB can still be considered a “sign” bit indicating if number is + or – For + number, remaining bits can be interpreted as unsigned number 11112C = -1x23 + 1x22 + 1x21 + 1x20 = = -110 10112C = -1x23 + 0x22 + 1x21 + 1x20 = = -510 01112C = -0x23 + 1x22 + 1x21 + 1x20 = = +710 Digital Design Review
14
2s Comp: Sign Extension How do we make 2’s complement number longer? (maybe need more bits) Answer: duplicate the sign bit. 00112C = C = C = 310 10112C = C = C = -510 Digital Design Review
15
2s Comp: Negating How do we flip the sign of a 2s complement number?
With signed magnitude: just flip bit. For 2s complement, invert all bits and add 1 (use modulo unsigned arithmetic) Why does this last conversion fail? +510 = 01012C =>(inv)=> = 10112C = -510 -510 = 10112C =>(inv)=> = 01012C = -510 +0 = 00002C =>(inv)=> = 00002C = 0 -810 = 10002C =>(inv)=> = 10002C = !? Digital Design Review
16
2s Comp: Addition This is the main advantage of 2s complement
Just do normal arithmetic (regardless of sign bit) We can also have overflow when we add 2s complement numbers. How do we detect it? Only possible for same sign. Check sign bit, if it changes => overflow. How do we avoid it? Sign extend, then add 1 1 1 1 1 1 Digital Design Review
17
2. Boolean Algebra Digital Design Review
18
Boolean Algebra Named after George Boole in 19th century
Map: TRUE 1, FALSE 0 Operators: AND a·b or just ab OR a+b NOT a’ or a DeMorgan’s (DM) Rules (AB)’ = A’ + B’ (A+B)’ = A’B’ Easily proven using a truth table ... Digital Design Review
19
Truth Tables Simple 2-variable truth tables
Can obviously extend to more than 2 input variables (output variables) A B F 1 A B F 1 A B F 1 A B F 1 A=B F=1 OR F=AB’ Digital Design Review
20
Truth Tables Boolean Alg.
Sum of Products (SOP) form OR the true rows in the truth table F = A’B + A B’ A B F 1 A’B’ A’B AB’ AB Digital Design Review
21
Truth Tables Boolean Alg.
Product of Sums (POS) form AND the false rows in the truth table F’ = A’B’ + AB F’ = [(A’B’)’ (AB)’]’ (DM) F = (A+B) (A’ + B’) (DM) A B F 1 A’B’ A’B AB’ AB Digital Design Review
22
Boolean Eq. Truth Table
Repeatedly evaluate expression for all combinations. Can be more efficient to fill just TRUE terms F = A’B + A B F = A + A’B A’B AB A B F 1 A’B A A B F 1 Digital Design Review
23
Boolean Identities Single Variable
Two Variable useful for reducing # of terms on complex exp. Simplification Theorems Consensus Theorem difficult to find opportunities to use cons. thm. A · 0 = 0 A · 1 = A A + 0 = A A + 1 = 1 A · A’ = 0 A + A’ = 1 A · A = A A + A = A A + A’B = A + B A(A’ + B) = AB AB’ + AB = A (A+B’)(A+B) = A AC + A’B + BC = AC + A’B Redundant (A+C)(A’+B)(B+C) = (A+C)(A’+B) Digital Design Review
24
Boolean Identities (cont’d)
Communitive, Associative, Distributive Thms AB = BA A+B=B+A Communitive (AB)C = A(BC) (A+B)+C = A+(B+C) Associative A(B+C)=AB + AC Distributive A+BC = (A+B)(A+C) Distributive Duality: For a valid equality, its “dual” is also true Dual: Replace AND ↔ OR ↔ Example: A(B+C) = AB + AC know this is valid, then A + BC = (A+B)(A+C) Note: An expression is not equivalent to its dual! Be careful of precedence. Digital Design Review
25
Canonical Forms Purpose SOP form “minterm” expansion
Means: “Write a an expression in most standard way.” Trivial to tell if two expressions are identical SOP form “minterm” expansion “minterm” = product term having all variables A B F 1 m0 m1 m2 m3 F = A’B’ + A’B + AB = m0 + m1 + m3 = ∑m(0,1,3) Digital Design Review
26
Canonical Forms POS form “maxterm” expansion A B F 1 M0 M1 M2 M3
1 M0 M1 M2 M3 F = (A’ + B)(A’ + B’) = M2 · M3 = π M(2,3) Digital Design Review
27
Proving Boolean Expressions
Methods Truth table Minterm/maxterm expansion (same terms?) Manipulate one side to = other (identities) Manipulate both sides with identical operations Digital Design Review
28
Boolean Minimization Make expression as “simple” as possible (low number of terms) AB’ = AB = A(B’ +B) = A· 1 = A Less complicated expression Fewer gates, less area, runs faster Attempt to find minimal cost solution What is minimal representation? Depends on technology and contraints. Digital Design Review
29
Boolean Minimization Example technologies MSI - 7400
Min. chip count One type of gate preferable NMOS NOR gates Literal count (count # of terms) *CMOS NAND gates FPGA Minimum number of Lookup Tables (LUTs) Digital Design Review
30
Incompletely Specified Funcs
A B C F X Y Z W A B C F 1 X Suppose we know N1 will never generate 101 or 111 Can pick don’t cares to help minimize logic. “Don’t cares” Digital Design Review
31
K-Maps Karnaugh Map (K-Map for short)
Graphical way of obtaining minimal solutions Take advantage of logical adjacency to reduce exp. Consider: F = A’B’ + A’B = A’ From simplification theorem AB’ + AB = A Terms A’B’ and A’B are adjacent in gray code (differ by 1 bit) See adj. terms Immediately use simp. thm. F = ABCD + AB’CD = ACD A B F 1 Digital Design Review
32
K-Maps (cont’d) 2 Variable Rearrange truth table (gray code) B A
K-map more compact (can see adjacent bits) A B F 1 A B F 1 F = B F = B B A 1 F = A’B + AB = B Can write F=B from K-map without using simplification theorem Digital Design Review
33
K-Maps (cont’d) Minterm (SOP) Method - Draw rectangles (ovals) to group as many 1s as possible. - Repeat until all 1s circled - Now OR the resulting terms (1 per oval) A B F 1 B A 1 F = B A B F 1 B A 1 F = A + B Digital Design Review
34
K-Maps: Don’t cares Can put X’s (don’t cares) in K-map
What do we do with them? Doesn’t matter! We can circle them or not, in order to have as few terms (biggest ovals) as possible. B A 1 X Digital Design Review
35
K-Maps: 3 Variable BCA BCA BCA 1 0 0 m0 m4 0 1 m1 m5 1 1 m3 m7 1 0 m2
1 0 0 m0 m4 0 1 m1 m5 1 1 m3 m7 1 0 m2 m6 BCA 1 0 0 X 0 1 1 1 1 0 X = 0 F = A’C + BC A B C F X 1 BCA 1 0 0 X 0 1 1 1 1 0 Exploit don’t cares F = C Digital Design Review
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.