1.39k likes | 1.58k Views
EELE 367 – Logic Design. Module 1 – Classic Digital Design Agenda Number Systems Combinational Logic Sequential Logic. Number Systems. Base Notation We’ll Use
E N D
EELE 367 – Logic Design • Module 1 – Classic Digital Design • Agenda • Number Systems • Combinational Logic • Sequential Logic
Number Systems • Base Notation We’ll Use - We will use the same notation as the HC12 Assembler.Decimal: nothing ex) 11 Base 10 = 10 Symbols Binary: % ex) %1011 Base 2 = 2 Symbols Octal: @ ex) @13 Base 4 = 4 Symbols Hexadecimal: $ ex) $BB Base 16 = 16 Symbols ASCII: ‘ ex) ‘a Code for Text
Number Systems • Base Conversion – Binary to Decimal - each digit has a “weight” of 2n that depends on the position of the digit - multiply each digit by its “weight” - sum the resultant products ex) Convert %1011 to decimal 23 22 21 20 (weight) %1 0 1 1 = 1•(23) + 0• (22) + 1• (21) + 1• (20) = 1•(8) + 0• (4) + 1• (2) + 1• (1) = 8 + 0 + 2 + 1= 11 Decimal
Number Systems • Base Conversion – Binary to Decimal with Fractions - the weight of the binary digits have negative positions ex) Convert %1011.101 to decimal 23 22 21 20 2-1 2-2 2-3 %1 0 1 1 . 1 0 1= 1•(23) + 0• (22) + 1• (21) + 1• (20) + 1• (2-1) + 0• (2-2)+ 1• (2-3) = 1•(8) + 0• (4) + 1• (2) + 1• (1) + 1• (0.5)+ 0• (0.25)+ 1• (0.125) = 8 + 0 + 2 + 1 + 0.5 + 0 + 0.125= 11.625 Decimal
Number Systems • Base Conversion – Decimal to Binary - the decimal number is divided by 2, the remainder is recorded - the quotient is then divided by 2, the remainder is recorded - the process is repeated until the quotient is zero ex) Convert 11 decimal to binaryQuotient Remainder 2 11 5 1 LSB 2 5 2 1 2 2 1 0 2 1 0 1 MSB = %1011
Number Systems • Base Conversion – Decimal to Binary with Fractions - the fraction is converted to binary separately - the fraction is multiplied by 2, the 0th position digit is recorded - the remaining fraction is multiplied by 2, the 0th digit is recorded - the process is repeated until the fractional part is zero ex) Convert 0.375 decimal to binaryProduct 0th Digit0.375•2 0.75 0 MSB 0.75•21.50 1 0.5•21.00 1 LSB 0.375 decimal = % .011 finished
Number Systems • Base Conversion – Hex to Decimal - the same process as “binary to decimal” except the weights are now BASE 16 - NOTE ($A=10, $B=11, $C=12, $D=13, $E=14, $F=15) ex) Convert $2BC to decimal 162 161 160 (weight) $2 B C = 2• (162) + B• (161) + C• (160) = 2•(256) + 11• (16) + 12• (1) = 512 + 176 + 12= 700 Decimal
Number Systems • Base Conversion – Hex to Decimal with Fractions - the fractional digits have negative weights (BASE 16) - NOTE ($A=10, $B=11, $C=12, $D=13, $E=14, $F=15) ex) Convert $2BC.F to decimal 162 161 160 16-1 (weight) $2 B C . F = 2• (162) + B• (161) + C• (160) + F• (16-1) = 2•(256) + 11• (16) + 12• (1) + 15• (0.0625) = 512 + 176 + 12 + 0.938= 700.938 Decimal
Number Systems • Base Conversion – Decimal to Hex - the same procedure is used as before but with BASE 16 as the divisor/multiplier ex) Convert 420.625 decimal to hex 1st, convert the integer part…Quotient Remainder16 420 26 4 LSB 16 26 1 10 16 1 0 1 MSB= $1A4 2nd, convert the fractional part…Product 0th Digit0.625•16 10.00 10 MSB= $ .A 420.625 decimal = $1A4.A
Number Systems • Base Conversion – Octal to Decimal / Decimal to Octal - the same procedure is used as before but with BASE 8 as the divisor/multiplier
Number Systems • Base Conversion – Hex to Binary - each HEX digit is made up of four binary bits ex) Convert $ABC to binary $A B C = % 1010 1011 1100= %1010 1011 1100
Number Systems • Base Conversion – Binary to Hex - every 4 binary bits for one HEX digit - begin the groups of four at the LSB - if necessary, fill the leading bits with 0’s ex) Convert $ABC to binary= % 11 0010 1111 $3 2 F
Number Systems • Binary Addition - same as BASE 10 addition - need to keep track of the carry bit for a given system size (n), i.e., 4-bit, 8-bit, 16-bit,… ex) Add %1011 and $10011 1% 1 0 1 1 % 1 0 0 1 +________ 1 0 1 0 0 Carry Bit
Number Systems • Two’s Complement - we need a way to represent negative numbers in a computer - this way we can use “adding” circuitry to perform subtraction - since the number of bits we have is fixed (i.e., 8), we use the MSB as a sign bit Positive #’s : MSB = 0(ex: %0000 1111, positive number) Negative #’s : MSB = 1 (ex: %1000 1111, negative number) - the range of #’s that a two’s compliment code can represent is:(-2n-1) < N < (2n-1 – 1) : n = number of bits ex) What is the range of #’s that an 8-bit two’s compliment code can represent? (-28-1) < N < (28-1 – 1)(-128) < N < (+127)
Number Systems • Two’s Complement Negation - to take the two’s compliment of a positive number (i.e., find its negative equivalent)Nc= 2n – N Nc = Two’s Compliment N = Original Positive Number ex) Find the 8-bit two’s compliment representation of –52dec N = +52dec Nc= 28 – 52 = 256 – 52 = 204 = %1100 1100 Note the Sign Bit
Number Systems • Two’s Complement Negation (a second method) - to take the two’s compliment of a positive number (i.e., find its negative equivalent) 1) Invert all the bits of the original positive number (binary) 2) Add 1 to the result ex) Find the 8-bit two’s compliment representation of –52dec N = +52dec = %0011 0100 Invert: = %1100 1011 Add 1 = %1100 1011 + 1 -------------------- %1100 1100 (-52dec)
Number Systems • Two’s Complement Addition - Addition of two’s compliment numbers is performed just like standard binary addition - However, the carry bit is ignored
Number Systems • Two’s Compliment Subtraction - now we have a tool to do subtraction using the addition algorithm ex) Subtract 8dec from 15dec 15dec = %0000 1111 8dec = %0000 1000 -> two’s compliment -> invert %1111 0111 add1 %1111 0111 + 1 -----------------%1111 1000 = -8decNow Add: 15 + (-8) = %0000 1111 %1111 1000 +_________ % 1 0000 0111 = 7dec Disregard Carry
Number Systems • Two’s Compliment Overflow - If a two’s compliment subtraction results in a number that is outside the range of representation (i.e., -128 < N < +127), an “overflow” has occurred.ex) -100dec – 100dec- = -200dec (can’t represent) - There are three cases when overflow occurs 1) Sum of like signs results in answer with opposite sign 2) Negative – Positive = Positive 3) Positive – Negative = Negative - Boolean logic can be used to detect these situations.
Number Systems • Binary Coded Decimal - Sometimes we wish to represent an individual decimal digit as a binary representation (i.e., 7-segment display to eliminate a decoder) - We do this by using 4 binary digits.DecimalBCD 0 0000 1 0001 ex) Represent 17dec 2 0010 3 0011 Binary = %10111 4 0100 BCD = %0001 0111 5 0101 6 0110 7 0111 8 1000 9 1001
Number Systems • ASCII - American Standard Code for Information Interchange - English Alphanumeric characters are represented with a 7-bit code ex) ‘A’ = $40 ‘a’ = $61
Number Systems • Important Things to Remember Know the Code : A computer just knows 1’s and 0’s. It is up to you to keep trace of whether the bits represent unsigned numbers, two’s complement, ASCII, etc… Two’s Complement Size : 2’s Complement always need a “size” associated with it. We always say “n-bit, two’s complement”
Basic Gates Combinational Logic Combinational Logic Gates : - Output depends on the logic value of the inputs - no storage
Basic Gates NOT out = in’ = in f(in) = in’ = in OR out = a+b f(a,b) = a+b ANDout = a·b f(a,b) = a·b
Basic Gates XOR out = ab f(a,b) = ab NOR out = a+b f(a,b) = a+b NAND out = a·b f(a,b) = a·b
Basic Gates XNOR out = abf(a,b) = ab Also remember about XOR Gates: f(a,b) = ab= (a’b + b’a) Also remember the priority of logic operations (without parenthesis) is: NOT, AND, OR
Boolean Algebra • Boolean Algebra- formulated by mathematician George Boole in 1854- basic relationships & manipulations for a two-value system • Switching Algebra- adaptation of Boolean Logic to analyzer and describe behavior of relays- Claude Shannon of Bell Labs in 1938- this works for all switches (mechanical or electrical)- we generally use the terms "Boolean Algebra" & "Switching Algebra" interchangeably
Boolean Algebra • What is Algebra- the basic set of rules that the elements and operators in a system follow- the ability to represent unknowns using variables- the set of theorems available to manipulate expressions • Boolean- we limit our number set to two values (0, 1)- we limit our operators to AND, OR, INV
Boolean Algebra • Axioms- also called "Postulates"- minimal set of basic definitions that we assume to be true- all other derivations are based on these truths- since we only have two values in our system, we typically define an axiom and then its complement (A1 & A1')
Boolean Algebra • Axiom #1 "Identity"- a variable X can only take on 1 or 2 values (0 or 1)- if it isn't a 0, it must be a 1- if it isn't a 1, it must be a 0 (A1) X = 0, if X ≠ 1 (A1') X = 1, if X ≠ 0 • Axiom #2 "Complement"- a prime following a variable denotes an inversion function (A2) if X = 0, then X' = 1 (A2') if X = 1, then X' = 0
Boolean Algebra • Axiom #3 "AND"- also called "Logical Multiplication"- a dot (·) is used to represent an AND function • Axiom #4 "OR"- also called "Logical Addition"- a plus (+) is used to represent an OR function • Axiom #5 "Precedence"- multiplication precedes addition (A3) 0·0 = 0 (A3') 1+1 = 1 (A4) 1·1 = 1 (A4') 0+0 = 0 (A5) 0·1 = 1·0 = 0 (A5') 0+1 = 1+0 = 1
Boolean Algebra • Theorems- Theorems use our Axioms to formulate more meaningful relationships & manipulations- a theorem is a statement of TRUTH- these theorems can be proved using our Axioms- we can prove most theorems using "Perfect Induction" - this is the process of plugging in every possible input combination and observing the output
Boolean Algebra • Theorem #1 "Identity" (T1) X+0 = X (T1') X·1 = X • Theorem #2 "Null Element" (T2) X+1 = 1 (T2') X·0 = 0 • Theorem #3 "Idempotency" (T3) X+X = X (T3') X·X = X • Theorem #4 "Involution" (T4) (X')' = X • Theorem #5 "Complements" (T5) X+X' = 1 (T5') X·X' = 0
Boolean Algebra • Theorem #6 "Commutative" (T6) X+Y = Y+X (T6') X·Y = Y·X • Theorem #7 "Associative" (T7) (X+Y)+Z= X+(Y+Z) (T7') (X · Y) · Z= X · (Y · Z) • Theorem #8 "Distributive" (T8) X·(Y+Z) = X·Y + X·Z (T8') (X+Y)·(X+Z) = X + Y·Z
Boolean Algebra • Theorem #9 "Covering" (T9) X + X·Y = X (T9') X·(X+Y) = X • Theorem #10 "Combining" (T10) X·Y + X·Y' = X (T10') (X+Y)·(X+Y') = X • Theorem #11 "Consensus" (T11) X·Y + X'·Z + Y·Z= X·Y + X'·Z (T11') (X+Y)·(X'+Z)·(Y+Z) = (X+Y) ·(X'+Z)
Boolean Algebra • Notes on the Theorems- T9/T9' and T10/T10' are used heavily in logic minimization- these theorems can be useful for making routing more reasonable- these theorems can reduce the number of gates in a circuit- they can also change the types of gates that are used
Boolean Algebra • More Theorem's - there are more generalized theorems available for large number of variables T13, T14, T15- one of the most useful is called "DeMorgan's Theorem" • DeMorgan's Theorem - this theorem states a method to convert between AND and OR gates using inversions on the input / output
Boolean Algebra • DeMorgan's TheoremPart 1: an AND gate whose output is complemented is equivalent to an OR gate whose inputs are complemented Part 2: an OR gate whose output is complemented is equivalent to an AND gate whose inputs are complemented = =
Boolean Algebra • Complement- complementing a logic function will give outputs that are inverted versions of the original function ex) A B F F' 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1 0 - DeMorgan's Theorem also gives us a generic formula to complement any expression: - for a Logic function F, we can get F' by : 1) Swapping all + and · 2) Complementing all Variables - KEEP THE PARENTHESIS ORDER OF THE ORGINAL FUNCTION !!!
Boolean Algebra • Complement- Example: Complement the Function F ex) A B F F' 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1 0 We know: F = A · BWe swap + and · first, then we complement all variables F' = A' + B'- This is the same as putting an inversion bubble on the output of the logic diagram →
Boolean Algebra • Duality- An Algorithm to switch between Positive Logic and Negative Logic- Duality means that the logic expression is exactly the same even though the circuitry has been altered to produce Complementary Logic - The steps are: - for a Logic function F, we can get FD by : 1) Swapping all + and · 2) Swapping all 0's and 1's - Ex) F = A · B (Positive Logic) We swap + and · first, then swap any 0's and 1'sFD = A + B (Negative Logic or "Dual")
Boolean Algebra • Complement vs. Duality, What is the difference?
Minterms • Truth Tables RowA B CF 0 0 0 0 1 Row We assign a "Row Number" for each entry starting at 0 1 0 0 1 0 2 0 1 0 0 Variables We enter all input combinations in ascending order. 3 0 1 1 1 We use straight binary with the MSB on the left 4 1 0 0 1 5 1 0 1 0 Function We say the output is a function of the input variables 6 1 1 0 1 F(A,B,C) 7 1 1 1 1 n = the number of input variables 2n = the number of input combinations
Minterms • Let's also define the following termsLiteral = a variable or the complement of a variable ex) A, B, C, A', B', C'Product Term = a single literal or Logical Product of two or more literals ex) A A·B B'·CSum or Products = (SOP), the Logical Sum of Product Terms ex) A + B A·B + B'·C
Minterms • Minterm- a normal product term w/ n-literals- a Minterm is written for each ROW in the truth table- there are 2n Minterms for a given truth table- we write the literals as follows: - if the input variable is a 0 in the ROW, we complement the Minterm literal - if the input variable is a 1 in the ROW, we do not complement the Minterm literal - for each ROW, we use a Logical Product on all of the literals to create the Minterm
Minterms • Minterm RowA B CMinterm F 0 0 0 0 A'·B'·C' F(0,0,0) 1 0 0 1 A'·B'·C F(0,0,1) 2 0 1 0 A'·B·C' F(0,1,0) 3 0 1 1 A'·B·C F(0,1,1) 4 1 0 0 A·B'·C' F(1,0,0) 5 1 0 1 A·B'·C F(1,0,1) 6 1 1 0 A·B·C' F(1,1,0) 7 1 1 1 A·B·C F(1,1,1) • Canonical Sum - we Logically Sum all Minterms that correspond to a Logic 1 on the output- the Canonical Sum represents the entire Logic Expression when the Output is TRUE- this is called the "Sum of Products" or SOP
Minterms • Minterm List- we can also describe the full logic expression using a list of Minterms corresponding to a Logic 1- we use the Σ symbol to indicate we are writing a Minterm list- we list the Row numbers corresponding to a Logic 1 RowA B CMinterm F 0 0 0 0 A'·B'·C' 0 1 0 0 1 A'·B'·C 1 2 0 1 0 A'·B·C' 1 3 0 1 1 A'·B·C 0 4 1 0 0 A·B'·C' 0 5 1 0 1 A·B'·C 0 6 1 1 0 A·B·C' 1 7 1 1 1 A·B·C 0 F = ΣA,B,C (1,2,6) = (A'·B'·C) + (A'·B·C') + (A·B·C') - this is also called the "ON-set"- this list is very verbose and NOT minimized using our Axioms and Theorems (more on this later…)
Maxterms • Let's define the following termsSum Term = a single literal or a Logical Sum of two or more literals ex) A A + B'Product of Sums = (POS), the Logical Product of Sum Terms ex) (A+B)·(B'+C)Normal Term = a term in which no variable appears more than once ex) "Normal A·B A + B' ex) "Non-Normal" A·B·B' A + A'
Maxterms • Maxterm - a Normal Sum Term w/ n-literals- a Maxterm is written for each ROW in the truth table- there are 2n Maxterms for a given truth table- we write the literals as follows: - if the input variable is a 0 in the ROW, we do not complement the Maxterm literal - if the input variable is a 1 in the ROW, we complement the Maxterm literal - for each ROW, we use a Logical Sum on all of the literals to create the Maxterm
Maxterms • Maxterm RowA B CMinterm Maxterm F 0 0 0 0 A'·B'·C' A+B+C F(0,0,0) 1 0 0 1 A'·B'·C A+B+C' F(0,0,1) 2 0 1 0 A'·B·C' A+B'+C F(0,1,0) 3 0 1 1 A'·B·C A+B'+C' F(0,1,1) 4 1 0 0 A·B'·C' A'+B+C F(1,0,0) 5 1 0 1 A·B'·C A'+B+C' F(1,0,1) 6 1 1 0 A·B·C' A'+B'+C F(1,1,0) 7 1 1 1 A·B·C A'+B'+C' F(1,1,1) • Canonical Product - we Logically Multiply all Maxterms that correspond to a Logic 0 on the output- the Canonical Product represents the entire Logic Expression when the Output is TRUE- this is called the "Product of Sums" or POS