3. Digital Circuits In this unit, you will learn about Boolean algebra. You will also learn how to use Karnaugh maps. Finally, you will use Multisim Live to draw digital circuits. وزارة التعليم Ministry of Education 66 2024-1446 Learning Objectives In this unit, you will learn to: > Understand the basics of the digital circuit. > Define the rules of Boolean algebra. > Apply Boolean algebra to simplify functions. > Differentiate among logic gates. > Create logic functions by combining logic gates. > Apply Karnaugh maps to simplify logical designs. > Recognize the core hardware components of a digital circuit. > Define what integrated circuits (IC) are. > Simulate designed digital circuits with Multisim Live. Tools > Multisim Live

1: Digital Circuits

Digital Circuits

Learning Objectives

Tools > Multisim Live

Lesson 1 Digital Circuits Link to digital lesson www.ien.edu.sa Basics of the Digital Circuit Digital circuits are used to implement Boolean logic and operations on a system. The main difference between digital and electrical circuits is that electrical circuits operate with continuous signals, created by the electric current flowing through the circuit, while digital signals are "discrete," and take as input sequences of O's and 1's. Digital circuits are used in integrated circuits and microcontrollers to store information and perform logical functions in conjunction with an electrical circuit. The 2 main types of digital circuits are as follows: Combinational Circuits Combinational circuits take input values and produce output results based on the logical function that is implemented. The following are types of combinational circuit: > Multiplexers: Take multiple inputs from a digital source and output a single result value. > Demultiplexers: Take a single input value and output multiple result values. > Encoders: Convert a signal input into a coded binary result. > Decoders: Reconstruct the original signal produced by an encoder. Table 3.1: States of digital circuits State Binary numbers TRUE 1 FALSE 0 Table 3.2: Common voltage levels Logic level | Binary number Volts 5 Volt 1 5 logic 0 0 3.3 Volt logic 1 3.3 0 0 Sequential Circuits Sequential circuits take as inputs the outputs that were produced by previous iterations of the circuit. Examples of sequential circuits are the following: > Flip-flops: They are used for storing digital signal sequences. > Counters: They are used to time, track, coordinate and orchestrate other components of a digital circuit. وزارة التعليم Ministry of Education 2024-1446 INFORMATION Analog signals can be found everywhere in nature, but digital signals are man-made. The main difference is that analog signals are inputs that have variations in the frequency and amplitude of the waves. In digital signals, there is only an on/off state represented by ones and zeroes, also called binary code. 67

1: Digital Circuits

Basics of the Digital Circuit

Analog signals can be found everywhere in nature, but digital signals are man- made.

Boolean Algebra Boolean algebra is defined according to a set of two elements: {0, 1} It defines operations AND (•) and OR (+), which obey the following rules: If A, B belong to the set {0, 1}, then: A + B B+ A = Y A B B A = Y • The results (Y) of operations (+) and (•) belong to the set {0, 1}. Properties of the operation AND in Boolean algebra. A 1 = A . A 0=0 A. A = A — A A=0 • Properties of the operation OR in Boolean algebra. A+1=1 A+ 0 = A The distributive law of Boolean algebra. . A (B+C) A B+A.C A+ (BC) = (A + B) · (A + C) Double negative rule A + A = A A + A = 1 A = A Example If A = 0 then A = 1. While if A = 1 then A = 0. The rules mentioned apply exactly the same to the logic of the operations: Operation Expression AND A.B OR A+ B وزارة التعليم Ministry of Education 68 2024-1446 Logic gates may have more than two inputs, but they will always have one output. DeMorgan's Theory To get the complement of a complex representation, it is enough to change each element with its complement and each operation from AND to OR and OR to AND. Theorem • (A B C) = A + B + C - (A+B+C) = A B C •

1: Digital Circuits

Boolean Algebra

