2.10. Hardware Abstractions Logic Gates¶
Time Estimate: 45 minutes
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.
- write expressions using logical operators
- evaluate expressions that use logic operators
- 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¶
Lecture
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.Role | Responsibility |
---|---|
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
- The word OR has different meaning in the following two sentences; which meaning corresponds to the Boolean OR gate?
- Choose either soup OR salad with your entree.
- Insurance benefits will be paid in case of accident OR illness.
- 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.
A B Z False False False True True False True True
- (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.) - (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?
- 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.
- A good place to start might be with this I-Programmer discussion of Boolean logic and its importance in computing.
- Here is a description of how transistors are used to build logic gates, a video about how transistors are made, and a video zooming into a chip.
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 |
Check Your Understanding
Complete the following self-check exercises.
- the gate will be TRUE (or ON) when either A or B is TRUE (or ON).
- OK, so you didn’t get it right this time. Let’s look at this as an opportunity to learn. An OR gate would be TRUE (or ON) when either A or B is TRUE (or ON).
- the gate will be TRUE (or ON) when both A and B are TRUE (or ON).
- the gate will be TRUE (or ON) when A is TRUE (or ON).
- OK, so you didn’t get it right this time. Let’s look at this as an opportunity to learn. For the AND gate to be TRUE (or ON) B would also have to be TRUE (or ON).
- the gate will be TRUE (or ON) when B is TRUE (or ON).
- OK, so you didn’t get it right this time. Let’s look at this as an opportunity to learn. For the AND gate to be TRUE (or ON) A would also have to be TRUE (or ON).
Q-2: An AND gate is an electronic component that takes two inputs, A and B, such that
- both inputs must always have the same value for the gate to be TRUE (or ON).
- Try asking a classmate for advice—s/he may be able to explain/suggest some ideas or recommend some strategies.
- both inputs must always be TRUE (or ON) for the gate to be TRUE (or ON).
- Try asking a classmate for advice—s/he may be able to explain/suggest some ideas or recommend some strategies.
- the gate would be TRUE (or ON) when either or both A and B are TRUE (or ON).
- both inputs must be FALSE (or OFF) for it to be TRUE (or ON).
- Try asking a classmate for advice—s/he may be able to explain/suggest some ideas or recommend some strategies.
Q-3: An OR gate is an electronic component with two inputs, A and B, such that
- RAM chip, motherboard, logic gate, physical circuit
- Let me add new information to help you solve this; a physical circuit is a low-level component.
- Physical circuit, motherboard, logic gate, RAM chip
- Let me add new information to help you solve this; a motherboard would contain RAM chips which would contain low-level logic gates.
- Physical circuit, logic gate, RAM chip, motherboard,
- Yes, that is correct.
- RAM chip, logic gate, physical circuit, motherboard.
- Let me add new information to help you solve this; a logic gate is made up of physical circuits.
Q-4: Which of the following lists arranges hardware components from the lowest to the highest abstraction level?
- True
- This is challenging, but rewarding! The circuit diagram contains more details about the OR gate's behavior, so it is less abstract than the OR-gate symbol.
- False
- Right. This is false because the circuit diagram contains more details about the OR gate's behavior, so it is less abstract than the OR-gate symbol.
Q-5: True or False. The symbol for an OR gate is less abstract than the circuit diagram that defines its behavior.
- True
- Yes. Because the symbol contains fewer details than the truth table it is more abstract.
- False
- Mistakes are welcome here! Try reviewing this; the symbol contains fewer details than the truth table so it is more abstract.
Q-6: True or False. The symbol for an AND gate is more abstract than the truth table that defines its behavior.
- The dictionary definition of the word 'chair'.
- Let me add new information to help you solve this. The definition contains details about chairs, so is not as abstract as the word 'chair' itself.
- The word 'chair' itself.
- That's correct. Good.
- A picture of a chair.
- Let me add new information to help you solve this. The picture contains details about a chair, so it is not as abstract as the word 'chair' itself.
- The chair itself.
- Let me add new information to help you solve this. The physical chair itself is very detailed and concrete. It's the very opposite of abstract.
Q-7: In general, which of the following is the most abstract when it comes to talking about chairs?
Sample AP CSP Exam Questions
- Input A must be true.
- This is correct!
- Input A must be false.
- Input A can be either true or false.
- There is no possible value of Input A that will cause the circuit to have the output true.
Q-8: Refer to the figure below.
- (onFloor1 AND callTo2) AND (onFloor2 AND callTo1)
- (onFloor1 AND callTo2) OR (onFloor2 AND callTo1)
- That's correct!
- (onFloor1 OR callTo2) AND (onFloor2 OR callTo1)
- (onFloor1 OR callTo2) OR (onFloor2 OR callTo1)
Q-9: An office building has two floors. A computer program is used to control an elevator that travels between the two floors. Physical sensors are used to set the following Boolean variables.
The elevator moves when the door is closed and the elevator is called to the floor that it is not currently on. Which of the following Boolean expressions can be used in a selection statement to cause the elevator to move?
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.