Lab 3: Switching Expressions

Contributed to by Instructors Dr. Younis, Dr. Phatak, and dedicated TAs.
Updated Sept 15 2021 Robucci

Table of Contents



Objective and Overview

In this laboratory, you will learn to use AND/OR gates by implementing two equal logical expressions and verifying the equivalence (same inputs in both circuits should result in same output). You will verify that A(B + C) = AB + AC

You will use two ICs, a Quad 2-Input AND Gate IC and a Quad 2-Input OR Gate IC, to construct this circuit. DIP (dual inline packaged) switches and resistors will be used to provide inputs. LEDs and resistors will be used as output state indicators.

Required Equipment

Discussion

In lecture you have learned about binary arithmetic. It is important to understand how binary arithmetic functions are implemented using logic gates, so that you can learn to design your own implementations. In this lab you will learn to build simple circuits from physical logic gates and test these circuits to verify functionally.

Digital Design of Complex Functions Using Logic Gates

Binary arithmetic functions can be used to describe complex operations. For example, in the image below a depiction of an 8-bit binary adder is shown.

While it is resonable to “breadboard” such a circuit, when one finds themselves in need of a common digital operation, such as addition, it is wise to see if an integrated circuit already exists. For instance, a 4-bit adder is available as an integrated circuit, 74LS83: 4-bit Binary Full Adder

Connection Diagram

Truth Table

Logic Diagram

As you continue studies in digital design be sure to take note of and familiarize yourself with common circuits and functions, such as adders encoders, multiplexers, and shift registers. Starting with the 74LS series ICs is a good start. These types of common circuits become the the building blocks of even more complex circuits. More complex circuits are now commonly implemented in single custom-designed ICs, VLSI (Very large Scale Integration), and Field-Programmable Gate Arrays (FPGAs), but the libraries for circuit implementations and the physical makeup of these devices are still commonly composed of soon-to-be familiar digital building blocks that you will learn in this course. Since they are common, work has been done to optimize their design and implementation, which you and other designers can leverage. In the case of breadboard implementation, one can also expect that an integrated circuit implementing an addition will be faster and use less power than a breadboard implementation of addition built from individual gates. However, to implement new custom circuitry and learn to build new digital building blocks in new technologies it is important for you to understand how to design with simple digital gates.

Manipulating and Mapping Boolean Functions towards Logic Gate Implementation

Boolean operations/operators may refer to Boolean Set Operations or Boolean Aritmetic Operations.

The Boolean set uperation for AND, the intersection, is ∩\cap, which is analaous to the boolean algebra multiplication ⋅\cdot.
The boolean set uperation for OR, the union, is ∪\cup, is analagous to the boolean algebrea addition ++.

The following an example of the distributive property, in the context of set algebra. Algebra of sets

(A∩(B∪C))≡(A∩B)∪(A∩C)(A \cap ( B \cup C)) \equiv (A \cap B) \cup (A \cap C)

In boolean algebra the analogous equivalency is the following

(A⋅(B+C))≡(A⋅B)+(A⋅C)(A \cdot ( B + C)) \equiv (A \cdot B) + (A \cdot C)

A Logic Gate is an idealized Boolean Function. It performs a logical operation on 1 or more inputs, producing 1 output. Each kind of gate is associated with a distinctive shape/symbol, which is used for simple drawings and diagrams.

The following depicts other common logic gates, also sometimes called logic primatives.

By understanding the relationship of complex functions to truth tables and basic logic gates, one can learn to implement complex functions in physical circuits. By understanding the manipulation the these formulations, such as through Boolean algebra and various properties, one can find multiple possible implementations and learn to map a complex function to a desired set of building blocks or specific logic gates. Such a manipulation of a Boolean expression allows you to create of form that is directly mappable to available logic gates in a given technology. You can eventually learn to manipulate Boolean expressions to minimize size, area, or power of a circuits in later courses.

Lab Circuits

In particular, for this lab you will practice using logic gates by implementing the following Boolean operations:

Implementation 1

(A⋅(B+C))(A \cdot ( B + C))

