**CSE-221Digital Logic Design (DLD)** Lecture-2: Logic Operations & Digital Logic Gates P.B-Dr M.A.kashem(CS&E-221,TLDD2)

**Analog vs. Digital** V V +5 +5 1 0 1 Time Time –5 –5 Analog: values vary over a broad range continuously Digital: only discrete values P.B-Dr M.A.kashem(CS&E-221,TLDD2)

**Analog vs. Digital** • Analog devices process signal that can assume any value across a continuous range and produce results that are also in continuous form. • Digital devices process signals that take on only two discrete values such as 0 and 1 and produces output that can be represented by 0 and 1. • Examples • Analog Devices: solid-state devices TV (except for digital TV), Audio amplifier etc. • Digital Devices: Computer, CD player, digital TV, digital cellular phone, electronic calculator, and digital camera. P.B-Dr M.A.kashem(CS&E-221,TLDD2)

**Analog vs. Digital Systems ** Analog systems: • Limited precision, errors accumulate, drift • Interface circuits (i.e., sensors & actuators) often analog Digital systems: • More accurate and reliable • Readily available as self-contained, easy to cascade building blocks • Computers use digital circuits internally P.B-Dr M.A.kashem(CS&E-221,TLDD2)

**AND means that both conditions must be true in order for the** conclusion to be true Let’s look at the relationship between the semantic and logical operator known as the AND operator Consider: If the car is fueled AND the engine works, then the engine will start A B Output 0 0 0 0 1 0 0 0 1 1 1 1 AND Operator AND Operator Truth Table P.B-Dr M.A.kashem(CS&E-221,TLDD2)

**A** Output A B Output Inputs 0 B 1 0 0 1 0 1 0 1 1 1 1 Digital AND For digital logic: True = 1 is 5 volts False = 0 is 0 volts • We can build an electrical device that performs the logical AND operation on voltage equivalents of logic values • An AND gate has the electrical schematic: • Practice with the Excel spreadsheet OR Operator Truth Table OR Operator • Another basic operator is the OR • Consider: If I have cash OR a credit card, then I can pay the bill • OR works such that the output is true, if either of the two inputs is true P.B-Dr M.A.kashem(CS&E-221,TLDD2)

**A** A B Output Output Inputs 0 1 B 0 0 1 0 1 0 1 1 1 0 XOR (Exclusive OR) Operator • Let’s look at the relationship between the semantic and logical operator known as the XOR operator • Consider a biological example: If gender A XOR gender B, then reproduction is possible • XOR works such that output is activated (equal to one) if both inputs are of a different value • Try the Excel spreadsheet exercise • We can build an electrical device that performs the logical XOR operation on voltage equivalents of logic values • An XOR gate has the electrical schematic: P.B-Dr M.A.kashem(CS&E-221,TLDD2)

**AND gates can be built with any number of inputs** Consider the symbol for the 4-input AND gate F is trueonly when all the inputs are true (1’s) Using the Excel workbook “EE-WISE-Digital Lab”, open the “Digital Locks” worksheet, and test this circuit A B C D F Multi-Input AND Gate • All digital computers are built using only three gate types: AND, OR, and NOT P.B-Dr M.A.kashem(CS&E-221,TLDD2)

**1** AND 1 1 AND 1 1 AND 1 1 Digital Combination Lock • Using 3 two-input AND gates, we could build a combination lock that requires a four-digit code, specifically: 1 1 1 1 • The number of inputs could be increased by using more and more AND gates P.B-Dr M.A.kashem(CS&E-221,TLDD2)

**1** 0 AND 1 AND 1 1 1 AND 1 0 1 0 1 Digital Combination Lock • We could build a combination lock that only uses the AND gate, but that would be of little use since everyone would know our combination, namely 1 1 1 1 • To build a more interesting combination lock, we will utilize the NOT (inverter) gate • Let’s build a combination lock whose input (key code) combination is 0 1 1 0 • Is there any other combination that works? P.B-Dr M.A.kashem(CS&E-221,TLDD2)

**P.B-Dr M.A.kashem(CS&E-221,TLDD2)**

**P.B-Dr M.A.kashem(CS&E-221,TLDD2)**

**P.B-Dr M.A.kashem(CS&E-221,TLDD2)**