Example Let's see an example of a method using a truth table and Boolean algebra to prove the following relation: We create a truth table where rows represent variables of the functions and columns represent terms of the equation. Y = (A+B) (A+ C) = (A + B C) Input values The two columns are identical. This means that equality applies. A B C (A + B) (A + C) (B. C) (A + B) · (A + C) (A + B . C) 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 1 0 1 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 0 1 1 0 1 1 1 1 1 1 1 1 1 1 وزارة التعليم Ministry of Education 2024-1446 Now let's prove the function using the rules of Boolean algebra that we have learned. Y = (A + B) (A + C) = (A + B · C) Y = (A+B) (A + C) = A· A+A C+B A+B C . • (1 + C + B) = 1 . = A + A C+ B A+B C . • = A (1+C+B) + B.C = A·1 + B C . = (A + B C) • A.1 = A 69

1: Digital Circuits

Example

Logic Gates Logic gates are small electronic components that take a set of Boolean input values and output Boolean values that are determined by the ruleset of the gate. They apply Boolean operations to produce their result values. Each logic gate has a unique result set. Logic gates are combined to design more complex functions and integrated components. In this section we will analyze each type of logic gate. Logic Gate NOT A NOT gate accepts one input value and produces one output value. The NOT operator inverts the input. Input A Output NOT A A 0 1 Input 1 0 Logic Gate AND An AND gate uses two input values, which both determine the output. Y = A A Output Input A Input B Output A AND B Y=A.B 0 0 0 A 0 1 0 Input 1 0 0 1 1 1 B D A.B Output Logic Gate OR An OR gate has two inputs which both generate the output. Input A Input B Output A OR B 0 0 0 0 1 1 Input 0 1 1 1 1 وزارة التعليم Ministry of Education 70 2024-1446 A Y = A + B D B A + B Output

1: Digital Circuits

Logic Gate NOT

Logic Gate AND

Logic Gate OR

Logic Gate XOR An XOR, or exclusive OR, gate produces 0 if both inputs are the same, and 1 if they are different. Input A Input B Output A XOR B 0 0 0 0 1 1 1 0 1 1 1 0 Let's see examples with lamp circuits. Example A AND B The lamp will glow when both the series connected switches are closed. Input A Input B Lamp A AND B OFF OFF OFF OFF ON OFF ON OFF OFF ON ON ON Example A OR B The lamp will glow when either of the parallel connected switches is closed. Input A Input B Lamp A OR B OFF OFF OFF OFF ON ON ON OFF ON ON ☑ON ON وزارة التعليم Ministry of Education 2024-1446 Y = A + B A Input D A B Output B HilH A B Y A www Y B } > VW 71

1: Digital Circuits

Logic Gate XOR

Let's see examples with lamp circuits.

Example A XOR B The lamp will glow when both of its two. input terminals are at different logic levels with respect to each other. Input A Input B Lamp A XOR B OFF OFF OFF OFF ON ON ON OFF ON ON ON OFF 1 0 OB В Y A O 1 If the outputs of the logic gates OR, AND and XOR are connected with an input of a logic gate NOT, then new gates will be created. Input Logic Gate NAND A NAND gate inverts the result produced A by an AND gate. Input B Input A Input B Output NOT (A AND B) 0 0 1 0 1 1 1 0 1 1 1 0 وزارة التعليم Ministry of Education 72 2024-1446 www Y = A A A Output D₁ A B A.B Output AND NOT = NAND Y=A.B Input A B D A.B Output In most logic systems, NAND and NOR functions actually require fewer transistors than AND and OR gates.

1: Digital Circuits

The lamp will glow when both of its two input terminals are at different logic levels with respect to each other.

If the outputs of the logic gates OR,

Logic Gate NAND

Logic Gate NOR A NOR gate inverts the result produced Α by an OR gate. Input DAB A + B A + B Output Input A Input B Output NOT (A OR B) B 0 0 1 OR NOT = NOR Y = A + B 0 1 0 1 0 0 Input A A + B Output 1 1 0 Logic Gate XNOR An XNOR gate produces the inverse results of an XOR gate. This gate produces 0 if both inputs are different and 1 if they are the same. Input A Input B Output NOT (A OR B) 0 0 1 0 1 0 1 0 0 1 1 1 B A Input D ΑΘΒ А В Output B XOR NOT = XNOR Y = A + B Input A B D А В Output Table 3.3 shows the logical operations and expressions for each logic gate. Table 3.3: Logical operations and expressions Operation NOT AND OR XOR NAND NOR XNOR Expression A A.B A+ B АВ A.B A + B АВ هنة التعليم Ministry of Education 2024-1446 73

