CS 354 Computer Organization and Systems Fall 2019 

Opening the Gate: Exploring the Electronics at the Heart of Modern Computers

Learning Goals and Objectives

  • Basic of electronic circuits
  • Basic of transistor operations
  • Understand how logic gates can be created using simple electronic circuits
  • Appreciate the conceptual equivalence between truth tables, logical expressions, and logic circuits
  • Appreciate the importance of transistors in modern computers
  • Gain an appreciation for the discrete physical components at the low end of the abstraction hierachy and the modular conceptual design of modern computer architecture

Parts List

parts

  • 1 Breadboard (Twin Industries: TW-E41-102B)
  • 1 Wire Kit with wires (Twin Industries: TW-E41-102B)
  • 3 AA Batteries
  • 1 Battery Holder (Memory Protection Devices: BH3AA-W-ND)
  • 3 Light Emitting Diodes (LEDs) with integrated resistor (Avago Technologies: HLMP-1600)
  • 10 Transistors (Fairchild Semiconductor: BS170/MMBF170 N-Channel FET)
  • 10 10KOhm Resistors (YAGEO: CFR-25JB-10K)

Breadboards and Wiring

  1. Basic Assembly
    1. Connect four rubber feet from the wiring kit to the corners of the breadboard plate.
    2. Connect the 3 binding posts found in the wiring kit to the breadboard plate. Place the black binding post in the hole labeled Va the red binding post in the hole labeled Vb, and the green binding post in the third hole.
  2. Breadboard
    breadboard
    1. The breadboard (or protoboard) is a tool for circuit design and testing. One can quickly assemble electronic circuits by easily connecting electronic components using the internal wiring of the breadboard and jumper wires. Each group of 5 holes (or sockets) is connected inside the board. On the top and bottom of the board, note there are two sets of two rows of holes. One is red and labeled (+) and the other is blue and labeled (-). In each pair, all the red holes are connected together. Likewise, each set of blue holes is connected. These are called busses and are most commonly used to allow you to easily get power to the electronic components. Some of the connectivity is highlighted in the above image.

Basic Circuits and Batteries

circuit

Electricity is the flow of electrons in materials from a positively charged region to a negatively charged region. Current, measured in amps (A), is the amount of electrons flowing in a circuit. Common metals used in electrical circuits such as tin, copper, gold, and tungsten easily conduct electrify and are called conductors. Materials like air, glass, and plastic do not easily conduct electricity and are called insulators. Elements such as Silicon and Germanium are called semiconductors, because they can be either insulators or conductors, depending on some external charge, temperature change, or incident light.

Voltage, measured in Volts (V), is the potential for current to flow from one part of a circuit to another. Certain electronic components restrict or break the flow of current in circuits. The voltage difference across an electronic component governs the amount of electricity that will flow through the component.

Picture of the battery holder. Picture of three typical AA batteries. Schematic figure for a battery.

Batteries store electricity that is released through a chemical reaction. A single AA battery has a voltage of 1.5 V and can deliver an amperage of 1 A for 1-2 hours. Our battery holder connects three AA batteries in series (end-to-end) to provide a combined voltage of 4.5 V. Batteries are represented in circuit diagrams as a shown in the figure on the above right.

Electrical circuits control the flow of current to perform a desired task. The flow of electricity is controlled by electronic components which comprise an electronic circuit. A path for current flow must exist between the positive and negative sides of the batteries. If no such path exists, the circuit is said to be an open circuit and no current will flow. In circuit diagrams, lines are used to represent paths connecting electronics components (as will soon be illustrated).

warning In building circuits, avoid creating a short circuit, where electricity can flow between the positive and negative ends of the batteries without passing through any intermediate electronic components. This can lead to shortened battery life, destroyed components, or even fire from the excess heat caused by the excessive flow of electricity. It is very easy to create a short circuit, so wire your circuits with the battery pack disconnected from the breadboard. Double check your wiring before connecting the battery. If you do see LEDs on, disconnect the power and double check your circuit.

Diodes, LEDs, and a Simple Circuit

Picture of a typical diode. Schematic figure for a diode.

A diode is an electronic component that restricts the flow of electricity to only flow in one direction, similar to the way a one-way door, turnstile, or check-valve only allows a one-way flow. Diodes have two electrodes, typically connected to a cylindrical housing containing a semiconductor with a P region on the positive side (called the anode) and an N region on the negative side (called the cathode). See the diagrams above to see an example picture of a diode and how a typical diode is represented in electronic circuits. The cathode side is commonly labeled with a line.

