### Digital circuit design

This exercise is a part of Educator Guide: Computer Chip Milestone Reached / View Guide

Purpose: Students will practice designing an integrated circuit that can accomplish a simple task. The activity will help students understand that digital circuits are composed of logic gates made up of transistors. Those logic gates provide output signals based on the input signals.

Procedural overview: Students will design an integrated circuit for a car that triggers a quiet alarm if the car’s lights are left on or a door is left open when the key is left in the ignition.

Approximate class time: 1 class period to complete the activity questions and circuit design.

Supplies:
Digital Circuit Design student activity guide
A projector for introducing the activity (optional)

###### Directions for teachers:

For a general introduction to computer chips and their design, students should read the Science News article “Computer chip milestone reached.” Review answers to any relevant comprehension questions before beginning the activity.

If a projector is available, open Image 1, “Symbols and truth tables for logic gates” so students can view it on the screen; if a projector is not available, students can find the image in their activity guide.

Explain to students that a computer chip contains many transistors. Review the information in the article that transistors have “on” and “off” states. In the on state, current is flowing through the transistor. In the off state, current is not flowing through the transistor. The on state is coded with the value “1,” while the off state is coded with the value “0.” This binary code (0s and 1s) makes up all computer data.

Explain that transistors are used as building blocks to build small circuits that perform logical operations. These circuits, called Boolean gates or logic gates, test yes/no type questions (such as “Is one of the lights on?” or “Are both lights on?”) to determine an outcome. Each gate sends along current (if the answer is yes) or doesn’t (if the answer is no) depending on the results of the test it is performing. These gates, which contain one or more transistors, are then used to build larger circuits that perform highly complex operations.

There are seven basic types of logic gates that change one or two binary value inputs (1s and 0s) into a single binary value output (also 1s and 0s). For example, an AND gate checks that both inputs are 1s (on) and if so, outputs a 1 (on). An OR gate checks that either input is a 1 (on) and if so, outputs a 1 (on). A NOT gate changes the input binary value to the opposite binary value as an output (either from a 0 to a 1, or from a 1 to a 0).

The names, symbols and tables of input and output values of the gates are shown in Image 1. Input values, labeled A and B, are on the left of the symbol, and the single output value is on the right of the symbol. There is another gate used in circuits, the buffer gate, which does not perform a logic operation. This gate does not change the input value, but is instead used to boost signal strength when needed.

Briefly review the seven kinds of logic gates and the buffer gate with your students, being sure to review the NOT, AND and OR gates in detail. For each, review the truth tables so that students understand that a gate requiring one type of input has two possible input values (0 and 1). A gate with two types of inputs, however, has four possible combinations of input values (0,0; 0,1; 1,0; and 1,1). These combinations are represented vertically in the truth tables, with the output value that results from each combination in the final row. Explain that even though there are different ways of achieving the outputs, there are only two possible output values (0 and 1). Then, to give students an example of how logic gates are used in a task, describe the example given in Image 2: “Street lights turn on computer chip.”

In this example, the OR gate’s input types are “day or night” and “raining or not.” If it is night (1) or it is raining (1), the output will be street light on (1); since an OR gate is used, it does not need to be both night and raining. The NOT gate’s input is “light outside.” If it is not light outside (0), the output value will be 1. Finally, the two previous output values are combined in an AND gate. If it is not light outside (1) and it is either night or raining (1), then the output value will be 1 and the street light will turn on. Since this final gate is an AND gate, it must be both dark out and nighttime or raining for the street light to turn on.

In the activity, students will use logic gates to design a simple computer program. The computer program should turn on a quiet alarm if a vehicle’s lights are on or a door is open when the key is left in the ignition. Introduce the activity and the goal for the circuit design to students.

###### Directions for students:

Image 1 in the Full Guide pdf shows basic logic gates used in computer chips and Image 2 shows how these logic gates can be connected to form a simple program. After reviewing the general information about the symbols and tables below with your teacher, answer the questions that follow. The questions will help you understand the general aspects of the gates below. When needed, use an additional resource to find background information.

Background questions

1. The symbols for both the AND and the NOT gates start with two lines on the left but end with one line on the right. What does this tell you about the inputs and outputs?

The two lines on the left represent the two inputs, and the one line on the right represents the one output.

2. The symbol for the NOT gate has only one line on the left and one line on the right. What does this tell you about the gate?

