610 likes | 761 Views
Digital Logic Review: Part II. ECE511: Digital System & Microprocessor. What we will learn in this session:. Negative number representation: 2’s Complement method. Minimizing Boolean expressions: K-map Boolean algebra. Comparison between Active High, and Active Low signals.
E N D
Digital Logic Review: Part II ECE511: Digital System & Microprocessor
What we will learn in this session: • Negative number representation: • 2’s Complement method. • Minimizing Boolean expressions: • K-map • Boolean algebra. • Comparison between Active High, and Active Low signals.
2’s Complement • Used by M68k to represent negative numbers. • Advantages: • Simple representation, conversion method. • Can perform arithmetic operations directly. • Can use existing circuits. • MSB regarded as sign bit. • If 0, then positive number. • If 1, then negative number. • Max value for 8-bits -128 to 127
2’s Complement • +34 (decimal) 00100010 • -54 (decimal) 11001010 Value Sign bit Value Sign bit
Converting to 2’s Complement • Converting 10 to -10: 1. Start with positive number 10 (decimal) = 00001010 (binary) 2. Invert all the bits 00001010 (invert) 11110101 3. Add 1 to inverted result 11110101 + 1 11110110 2’s Complement (-10)
Converting 2’s Complement Back • Converting -5 to 5: 1. The 2’s complement representation: -5 (decimal) = 11111011 (binary) 2. Invert all the bits 11111011 (invert) 00000100 3. Add 1 to inverted result 00000100 + 1 00000101 Positive value (+5)
Max Value +127 0 1 1 1 1 1 1 1 Sign bit Value -127 = 10000001
Min Value -128 1 0 0 0 0 0 0 0 Sign bit Value +128 = ???
0 0 0 0 0 0 0 0 Sign bit Value What about zero? invert 1 1 1 1 1 1 1 1 +1 1 carried out, not counted. 0 0 0 0 0 0 0 0
Calculating the Maximum Range • Calculated using the following formula: -(2n-1)< x < +(2n-1-1) Where n is number of bits.
Example: Calculating 2’s Complement Range • What is the range for 32-bit in 2’s complement representation? n = 32 -(232-1+1) < x < 232-1 -2,147,483,649 < x < 2,147,483,648
Active High and Active Low • Some signals are active lows. • They are active when they are low. • Marked with bar:
Active High and Active Low Active High 5 V is ACTIVE 0 V is INACTIVE Active Low 5 V is INACTIVE 0 V is ACTIVE TRUE FALSE TRUE FALSE
Why are active low signals preferred in control? • More noise immunity: • All electronic circuits affected by noise. • Less likely to false trigger. • Not affected by voltage surge.
Noise Immunity Example: Resets system when active (pulled high). False Triggering, system reset accidentally. 5V 5V 5V + = 0V 0V 0V Signal Noise New Signal
Noise Immunity Example: Resets system when active (pulled low). No effect, since RESET is active low. 5V 5V 5V + = 0V 0V 0V Signal Noise New Signal
Noise Immunity Example: Reads from memory when low, writes to memory when high. False Triggering, memory contents will be lost. 5V 5V 5V + = 0V 0V 0V Signal Noise New Signal
Noise Immunity Example: Reads from memory when high, writes to memory when low. No data lost even when false triggering occurred. 5V 5V 5V + = 0V 0V 0V Signal Noise New Signal
Importance of Minimization • In electronics, we want: • Functionality – desired objective. • Minimal circuit area – wafers, board space. • Minimal cost – more IC, more $$$. • Maximum reliability – more components, more fail. • Logic minimization + good design achieves all this. • 2 popular methods: • Boolan Algebra. • Karnaugh Map.
Boolean Algebra • Named after George Boole. • Based on set theory and algebra. • Application to electronics – C. Shannon. • Application to computers: J. V. Atanasoff. • Important in computer emergence.
Boolean Identities • Set of fundamental rules: • Defines Boolean behaviors. • Mathematics and Set Theory. • Used for minimization. • No set guideline for minimization: • When to use what. • Depends on luck, experience. • Better to use K-Map.
Identity Law Dominance Law Idempotent Law Inverse Law Commutative Law Associative Law Distributive Law Absorption Law De Morgan Law Double Complement Law Boolean Identities *You don’t have to memorize all these, you just have to know about them. Just use K-Map for minimization.
Identity Law + Dominance Law 1x = x 0 + x = x 0x = 0 1 + x = 1
Idempotent Law + Inverse Law xx = x x + x = x xx = 0 x + x = x
Commutative Law + Associative Law x + y = y + x xy = yx (xy)z = x(yz) (x + y) + z = x + (y + z)
Distributive Law x + yz = (x + y) (x + z) x(y + z) = xy + xz
Absorption Law x (x + y) = x x + xy = x
x = x Double Complement Law
A . B A + B A . B . = + + = . A + B A . B A + B De Morgan’s Law A + B = A . B A . B = A + B
A . B A + B . = + + = . A + B A . B A + B = A . B A . B = A + B A . B A + B De Morgan’s Law
Minimize: Z = ABC + ABC + ABC Z = ABC + ABC + ABC Z = ABC + B(AC + AC) Z = ABC + BC(A + A) Z = ABC + BC Example 1 Distributive Law Distributive Law Inverse Law
Minimize: Z = ABC + ABC + ABC What if… Z = ABC + ABC + ABC Distributive Law Z = A(BC + BC) + ABC Stuck here… * Can never get the answer!
Karnaugh Maps • To simplify Boolean expressions. • Invented by Maurice Karnaugh. • Simpler than Boolean Algebra. • Principles: • Group together common factors. • Delete unwanted variables. • Works best for two to four variables.
A 0 1 0 B 1 Table Layout – 2 Variables
AB 00 01 11 10 0 C 1 Table Layout – 3 Variables
AB 00 01 11 10 00 01 CD 11 10 Table Layout – 4 Variables
How to Construct the K-Map • Analyze function, create Truth Table (TT). • Draw K-Map based on no. of variables. • Fill the K-Map with values from TT. • Group 1’s together. • Extract simplified expression.
AB √ 00 01 11 10 00 1 1 0 0 01 0 0 1 0 CD 11 0 1 1 0 10 1 0 0 0 × Rules 1. You must not miss any 1’s. 2. You can go right-left or up-down, but you cannot go diagonal.
AB AB 00 00 01 01 11 11 10 10 00 00 1 1 1 1 1 1 1 0 √ 01 01 0 0 0 1 0 1 0 0 CD CD 11 11 0 0 0 0 1 1 1 0 10 10 1 0 0 0 0 1 0 1 × Rules 3. You can only have 1, 2, 4, 8, …, 2n elements in a group.
AB AB 00 00 01 01 11 11 10 10 00 00 1 1 1 1 1 1 1 1 01 01 0 0 0 0 0 0 0 0 CD CD 11 11 0 0 1 1 1 1 0 0 10 10 0 0 1 1 1 1 0 0 Rules 4. Try to cover all 1’s using the minimum number of groups. . √ × 2 groups 6 groups
AB AB 00 00 01 01 11 11 10 10 00 00 0 1 1 0 1 0 0 1 01 01 0 0 1 0 1 0 0 0 CD CD 11 11 0 0 0 1 0 0 0 0 10 10 1 0 0 1 0 1 0 0 Rules 5. Overlapping groups are allowed. √ √ √
AB AB 00 00 01 01 11 11 10 10 00 00 1 1 0 0 0 0 1 1 01 01 0 0 0 0 0 0 0 0 CD CD 11 11 0 1 0 0 0 0 0 1 10 10 1 1 0 0 0 0 1 1 Rules 6. Wrap-around is allowed. √ √ Corner wrap Side wrap
AB 00 01 11 10 00 1 0 1 1 01 0 0 0 0 CD 11 0 0 0 0 10 1 0 1 1 Rules √ Top-down wrap
AB AB 00 00 01 01 11 11 10 10 00 00 0 0 X X 0 0 0 0 01 01 0 0 1 1 1 1 0 0 CD CD 11 11 0 0 X X 1 1 0 1 10 10 X X 0 0 0 0 0 0 Rules 6. Don’t cares (X) can be grouped with 1’s if they help. × √ Don’t cares can help make the group larger (1 group). Not selecting don’t cares (2 groups)
Extracting the Results *All AB cancel out, only C and D are left. AB AB 00 01 11 10 00 CD 00 01 11 10 00 1 1 1 1 01 0 0 0 0 CD 11 0 1 1 0 10 0 1 1 0 AB *A and D cancel out, only B and C are left. Answer: 01 11 11 CD 10