1: Digital Circuits

Logic Gate NOR

Logic Gate XNOR

Logical operations and expressions

When drawing a logic circuit for a function, it is important to start from the outputs and continue to the inputs. Let's look at the following example: Example Create the following function circuit: Y = A B+ A C 1 You must first create the logic gate OR at the output. AND A 1 B 2 Then you must create the logic 1 gates AND and AND2. 3 A Finally you must create the logic gates NOT₁ and NOT for A and C. 2 AND A 2 C A AND 1 B NOT₁ BO B A A وزارة التعليم Ministry of Education 74 2024-1446 C NOT, A AND C C 2 A B A.C A.B OR A. B D A B+ A C A C A.C OR OR A B+ A C • A B+ A C

1: Digital Circuits

When drawing a logic circuit for a function, it is important to start from the outputs and continue to the inputs. Let's look at the following example:

• Now we will look at how the function Y = (A + B) (A + C) is designed with logic gates and how we can simplify it using the distributive property to take the form it to Y = (A + B · C) to save gates. • Example OR₁ 1 A A + B B OR 2 A+ C C C A B B C AND B.C A AND Circuit 1 D Y = (A+B) (A + C) OR Circuit 2 Y = (A + B C) Observing the two circuits, we observe that in circuit 2 we have the same result as circuit 1 but with one gate less. INFORMATION In the process of designing electronic devices that use many logic gates, by simplifying the circuit we can save materials. وزارة التعليم Ministry of Education 2024-1446 75 75

1: Digital Circuits

Now we will look at how the function Y = (A + B) ⋅ (A + C) is designed with logic gates and how we can simplify it to Y = (A + B ⋅ C) to save gates.

Exercises 1 What is the main difference between digital and electrical circuits? 2 Which logic gate (e.g. A = 0 and B = 1)? outputs 1 only when it has different inputs 3 Match the items in the first column with those in the second. Operation NOT AND OR Expression A B . A + B A.B А В وزارة التعليم Ministry of Education 76 2024 -1446 XOR NAND A + B NOR A B XNOR A

1: Digital Circuits

What is the main difference between digital and electrical circuits?

Which logic gate outputs 1 only when it has different inputs (e.g. A = 0 and B = 1).

Match the items in the first column with those in the second.

4 Identify the names of these logic gates and complete the truth table, then write the Boolean expression for each of these logic gates and the Boolean algebra relationship between the entries (A,B) and the output (Y). Da I D وزارة التعليم Ministry of Education 2024-1446 A B Output 0 0 0 1 Y = 1 0 1 1 A B Output 0 0 0 1 Y = 1 0 1 1 A B Output 0 0 0 1 Y = 1 0 1 1 77

1: Digital Circuits

Identify the names of these logic gates and complete the truth table, then write the Boolean expression for each of these logic gates and the Boolean Algebra relationship between the entries

5 Convert the function Y = A (B + C) to a sum of least terms and draw a truth table. 60 Use Boolean algebra to convert the function Y = A [B+C (D + E)] its simplest form. 7 Use the function Y = A B+ A B to draw the circuit from the output to the inputs. وزارة التعليم Ministry of Education 78 2024 -1446 OR D Y A B+ A B

1: Digital Circuits

Use the function Y = A ⋅ B + A ⋅ B to draw the circuit from the output to the inputs.

Use Boolean Algebra to convert the function Y = A ⋅ [B + C ⋅ (D + E)] its simplest form.

Convert the function Y = A ⋅ (B + C) to a sum of least terms and draw a truth table.

8 Write the Boolean expression for each logic gate represented by the logic diagram below, using symbols. A B NOT C XOR D OR AND What is the output if A, B and C are all True (1)? A B C NOT وزارة التعليم Ministry of Education 2024-1446 XOR D AND OR 79

1: Digital Circuits

Write the Boolean expression for each logic gate represented by the logic diagram below, using symbols.