The NOT gate has one input and one output.

3.  What kind of data are used in the gates?

The data are digital, represented as 1s and 0s.

4. How can the data used in gates be transmitted by transistors in circuits?

A 1 means current is flowing and 0 means no current is flowing.

5. The table accompanying each gate in Image 1 is called a “truth table.” What does a truth table tell you?

The output value based on all possible combinations of input values.

6. Which gates are a combination of two other gates? How did you determine this?

The NAND gate is a combination of the AND and NOT gates. The NOR gate is a combination of OR and NOT gates. The XNOR gate is a combination of XOR and NOT gates. The names, truth tables and symbols all provide clues. For example, NAND looks like a combination of NOT and AND. In the image, the D shape indicates AND and the small circle indicates NOT, so together they are NOT and AND. In the truth table the output value is 0 (NOT) if both input values A and B (AND) are 1.

7. Decision trees are a model of possible decisions and their outcomes. An example of a decision tree is below. How are circuits that use logic gates similar to decision trees? How are they different?

Both circuits that use logic gates and decision trees show a series of steps (either actions or questions with answers) to determine an outcome. Logic gates start with any possible combination of input values on the left and reduce to a single output value on the right, while decision trees start with one question at the top and expand to show all possible outcomes underneath.

Circuit design

In this activity, you will use logic gates to design a simple computer program. The computer program should start a quiet alarm if a vehicle’s lights are on or a door is open when the key is left in the ignition. Table 1 shows the binary values for the different types of inputs and outputs. To begin designing the program, first think about how you would separate the program into separate steps and then think about the circuits for those steps. Note that for the alarm to be turned on, the binary output of the final gate must be 1.

Table 1: Binary values for car actions

8. Which data will be the inputs for the car circuit you will design?

The input of the circuit is all the actions and their values in Table 1 except for “quiet alarm on” and “quiet alarm off.”

9. Which data will be the outputs of the circuit you will design?

The outputs of the circuit are the actions “quiet alarm on” and “quiet alarm off” and their binary values.

10. For a circuit that determines if the running lights were on when the key was left in the ignition, what would the inputs be? What would their binary values have to be to turn the alarm on?

The inputs would be the key and the running lights. They would both have to be 1 for the alarm to go on.

11. Complete the truth table that shows these input and output values, and draw its logic gate.

I would use an AND gate.

12. For a circuit that determines if either the running lights or the interior lights were on, what would the inputs be? What would their binary values be to make the alarm go on?

The inputs would be the running lights and the interior lights. Either one would have to be 1 for the alarm to go on.

13. Complete the truth table that shows these input and output values, and draw its logic gate.

I would use an OR gate.

14. For a circuit that determines if the door was open when a key was left in the ignition, what would the inputs be? What would their binary values be to make the alarm go on?

The inputs would be the key and the door. The key would have a value of 1, but the open door has a value of 0.

15. If you wanted to use an AND gate to combine these inputs to turn the alarm on (1), what other gate would you have to use first? Why?

For an AND gate to produce the output of 1, both inputs must be 1 as well. However, the open door has a value of 0. I would need to use a NOT gate to transform the open door’s value of 0 into a 1. Then I would have two 1s for the inputs and I could use the AND gate.

16. Create the truth tables for your two gates that show the input and output values, and draw their logic gates.

NOT gate:

AND gate:

17. Now think about how to combine these functions into a single program that could be built on one computer chip. Combine the three types of circuits you just drew to create a single computer chip that will turn on the quiet alarm if the key is in the ignition while the door is open or any of the lights are on.

Student answers will vary; a sample answer is given in the Full Guide pdf, but other designs are possible since there are multiple possible positions for the OR gate. Students should combine their three types of circuits.

18. Brainstorm with a partner another way to design a circuit to create the same alarm under the same circumstances. (Hint: Doing this could require rearranging the gates, using more or fewer gates or using different gates.) Draw the logic gates you would use in your new design and how they connect to each other.

Student answers will vary; a sample answer is given in the Full Guide pdf, but other designs are possible. If students struggle with this task, state the problem in words to help students identify the gates they can use. Lead the students to understand that since the final output depends on having running lights, interior lights or the door open and having the key in the ignition, any successful circuit they draw will require at least one OR gate and at least one AND gate to turn on the alarm.