A5 — Logic gates and circuits

Practice using logic gates to create digital circuits.

Due Sep 30, 2026

Estimated time to complete (just the assignment, excluding the prep materials): 30–60 min.

Prep materials: Week 5: Hardware and logic gates

What to do

For this assignment, you will work with the logic simulator we used in class.

For each part of the assignment, when you are done with it, create one screenshot of the circuit you built in the simulator and include it in your submission. The screenshot’s name should indicate the part of the assignment it corresponds to, for example, part1.png.

Submit all your answers and screenshots to Assignment 5 Submission on Brightspace.

  1. XOR gate

    • Build a XOR gate using only AND, OR, and NOT gates. (This is covered in the prep materials, but we encourage you to try it yourself first.)

    • Attach Toggle Switches to the inputs of your XOR gate and a Light Bulb to the output.

    • Test your circuit by toggling the switches and observing the light bulb.

    • Attach the same toggle switches to the inputs of a built-in XOR gate.

    • Attach a light bulb to the output of the built-in XOR gate.

    • Test your circuit by toggling the switches and observing whether your circuit works in the same way as the built-in XOR gate (i.e., whether the light bulb attached to the output of your circuit is lit if and only if the light bulb attached to the output of the built-in XOR gate is lit).

    • Remember to take a screenshot of your circuit and include it in your submission.

    • Write a response to the following:

      • Which gates did you use to build your XOR gate?
      • How many gates did you use in total?
      • How many different combinations of inputs did you need to test to verify that your circuit works correctly? Why?
  2. Half adder

    • Build a half adder, i.e., a circuit that takes two 1-bit inputs and produces two outputs: the sum and the carry, with the carry placed under the sum. (This is covered in the prep materials, but we encourage you to try it yourself first.)

    • Similar to the previous part, attach toggle switches to the inputs and light bulbs to the outputs.

    • Similar to the previous part, check if your circuit works correctly by testing it against the built-in half adder.

    • Write a response to the following:

      • Which gates did you use to build your half adder?
      • How many gates did you use in total?
      • Do you think a half adder can be built using different types of gates? Why or why not?
  3. 0 and 1

    • Build circuits that always output 0 and 1, respectively, regardless of the inputs.
      Hint: as mentioned in class, you might need to use a Buffer gate to do this in the simulator.

    • As before, attach toggle switches to the inputs and light bulbs to the outputs.
      Hint: Just like the same toggle switch can be connected to multiple inputs, the same gate output can be connected to multiple inputs.

    • Write a response to the following:

      • Which gates did you use to build the circuits for 0 and 1?
      • What is different about these two circuits compared to the previous ones? Write all the things you can think of.
  4. Respond to the following questions:

    • What is the difference between a half adder and a full adder?
    • How many different combinations of inputs would you need to test to verify that a full adder works correctly? Why?
    • In a logical simulator, try to connect multiple toggle switches to the same light bulb or the same gate input. What happens? Why do you think that is?

Grading

Graded for correctness.