Picture of a typical LED. Schematic figure for an LED.

A Light Emitting Diode (LED) is a special diode that emits light, based on the observation that as an electron loses energy going from the P region to the N region in some semiconductors, a visible photon is emitted with the same energy as the energy change in the electron across the P-N junction. Rather than a cylindrically symmetric shape, LEDs typically have two parallel electrodes with the longer leg corresponding to the anode (positive) side and a flattened region on the cathode (negative) side. LEDs are fun because they bring life to electronic circuits by letting us see where there is a flow of electricity. See the diagrams above to see an example picture of a LED and how a typical LED is represented in electronic circuits.

simple LED circuit

Our LEDs have a combined resistor to reduce the amount of current flowing through the device (more on resistors in a moment). Normally you would always need an additional resistor to control the current flow through the LED to control light output and to avoid damage.

Build the circuit shown in the diagram on the right. The easiest way to do this is to connect the battery wires to the corresponding terminal blocks. Using jumper wires, connect the positive and negative bus lines to the terminal blocks. Simply place the LED between a positive and negative hole pair on the bus lines. Avoid spreading the electrodes of the LED too far apart (if at all). When the battery is connected, the LED should glow. Note that most of the light from the LED is emitted from the top and not much is visible from the sides. Observe that the LED will not glow if it is connected in the opposite direction.

Congratulations! You have just created a simple battery tester! Note this also serves as an indicator that the circuit is "ON", so you should leave this LED in place for all of the following experiments to help troubleshoot your experiments.


Resistors

Picture of a typical resistor. Schematic figure for a resistor.

simple resistor circuit

A resistor is an electronic component that inhibits the flow of electricity, typically producing heat as a byproduct. Electric heaters, stoves, and ovens work on this principle. Like diodes, resistors have two electrodes typically connected to a cylindrical housing. Unlike diodes, resistors are not directional, so they can be wired in either direction. The amount of resistance is measured in Ohms (denoted with a capital omega). See the diagrams on the right to see an example pictures of a resistor and how a typical resistor is represented in electronic circuits.

