# 2.10. Hardware Abstractions Logic Gates¶

## 2.10.1. Introduction and Goals¶

In this lesson we will look at some additional examples of how the Big Idea of abstraction is used in computing. We will focus on low-level hardware abstractions, in particular, on logic gates, the fundamental computational building blocks of electronic circuits. We'll tak a first look "under the hood," so to speak, to see how computers process binary information.

Learning Objectives: I will learn to
• write expressions using logical operators
• evaluate expressions that use logic operators
Language Objectives: I will be able to
• describe varying levels of abstractions in hardware, including logic gates and flip-flops using target vocabulary, supporting details and examples
• explain logic gates using key vocabulary such as OR gate, AND gate, NOT gate, Boolean, and flip flop, out loud and in writing, with the support of vocabulary notes from this lesson

## 2.10.2. Learning Activities¶

### Logicly Activity

Logicly provides an engaging, hands-on learning environment for teaching logic gates and circuits. It provides some free online-demos of simple logic gates. To help solidify your understanding of the basic gates, click on the links below. In each case, review the truth table definitions and then play with the Live Example circuit to verify that it behaves as defined by the truth table.
NOTE: To create your own circuits you need go into Edit mode by clicking on the little widget on the bottom left of the Live Example frame, as shown in the picture. Then you can drag together components and put them together. If you do not see the Live Example, first click on the Adobe Flash Player link and then click on allow Run Flash.

• In an AND gate the output is TRUE (the light is ON) when both of its inputs are TRUE (or ON).
• In an OR gate the output is TRUE (the light is ON) when either or both of its inputs are TRUE (or ON).
• In a NOT gate the output is is TRUE (or ON) when its single input is FALSE (or OFF).

### POGIL Activity for the Classroom (20 minutes)

Break into POGIL teams of 4 and assign each team member one of the following roles. Record your answers using this worksheet. (File-Make a Copy to have a version you can edit.)
RoleResponsibility
Facilitator Uses the Logicly tool to implement the solutions agreed on by the team.
Spokesperson Reports the teams results.
Quality Control Records the teams solutions.
Process Analyst Keeps track of the teams progress and assesses its performance.

### Designing a Computational Circuit: Critical Thinking Exercises

1. The word OR has different meaning in the following two sentences; which meaning corresponds to the Boolean OR gate?
• Insurance benefits will be paid in case of accident OR illness.
2. Define 2 truth tables, one for each of the two meanings of OR that you discussed above. Your truth table should consist of 4 rows that together provide all possible values for inputs A and B and what the result Z would be. For example, A is "soup" and B is "salad" and Z is "soup or salad" for one of the meanings of or above.
ABZ
FalseFalse
FalseTrue
TrueFalse
TrueTrue

3. (Portfolio) The first sense of OR (soup or salad) is known as Exclusive OR and the second sense (accident or illness) is known as Inclusive-OR. Inclusive-OR is the same as Boolean OR. Exclusive-OR can be defined as:
(Either A OR B) AND (NOT (both A AND B)).

Use Logicly edit mode to construct the Exclusive-OR circuit. As suggested in the definition, you'll need to combine AND, OR, and NOT gates. The circuit should have 2 inputs and 1 output. Make sure your circuit behaves as defined by the truth table you created in part #2. (Hint: For this circuit you'll need 2 AND gates, 1 OR gate, and 1 NOT gate. Also, you should use switches, not buttons, for the 2 inputs.)
4. (Portfolio) Consider these three things: The OR gate (i.e., the physical circuit), the Boolean OR function (as defined by its truth table), and the OR symbol. How would arrange them from most abstract to least abstract? And what criterion would you use to determine their order?
5. Pictured here is a Logicly version of the flip-flop discussed in the lecture. A flip-flop is a basic memory circuit that stores a single bit -- either a 0 or 1. Implement this circuit in Logicly edit mode. NOTE that NOR gates (not OR gates) are being used in this circuit and that the inputs are Push Buttons (not switches). The light should turn on when you click the bottom button and turn off when you click the top button. Which memory state (a 0 or a 1) is represented by clicking the bottom button as seen in the image below?

### AP CSP Pseudocode Logical Operators

In MIT App Inventor and in the AP CSP pseudocode, the logical operators AND, OR, and NOT can be used to combine boolean expressions in programming, and they behave in the same way that the AND, OR, and NOT logic gates behave in computer hardware. The exam reference sheet provides the definitions for the following logical operators where the condition can be a single boolean value or a boolean expression made up of other values and operators.
• NOT condition: evaluates to true if condition is false; otherwise it evaluates to false.
• condition1 AND condition2: evaluates to true if both condition1 and condition2 are true; otherwise it evaluates to false.
• condition1 OR condition2: evaluates to true if condition1 is true or if condition2 is true or if both condition1 and condition2 are true; otherwise it evaluates to false.

## 2.10.3. Summary¶

In this lesson, you learned how to:

## 2.10.4. Still Curious?¶

Still curious about logic gates? There is much written about logic gates and lots of material available online.

## 2.10.5. Self-Check¶

### Vocabulary

Here is a table of the technical terms we've introduced in this lesson. Hover over the terms to review the definitions.

 transistor logic gate integrated circuit AND gate OR gate NOT gate flip flop RAM CPU

Complete the following self-check exercises.

## 2.10.6. Reflection: For Your Portfolio¶

Answer the following portfolio reflection questions as directed by your instructor. Questions are also available in this Google Doc where you may use File/Make a Copy to make your own editable copy.