Homework 2: Circuits

For this homework, we will be practicing designing and drawing circuits.

To design the circuits for this homework, you may only use the gates below; i.e, the logic gates that we have discussed in class so far. While Digital provides access to additional components, you may only use the following to get credit on this homework.

  • AND gate
  • OR gate
  • XOR gate
  • NOT gate

Note: For this homework, you should not need to use the NAND or NOR gates, but you are welcome to use them.

When using Digital, you will also need IO (Input and Output) and may need to add either a “Ground” or “Supply voltage”, found under the “Components” -> “Wires” menu. The “Ground” always outputs a 0 and the “Supply voltage” always outputs a 1; these may be helpful if you need a constant value as input to your circuit.

Circuits to Draw by Hand

For the following circuit, you should sketch out the circuit by hand (without using Digital or another tool). Why? Because we may ask you to do this on the exam! Please clearly label your inputs and outputs and ensure your drawing fits on one page. Scan or save it as a PDF (or take a picture) and upload it with your Digital files. Your name and computing ID should be clearly written along with your circuit in file you upload.

  1. 4-bit +2 increment: In class we considered an increment circuit that adds 1 to its input value. Now we want a circuit that adds 2 instead (i.e., \(z = x + 2\)). Design and draw by hand a 4-bit increment circuit. (It should not use NOT (~) gates).

Circuits to Build in Digital

Design the following circuits in Digital, which you set up in Lab 3. Download the linked starter file for each circuit, which contains the required inputs with correct names as well as a built-in test suite. Save each file individually with the same filename that you downloaded and upload all of them to Gradescope.

  1. 4-input adder: We have discussed both a 2-input and 3-input adders for single-bit values as we were building our ripple carry adder. Design a 4-input adder for single-bit values: that is, a set of logic gates with 4 input wires (named \(x_0\) … \(x_4\)) each representing a number between 0 and 1 and a multi-bit output \(z\), composed of wires \(z_0\) through \(z_{...}\) (where \(z_0\) is the low-order bit, \(z_1\) the next, etc., up to the number of wires needed for this task). The gates should ensure that \(z =\) the sum of all four inputs. The starter file may not have all the outputs needed; add necessary outputs following the naming convention Z_n (upper-case Z followed by underscore followed by number) where higher values of n are higher-order bits of the output.
  2. 4-bit decrement: In class we considered an increment circuit that adds 1 to its input value. Now we want a circuit that subtracts 1 (i.e., \(z = x - 1\)). Design a 4-bit decrement circuit that does not use NOT (~) gates.
  3. Double adder: Given two 4-bit inputs \(x\) and \(y\), draw a circuit that output the value \(z\) such that \(z = x + x + y\). As a special property of this circuit only, we do not want overflow, so we have decided that \(z\) may have more than 4 bits to represent its value. Design the corresponding circuit.
    The starter file may not have all the outputs needed; add necessary outputs following the naming convention Z_n (upper-case Z followed by underscore followed by number) where higher values of n are higher-order bits of the output. For full credit, you must not use more than 2 additional gates than the 4-bit ripple carry adder discussed in class. Hint: is there a fast way to calculate \(x+x\) without using many gates?

Important

For each of the circuits created in Digital, all inputs and outputs must be specified as single-bit values named appropriately. For example, if the instructions say “a 4-bit output \(z\)”, they should be created as four 1-bit outputs Z_0, Z_1, Z_2, Z_3, where Z_0 is the low-order bit.

Additionally, the grader will be looking for specific file names, so be sure to follow the file naming convention when saving your completed files.

Collaboration

For this homework only: As is commonly done1 on math-worksheet-like assignments, you may collaborate with other students in this class. As an exception to the usual collaboration policy, you do not need to tell us about casual interactions of the “I got \(X\), what did you get?” variety. But do cite any close collaboration or major corrections; for example if the answer to the above hypothetical was “I think \(X\) is wrong, here’s why” and then you change your answer, add a note like “mst3k suggested this answer” next to your answer. However, we expect that everyone will work on the assignment to better understand circuits, so you may not directly copy another student’s answer.

This exception does not apply to sources other than other students in this course. Websites, outside tutors, generative AI, etc., are still subject to our plagiarism rules.

As always, we reserve the right to request you explain your solutions to us and may penalize you if it appears that you did not understand what you submitted as your work.

Submit

Upload your completed assignment to Gradescope by 11:59pm on Monday, September 22, 2025.

  1. It is not clear to us that this is commonly allowed per course policies, but it is commonly done


Copyright © 2025 John Hott, portions Luther Tychonievich.
Released under the CC-BY-NC-SA 4.0 license.
Creative Commons License