Why digital?
It has the following advantages over analog.
It can be processed and transmitted efficiently and reliably.
It can be stored and retrieved with greater accuracy.
Noise level does not affect much.
Digital takes only two voltage levels either ”Low” or ”High”.
It is because of switching devices we use like Diode, Transistorsand relays.
S. Sivasubramani EE101 - Digital
Number Systems
Because of two levels, binary numbers are used in digital systems.”High” means 5 V. ”Low” means 0 V.In positive logic,
High→ 1
Low→ 0
In negative logicHigh→ 0
Low→ 1
Each binary digit is called a bit.
S. Sivasubramani EE101 - Digital
Binary to Decimal conversion
The right most bit of the binary number is the LSB (leastsignificant bit) whose weight is 20 = 1.The left most bit is the MSB (most significant bit) whose weightdepends on the size of binary number.Example:
101012 = 1× 24 + 0× 23 + 1× 22 + 0× 21 + 1× 20
= 16 + 0 + 4 + 0 + 1 = 2110
In a fractional number, the left most bit is the MSB whose weightis 2−1.
0.11002 = 1× 2−1 + 1× 2−2 + 0× 2−3 + 0× 2−4
= 0.5 + 0.25 + 0 + 0 = 0.7510
S. Sivasubramani EE101 - Digital
Decimal to Binary conversion
A systematic method of converting decimal to binary is repeateddivision by 2.Example : Convert 24 to binary
Remainder
24
212 0 LSB
12
26 0
6
23 0
3
21 1
1
20∗ 1 MSB
* - Stop when the whole number quotient is zero.
2410 = 110002S. Sivasubramani EE101 - Digital
Decimal fractions to Binary
Decimal fractions can be converted to binary by repeatedmultiplication by 2.Example : Convert 0.625 to binary.
Carry
0.625× 2 = 1.25 1 MSB
0.25× 2 = 0.5 0
0.5× 2 = 1.0∗ 1 LSB
* - Continue to the desired number of decimal places or stop whenthe fractional part is all zeros.
0.625 = 0.101
S. Sivasubramani EE101 - Digital
Hexadecimal Numbers
1 It has sixteen characters.2 It is very easy to convert between binary and hexadecimal.3 When we program in machine language such as writing an
instruction in microprocessor, it is easy to write inhexadecimal system
Decimal Binary Hexadecimal Decimal Binary Hexadecimal
0 0000 0 8 1000 81 0001 1 9 1001 92 0010 2 10 1010 A3 0011 3 11 1011 B4 0100 4 12 1100 C5 0101 5 13 1101 D6 0110 6 14 1110 E7 0111 7 15 1111 F
S. Sivasubramani EE101 - Digital
Binary to Hexadecimal conversion
Break the binary number in 4-bit groups, starting at the right mostbit and replace each 4-bit group with the equivalent hexadecimalsymbol.Example : convert 10100101 and 101111 to hexadecimal.
1010︸︷︷︸ 0101︸︷︷︸↓ ↓A 5
101001012 = A516
0010∗︸ ︷︷ ︸ 1111︸︷︷︸↓ ↓2 F
1011112 = 2F16
* - two zeros have been added to complete a 4-bit groupS. Sivasubramani EE101 - Digital
Hexadecimal to Binary conversion
Replace each hexadecimal symbol with a 4-bit binary number.Example: Convert 1016 and C216
1︸︷︷︸ 0︸︷︷︸↓ ↓
0001 0000
1016 = 100002
C︸︷︷︸ 2︸︷︷︸↓ ↓
1100 0010
C216 = 110000102
S. Sivasubramani EE101 - Digital
Octal Numbers
1 It has eight digits.
2 Like hexadecimal number system, it provides a convenient wayto express binary numbers.
3 It is very easy to convert between octal and binary.
Decimal Binary Octal
0 000 01 001 12 010 23 011 34 100 45 101 56 110 67 111 7
However, it is used less frequently than hexadecimal.S. Sivasubramani EE101 - Digital
Binary to Octal conversion
1 Break the binary number in 3-bit groups, starting at the rightmost bit and replace each 3-bit group with the equivalentoctal digit.
2 If there are not three bits in the left most group, add enoughzeros to complete a 3-bit group.
Example: Convert 101000 and 10110
101︸︷︷︸ 000︸︷︷︸↓ ↓5 0
1010002 = 508
010∗︸︷︷︸ 110︸︷︷︸↓ ↓2 6
101102 = 268
*- one zero has been added to complete a 3-bit group.S. Sivasubramani EE101 - Digital
Octal to Binary conversion
Replace each octal digit with a 3-bit binary number.Example: Convert 158 and 508
1︸︷︷︸ 5︸︷︷︸↓ ↓
001 101
158 = 11012
5︸︷︷︸ 0︸︷︷︸↓ ↓
101 000
508 = 1010002
S. Sivasubramani EE101 - Digital
Binary Addition
0 + 0 = 0
0 +1 = 1
1 + 0 =1
1 + 1 = 0 and carry 1 to the next column
Carrying a 1 is equivalent to adding 1 to that column.Example : Add 14 and 10 in binary
1410 =111110
1010 = 1010
11000 = 2410
S. Sivasubramani EE101 - Digital
Binary Subtraction
0 - 0 = 0
0 - 1 = 1 and borrow 1 from the next column
1 - 0 =1
1 - 1 = 0
Borrowing a 1 from a column is equivalent to subtracting 1 fromthat column.Example : Subtract 5 from 8 binary
810 = 110100
510 = 0101
0011 = 310
S. Sivasubramani EE101 - Digital
1’s and 2’s complements
1’s and 2’s complements are mainly used to represent negativenumbers.Finding 1’s complement:1’s complement of a binary number is found by changing all 1s to0s and all 0s to 1s.Example :
1 1 0 0 0 Binary number
↓ ↓ ↓ ↓ ↓
0 0 1 1 1 1’s complement
S. Sivasubramani EE101 - Digital
Finding 2’s complement
The 2’s complement of a binary number is found by adding 1 tothe LSB of the 1’s component.Example :Find the 2’s complement of 11000.
1 1 0 0 0 Binary number
0 0 1 1 1 1’s complement
1 Add 1
0 1 0 0 0 2’s complement
S. Sivasubramani EE101 - Digital
Subtraction Using 2’s complement
Example : Subtract 5 from 8.Find 2’s complement of binary number corresponding to 5 and addwith binary number of 8. 2’s complement of 0101 is 1011.
10001011 +
10011Discard carry and the answer is 0011.
Example : Subtract 8 from 5.
01011000 +
1101Since there is no carry, the answer = -(2’s
complement of 1101) = - 0011
S. Sivasubramani EE101 - Digital
Binary Coded Decimal (BCD)
BCD means that each decimal digit, 0 through 9, isrepresented by a binary code of four bits.It is very easy to convert from BCD to decimal and vice versa.Only 10 combinations are used. The remaining 6combinations are invalid.
Decimal Digit BCD
0 00001 00012 00103 00114 01005 01016 01107 01118 10009 1001
Applications: Seven segmentdisplays use BCD codes.
Example: Digital clocks, digitalmeters.
S. Sivasubramani EE101 - Digital
BCD - Conversion
Example: Convert 25 and 100 to BCD.
2 5↓ ↓︷︸︸︷
0010︷︸︸︷0101
(a)
1 0 0↓ ↓ ↓︷︸︸︷
0001︷︸︸︷0000
︷︸︸︷0000
(b)
Example: Convert the BCD codes 10010101 and 01110010 todecimal.
1001︸︷︷︸ 0101︸︷︷︸↓ ↓9 5
(c)
0111︸︷︷︸ 0010︸︷︷︸↓ ↓7 2
(d)
S. Sivasubramani EE101 - Digital
Logic Gates - NOT Gate
It is also called as an inverter.
A F = A
Table: Truth Table
A F
0 1
1 0
1= High, 0= Low
S. Sivasubramani EE101 - Digital
Logic Gates - AND Gate
A
BF = A · B
For a 2 input AND Gate, output F is High iff A and B are High.
Table: Truth Table
A B F
0 0 00 1 01 0 01 1 1
1= High, 0= Low
S. Sivasubramani EE101 - Digital
Logic Gates - OR Gate
A
BF = A + B
For a 2 input OR Gate, output F is High if either A or B is High orboth A and B are high
Table: Truth Table
A B F
0 0 00 1 11 0 11 1 1
1= High, 0= LowS. Sivasubramani EE101 - Digital
Logic Gates - NAND Gate
The NAND Gate operation is opposite that of AND Gate.
A
BF = A · B
For a 2 input NAND Gate, output F is Low iff A and B are High.
Table: Truth Table
A B F
0 0 10 1 11 0 11 1 0
1= High, 0= LowS. Sivasubramani EE101 - Digital
Logic Gates - NOR Gate
The NOR Gate operation is opposite that of OR Gate.
A
BF = A + B
For a 2 input NOR Gate, output F is High iff A and B are Low.
Table: Truth Table
A B F
0 0 10 1 01 0 01 1 0
1= High, 0= LowS. Sivasubramani EE101 - Digital
Logic Gates - Exclusive-OR Gate
A
BF = A⊕ B = AB + AB
The output of an exclusive-OR gate is High only when the twoinputs are at opposite logic levels.
Table: Truth Table
A B F
0 0 00 1 11 0 11 1 0
1= High, 0= LowS. Sivasubramani EE101 - Digital
Logic Gates - Exclusive-NOR Gate
Exclusive-NOR is opposite that of Exclusive-OR.
A
BF = A� B = AB + AB
The output of an exclusive-NOR gate is High only when the twoinputs are at the same level.
Table: Truth Table
A B F
0 0 10 1 01 0 01 1 1
1= High, 0= LowS. Sivasubramani EE101 - Digital
NAND - Universal Gate
1 Invert (NOT)
F = AA
2 AND Gate
A
BF = A · B
F = A · B3 OR Gate
AA
BB
F = A · B = A + B
S. Sivasubramani EE101 - Digital
NOR - Universal Gate
1 Invert (NOT)
F = AA
2 AND Gate
AA
BB
F = A + B = A · B
3 OR Gate
A
BF = A + B
F = A + B
S. Sivasubramani EE101 - Digital
Logic Circuits
Any system/subsystem/arithmetic circuit can be expressed asfunctional blocks containing logic gates.There are two types of logic circuits.
1 Combinational logic : Outputs depend only on the presentinputs. Example: Logic gates, Code converters
2 Sequential logic : Outputs not only depend on the presentinputs but also on past inputs. Example: Counter
All digital systems are sequential logic circuits.
In EE101, we design combinational logic circuits.
S. Sivasubramani EE101 - Digital
Boolean Algebra
George Boole, an English mathematician, developed thisalgebra in 1854. That is why it is named after him.
Boolean algebra provides a mathematics of digital systems.
Boolean algebra is a systematic way of analyzing anddesigning the logic circuits.
S. Sivasubramani EE101 - Digital
Laws of Boolean Algebra
1 Commutative laws
A + B = B + A
AB = BA
2 Associative laws
A + (B + C ) = (A + B) + C
A(BC ) = (AB)C
3 Distributive Law
A(B + C ) = AB + AC
S. Sivasubramani EE101 - Digital
Rules of Boolean Algebra
A + 0 = A
A + 1 = 1
A · 0 = 0
A · 1 = A
A + A = A
A + A = 1
A · A = A
A · A = 0
A = A
A + AB = A
A + AB = A + B
(A + B)(A + C ) = A + BC
A, B, or C can represent a single variable or a combination ofvariables.
S. Sivasubramani EE101 - Digital
DeMorgan’s Theorems
1 The complement of a product of variables is equal to the sumof the complements of the variables.
AB = A + B
2 The complement of a sum of variables is equal to the productof the complements of the variables.
A + B = AB
S. Sivasubramani EE101 - Digital
Example
Use DeMorgan’s theorems to simplify the following expressions.
1
A(B + C )
2
(A + B)(C + D)
Solution:
1
A(B + C ) = A + B + C = A + B C
2
(A + B)(C + D) = (A + B)+(C + D) = AB+C D = AB+C D
S. Sivasubramani EE101 - Digital
Simplification using Boolean Algebra
1 Boolean algebra is used to simplify a particular expression toits simplest form.
2 A simplified boolean expression uses the fewest gates possibleto implement the given expression.
Example: (A + B)C + ABC
AC + BC + ABC
AC + BC (1 + A)
AC + BC
(A + B)C
S. Sivasubramani EE101 - Digital
Check yourself
Simplify. AB + AC + ABC
AB AC + ABC
(A + B)(A + C ) + ABC
AA + AB + B C + AC + ABC
A + AB + B C + AC
A + B C + AC
A + B C
S. Sivasubramani EE101 - Digital
Standard form of Boolean expressions
Any Boolean expressions can be converted into either of thefollowing two forms.
1 Sum of Products (SOP) FormExamples
ABC + ABC
A + B C + AC
2 Product of Sums (POS) FormExamples
(A + B + C )(A + B + C )
A(A + B)
S. Sivasubramani EE101 - Digital
Implementation of SOP
Example: AB + BCD
A
B
BCD
AB
BCD
AB + BCD
S. Sivasubramani EE101 - Digital
Implementation of POS
Example : (A + B)(B + C + D)
A
B
BCD
(A + B)
(B + C + D)
(A + B)(B + C + D)
S. Sivasubramani EE101 - Digital
Karnaugh Map
Karnaugh map provides a systematic way of minimizing theboolean expressions. If properly used, it will produce the simplestform possible.
1 It is an array of cells in which each cell represents a binaryvalue of the input variables.
2 The number of cells in a Karnaugh map is equal to the totalnumber of possible input variable combinations.
3 For 2 variables, no of cells is 22 = 4. For 3, 23 = 8 and so on.
4 The cells are arranged in such a way that there is a singlevariable change (Adjacency) between adjacent cells.
S. Sivasubramani EE101 - Digital
Karnaugh Map for 3-variables
BC
A00 01 11 10
0
1
AB C AB C AB CABC
AB C AB C AB CABC
Notice here, the cells are arranged so that there is a single variablechange between adjacent cells. It is called as Adjacency.
For example, 010 cell is adjacent to 011, 000, and 110.
010 cell is not adjacent 001, 111, 100, and 101.
S. Sivasubramani EE101 - Digital
Mapping of SOP in Karnaugh Map
Example: AB + AB
B
A0 1
0
1
1
1
Example : AB C + AB C + AB C + ABC
BC
A00 01 11 10
0
1
1 1
11
S. Sivasubramani EE101 - Digital
Simplification - Karnaugh Map
After mapping Sum of Products (SOP) in Karnaugh Map,1 Group the 1’s. For grouping use the following procedure.
1 A group must contain either 1, 2, 4, 8 or 16 cells. ( powers oftwo)
2 Always include the largest possible number of 1’s in a group.3 Each cell in a group must be adjacent to one or more cells in
that same group.4 Each 1 on the map must be included in at least one group.
The 1’s already in a group can be included in another group.2 Determine the minimum product term for each group.
1 For 2-variable map1 A 1-cell group gives a 2-variable term2 A 2-cell group gives a 1-variable term3 A 4-cell group gives a value 1.
2 For 3-variable map1 A 1-cell group gives a 3-variable term2 A 2-cell group gives a 2-variable term3 A 4-cell group gives a 1-variable term4 A 8-cell group gives a value 1
3 Sum all the terms to form the minimum SOP expression.S. Sivasubramani EE101 - Digital
Example
Let us simplify AB C + ABC + AB C + ABC
BC
A00 01 11 10
0
1
11
11
Minimum SOP expression
B
S. Sivasubramani EE101 - Digital
Check yourself
Simplify AB C + AB C + AB C + ABC
BC
A00 01 11 10
0
1
1 1
1 1
Minimum SOP expression
AB + AC
S. Sivasubramani EE101 - Digital
SOP expression from Truth Table
Consider the truth table for three input variables logic circuit.
A B C F
0 0 0 00 0 1 10 1 0 10 1 1 01 0 0 01 0 1 01 1 0 11 1 1 1
The output F is true for the followingcombinations. AB C , AB C , AB C andABC .These terms are called minterms.
F = AB C + AB C + AB C + ABC
It is called as Sum of Products (SOP)expression.
F =∑
m(1, 2, 6, 7)
m indicates minterm.
S. Sivasubramani EE101 - Digital
POS expression from Truth Table
Consider the same truth table.
A B C F
0 0 0 00 0 1 10 1 0 10 1 1 01 0 0 01 0 1 01 1 0 11 1 1 1
The output F is false for the followingcombinations. AB C , ABC , AB C and AB C .
F = AB C + ABC + AB C + AB C
By DeMorgan’s theorems,
F = (A+B+C )(A+B+C )(A+B+C )(A+B+C )
It is called as Product of Sums (POS)expression.
F =∏
M(0, 3, 4, 5)
M indicates maxterm.
S. Sivasubramani EE101 - Digital
Check yourself
SimplifyF =∑
m(1, 3, 4, 6) to minimum SOP.
BC
A00 01 11 10
0
1
1 1
1 1
Minimum SOP expression
F = AC + AC
S. Sivasubramani EE101 - Digital
Check yourself
SimplifyF =∏
M(0, 2, 5, 7) to minimum POS.
BC
A00 01 11 10
0
1
0 1 01
1 0 10
F = AC + AC
Minimum POS expression
F = (A + C )(A + C )
If simplified,
F = AA + AC + C A + C C
F = AC + AC
same minimum SOP expression...(see previous slide)
S. Sivasubramani EE101 - Digital
Don’t Care Conditions
In practice, in some applications the function is not specifiedfor certain combinations of the variables.In most applications, we simply don’t care what value isassigned to them.These combinations are called don’t care conditions.These conditions will provide further simplification of theBoolean expression.
Example: Map the Boolean function F =∑
(1, 3, 4, 6) that has thedon’t care conditions. d =
∑(0, 2)
BC
A00 01 11 10
0
1
1 1
1 1
X X
S. Sivasubramani EE101 - Digital
Combinational Circuit Design
Design procedure involves the following steps.
1 From the specifications given, identify the number of inputsand outputs.
2 Construct the truth table that defines the required relationshipbetween inputs and outputs
3 Map the minterms into Karnaugh map and obtain thesimplified Boolean expression for each output.
4 Draw the logic diagram and verify it manually.
S. Sivasubramani EE101 - Digital
Design - Example
Let us design a circuit with three inputs and one output for thefollowing condition.
The output is 1 when the binary value of the inputs is an evennumber.
Solution:
Let us name the inputs as A, B, and C and the output F .
Truth Table
A B C F
0 0 0 10 0 1 00 1 0 10 1 1 01 0 0 11 0 1 01 1 0 11 1 1 0
S. Sivasubramani EE101 - Digital
Design - Example (contd...)
K- mapBC
A00 01 11 10
0
1
1 1
1 1
F = C
Logic diagram
A
B
C F
S. Sivasubramani EE101 - Digital
Decoder
A decoder is a digital circuit that detects the presence of aspecified combination of bits on its inputs and indicates thepresence of that code by a specified output level.
It has N input lines and 2N output lines
Applications:
Decoders are used in computer to select input/output devices.
BCD-to-7-Segment Decoder
S. Sivasubramani EE101 - Digital
2-to-4-Decoder
Let us design.
It has 2 inputs and 4 outputs.
Depending on the input configuration, decoder will producehigh at specified output.
Table: Truth Table
Input Output
A B D0 D1 D2 D3
0 0 1 0 0 00 1 0 1 0 01 0 0 0 1 01 1 0 0 0 1
D0 = AB
D1 = AB
D2 = AB
D3 = AB
S. Sivasubramani EE101 - Digital
2-to-4-Decoder - Logic Circuit
A
B
D0 = AB
D1 = AB
D2 = AB
D3 = AB
S. Sivasubramani EE101 - Digital
Encoder
It converts familiar symbols like decimal to coded form likebinary or BCD.
It is just opposite to Decoder.
It has 2N input lines and N output lines.
Application:
Keyboard encoder : The ten decimal digits on the keyboardmust be encoded for processing by the logic circuitry. Whenone of the keys pressed, the decimal digit is encoded to thecorresponding BCD code.
S. Sivasubramani EE101 - Digital
Decimal-to-BCD Encoder
It has ten inputs (one for each decimal digit) and four outputscorresponding to the BCD code.
0
1
2
3
4
5
6
7
8
9
B0
B1
B2
B3
Decimal BCDDigit B3 B2 B1 B0
0 0 0 0 01 0 0 0 12 0 0 1 03 0 0 1 14 0 1 0 05 0 1 0 16 0 1 1 07 0 1 1 18 1 0 0 19 1 0 0 1
S. Sivasubramani EE101 - Digital
Decimal-to-BCD Encoder - Logic Circuit
1
3
2
45
67
8
9
B0 LSB
B1
B2
B3 MSB
S. Sivasubramani EE101 - Digital
Top Related