Implementation 2

(A⋅B)+(A⋅C)(A \cdot B) + (A \cdot C)

In this lab, we will build these distinct functions, sharing only the inputs, and operating in parallel. The output of each circuit should be equivalent for all possible inputs state, meaning that the circuits are functionally equivalent.

The Pinouts for 7408 IC (AND gates) and 7432 IC (OR gates) are shown here:

You will only need to use 3 AND gates and 2 OR gates from these IC’s.
Since the two expressions are 3-input functions, you will need to test 8 combinations of inputs.

The inputs will be generated the same as before. We will call the generated inputs A, B and C.

Extended Discussion

Though you wont be building an addition circuit in this lab, it is worth the insight at this point to understand how binary addition can be built from the logic gates like the ones you will use in this lab.

Look closer at the way we do binary addition:

What we’re actually doing, can be described with Boolean logic and Boolean Algebra. For now, the discussion will be on one stage of addition. A give stage, indexed by i, has the following:

The description in Boolean algebra is as follows:

Since we are able to describe binary addition with Boolean Logic, we are able to perform a single stage of the binary addition with logic gates:

Binary Full Adder:

As an exercise in discussion session, we can verify that the truth table for these expressions matches the desired function for an addition.

Binary addition is not the only thing we can perform with logic gates. We can perform any kind of binary arithmetic with logic gates!
Here is an ALU:

Lab Reminders and Tips

Prelab

Using the started diagram below, sketch how you position layout the ICs, resistors, LED and switch as well as what wire connections you would need to build the circuit show in the figure schematic in the Lab Procedure.

Lab Procedure

Here is the depiction of the circuit to build and test in this lab:

  1. Insert both ICs in the breadboard and connect GND and Vcc according to the pin assignment (in both ICs, pin# 7 is GND and pin# 14 is Vcc).

  2. First, implement A(B+C) by connecting pin# 1 and pin# 2 of 7432 to input switches. So, pin# 1 in 7432 would be signal “B” and pin# 2 would be signal “C” and pin# 3 would contain B+C.

  3. Connect pin# 1 of 7408 to an input switch that we call hereafter as “A” signal. Connect Pin# 3 of 7432 to be the other input of 7408. Now, the overall output (pin# 3 of 7408) equals A(B+C). Connect pin# 3of 7408 to an LED.

  4. To implement the right side of the equation you need to calculate AB and AC separately and then OR them together. So, connect the “A” and “B” signals (input switches) to pin# 4 and 5 of 7408 respectively. So pin# 6 would be AB.

  5. The next step is to calculate AC by connecting the “A” and “C” signals (input switches) to the other 2-input AND gate on 7408, i.e., by connecting the “A” signal to pin# 13 and “C” signal to pin# 12, which makes pin# 11 to be AC.

  6. Now that you have both AC and AB, you need to perform OR by connecting pin# 6 and pin# 11 of 7408 to pins 4 and 5 of 7432 respectively. As a result, pin# 6 of 7432 would be AC+AB, which is the desired output. Connect pin# 6 of 7432 to the LED.

  7. For all input combinations, compare the two outputs (pin# 6 of 7432 and pin# 3 of 7408) and ensure that they match.

    Inputs Outputs
    A B C LED0 LED1
    L L L _ _
    L L H _ _
    L H L _ _
    _ _ _ _ _
    _ _ _ _ _
    _ _ _ _ _
    _ _ _ _ _
    _ _ _ _ _

📝 TA Verification

Have the TA check and record your completion.
  1. (Optional) Try to make a circuit for more complicated functions such as AB(C+D) = ABC + ABD. 74LS11 is triple 3-input AND gate.

Lab Report

You lab report should include an image of your completed circuit, the schematic redraw or copied, as well as the results that you obtained. Briefly explain each of these as you would to a fellow student just starting in the beginning of the semester. Be sure to clearly explain if you completed the work, or if some was not completed. Mention anything that didn’t work as expected and any incorrect results and comment appropriately mentioning your best explanation. Additional instructions may be posted on Blackboard.

≡