At the far left portion of your breadboard, build the circuit shown in the diagram on the right. When the battery is connected, the LED should glow very faintly (you may need to shield the ambient room light or dim the room lights to see the faint glow of the LED. The reason the glow from the LED is now much fainter is because the resistor has reduced the amount of voltage difference across the electrodes of the LED, thereby reducing the current flowing through the LED.


Circuit Design and Layout

It will help you build these cicuits if you keep them as compact horizonally as possible. This means use a few columns as possible and use the shortest jumper wires you can to connect components. Laying the jumper wires for a circuit flat to the board will help you identify individual circuits. As you build complex circuits out of smaller modular components, connect these with longer jumper wires that loop rather than lay flat to help distinguish them from the intenal circuitry of the subcircuits.

Transistors

Picture of the nMOS-FET transistor we will use, with the three electrodes labeled for source (S), drain (D), and gate (G). One immediate characteristic of transistors is the three electrodes. Schematic figure for a nMOS-FET transistor with the three electrodes labeled for source (S), drain (D), and gate (G). These labels are typically not indicated in the circuit, only the source is indicated with a triangle.

A transistor is an electronic component that uses a semiconductor to either enable or inhibits the flow of electricity, based on the voltage of a third input signal. As we saw in the video Transistorized, the first transistor was a point-contact transistor made from germanium and gold contacts. Today, transistors are most commonly made from silicon. We are using Field Effect Transistors (FETs) with an N-channel, in which a positive voltage on the gate electrode will pull electrons near it, allowing current to flow between the source and drain regions, as described in the videos we watched. See the figure above to see an example picture of a transistor and how a typical transistor is represented in electronic circuits.

transistor circuit transistor circuit
Transistor circuit with amplification. The LED should be brighter than in the simple resistor circuit. Transistor circuit with no amplification. The LED should be completely off.

Build the circuit in the above left figure to allow the current from the resistor to connect to the gate of the transistor. This small signal is amplified in the transistor, effectively allowing current to pass to the LED and turning it on. If you connect the gate to the negative bus, the LED will turn off. The behavior of the LED is unpredictable when the gate is not connected. When you have a working circuit, feel free to repeat Walter Brattain's famous exclamation "This thing's got gain!"

warning

It is imortant to always use a resistor in the circuit on either the source or drain electrodes to limit the flow of electricity flowing through the transistor. Note that the simple LED circuit does contain a resistor because it is built into the LED we are using for this project. If too much current flows through the transistor, there is a chance you will permanently damage it and it will fail to function correctly. This may be accomapanied with heat, smoke, or fire. Should you be concerned if a transistor is bad, you can always swap it into this simple LED circuit to test it.

In the subsequent experiments, you will take the output of the new circuits you create and connect them to the gate in this circuit to amplify the output signal. You may want to attach a small jumper wire to an bank of holes adjacent to the location of the components on the breadboard to facilitate making future connections.

You can also use this circuit to test a transistor to see if it is functioning correctly. This may be useful if your transistors get hot enough to smoke or if you want to rule out a bad transistor when testing a circuit.


Modularity

modular LED circuit As you build circuits, there is a lot to connect (physically and mentally)! One conceptual tool you can use is modularity. Rather than looking a large diagram with lots of very small components, think about groups of components having specific functions. For example, the circuit you just built can be thought of having power inputs (+ and -) and one signal input. This is shown in the figure on the right, where the yellow box contains the LED circuitry. In this case the circuit has only two components and therefore is very simple. However, thinking about this circuit in this manner will allow you to focus on the connections that allow it to interface with other modular entities.

This modularity is an example of a powerful mental tool called abstraction. Computer scientists use abstraction all the time to help manage complexity. Modern integrated circuits have nearly a billion transistors in one big circuit. Understanding the complexity of such a circuit would be impossible without abstraction.

Representation of Boolean Logic Values using Electricity

We conceptually think of information on computers represented by a pattern of binary digits or simply bits A binary object has two states, most commonly 0 and 1, but often seen as True and False, or High voltage and Low voltage. In our experiments we will represent a high voltage as a 1 and a low voltage as a 0. Logically, we will think of a high voltage representing a 1 and a low voltage representing a 0.

Electronic circuits can be used to implement functions that combine variables using Boolean logical operators (NOT, AND, OR, NOR, NAND, and XOR). These operations are Named for the mathematician George Boole, who published An Investigation of the Laws of Thought in 1853. These operations form the basis of all electronic processing on modern computers as we will see during this course.

Logical NOT gates

A NOT A
0 1
1 0
Truth table for the logical NOT operator. Schematic figure for a logical NOT or inverter. Schematic circuit diagram for a NOT gate built using a transistor and a resistor.

Construct a NOT gate based on the circuit diagram shown on right. Test your circuit by connecting the output to the input of the simple amplification circuit from the previous step. Use a jumper wire to control the input to the circuit by alternatively connecting it to either the positive or negative bus. You should see the LED light up (0) when the negative (1) input is selected and the LED should be off (0) when the positive (1) input is selected. When no input is connected, the output is unpredictable.


modular NOT circuit

As before, you can think about the NOT circuit in a modular manner as you did with the LED circuit. It has two power inputs (+ and -), one signal input (A) and one signal output (A). This conceptual box is shown on the right. Note the input and output sides are reversed, but the internal organization remains identical to the NOT circuit described above. This modular conceptual model will help you construct more complicated circuits.


Logical NAND and AND Gates

A B C = A NAND B
0 0 1
0 1 1
1 0 1
1 1 0
Truth table for the logical NAND operator. Schematic figure for a logical NAND. Schematic circuit diagram for a NAND gate built using two transistors and a resistor.

The NAND gate is logically equivalent to a logical AND followed by a NOT. Construct aNAND gate based on the circuit diagram shown on right. As before, connect the output of the NAND gate to the input of your amplification circuit (disconnect the NOT input). To test your circuit, you will need to jumper wires to connect to the positive and negative bus lines. There are four possibilities to test because there are two inputs with two possible values for each input. When no input is connected, the output is unpredictable.


modular LED circuit

As before, you can think about the NAND circuit in a modular manner as you did with the LED and NOT circuits. It has two power inputs (+ and -), two signal inputs (A and B) and one signal output (C). This conceptual box is shown on the right. Note the input and output sides are reversed, but the internal organization remains identical to the NAND circuit described above.

Note this modular circuit is very similar to the logical gate schematic for the NAND gate shown above. Thinking of this circuit in this manner will help you construct an AND gate.


A B C = A AND B
= NOT (A NAND B)
0 0 0
0 1 0
1 0 0
1 1 1
Truth table for the logical AND operator. Schematic figure for a logical AND. Schematic circuit diagram for an AND gate built using a NAND gate and a NOT gate.

Use the NOT and NAND gates together to construct a working AND gate by simply connecting the output of the NAND gate to the input of the NOT gate. Test this circuit as you did the NAND gate. This type of circuit where two or more logic gates are used in a circuit is called a combinational logic circuit. This semester we will see how elaborate combinational circuits are used in modern computers to perform nearly every function of the CPU.

Logical NOR and OR Gates

A B C = A NOR B
0 0 1
0 1 0
1 0 0
1 1 0
Truth table for the logical NOR operator. Schematic figure for a logical NOR or inverter. Schematic circuit diagram for a NOR gate built using two transistors and a resistor.

As you did for the NAND gate, construct a NOR gate based on the circuit diagram shown above. The NOR gate is logically equivalent to a logical OR followed by a NOT. Test this circuit as you did the NAND gate.

A B C = A OR B
= NOT (A NOR B)
0 0 0
0 1 1
1 0 1
1 1 1
Truth table for the logical OR operator. Schematic figure for a logical OR. Schematic circuit diagram for an OR gate built using a NOR gate and a NOT gate.

modular LED circuit

As before, you can think about the NOR circuit in a modular manner as you did with the LED, NOT, and NAND circuits. It has two power inputs (+ and -), two signal inputs (A and B) and one signal output (C). This conceptual box is shown on the right. Note the input and output sides are reversed, but the internal organization remains identical to the NOR circuit described above.

Note this modular circuit is very similar to the logical gate schematic for the NOR gate shown above. Thinking of this circuit in this manner will help you construct an OR gate.

As you did in creating an AND gate, use your NOT and NOR gates together to construct a working OR gate. Test this circuit as you did the other gates.


Exclusive OR (XOR) Gates

A B C = A XOR B
0 0 0
0 1 1
1 0 1
1 1 0
Truth table for the logical XOR operator. Schematic figure for a logical XOR.

Show the XOR operations (A XOR B) is logically equivalent to ((A OR B) AND (NOT (A AND B))) by completing the corresponding truth table below.

A B A OR B A AND B NOT (A AND B) (A OR B) AND (NOT (A AND B)) A XOR B
0 0          
0 1          
1 0          
1 1          

Recall the two laws of DeMorgan:

  • (NOT (A AND B)) = A NAND B = (NOT A) OR (NOT B)
  • (NOT (A OR B)) = A NOR B = (NOT A) AND (NOT B)

Create a logical expression that is equivalent to an XOR operation using only NOT, NAND, and NOR operations and prove its correctness using a truth table.

Draw the schematic diagram of a circuit that performs an XOR operation using only NOT, NAND, and NOR gates using your logical expression from above.

Construct an XOR circuit based on your schematic from above.

Deliverables

You must show me the correctly working circuits you have assembled. See the grading rubric.
  1. Working LED circuit
  2. Working resistor circuit
  3. Working transistor circuit
  4. Working NOT circuit
  5. Working NAND circuit
  6. Working AND circuit
  7. Working NOR circuit
  8. Working OR circuit
  9. XOR truth tables
  10. XOR schematic
  11. Working XOR circuit

Further Explorations for Fun

  1. Show all logical gates can be made using only NAND gates.
  2. Show all logical gates can be made using only NOR gates.
  3. What is the minimum number of transistors required for an XOR circuit?
  4. What is the minimum number of transistors required for a general circuit?
  5. What is the minimum number of connections required for a general circuit?
  6. What is the minimum number of logical operations required for a general logical computation?
  7. Can you build a 3 input AND gate having an output of 1 if and only if all inputs are 1?
  8. Can you build a 3 input OR gate having an output of 0 if and only if all inputs are 0?
  9. Does adding more transistors make a circuit faster or slower?
  10. Take Physics 245: Electronics!

References

  1. Transistorized!
    1. Semiconductors from the Transistorized! website.
    2. Field Effect Transistor from the Transistorized! website.
  2. An Investigation of the Laws of Thought by George Boole from Project Gutenberg.


Copyright © 2019, David A. Reimann. All rights reserved.