Assignment 4

4 minute read

Type: Individual Assignment
Due: before class on Wednesday, November 10, 2021

Overview

This assignment is designed to give you practice using Logism and applying what you’ve learned so far to build a fundamental combinational circuit: an 8-bit adder. Before you begin, you should make sure you have the latest version of Logisim by following the Installing Logisim instructions.

Your grade on this assignment is will depend on the correctness of your circuits. I will use a large test suite to validate your circuits’ outputs.

You may not use any Logisim components except those under the Wiring and Gates categories. Submissions that use disallowed components (such as Logisim’s built-in adder) will not receive credit.

Testing circuits requires that the names of inputs and outputs be specified exactly in the test files. Thus, I provide you with starter files for each part. Do not rename the input/output pins and try to avoid rearranging the order of the pins on the circuit.

Finally, some consideration will be given to the clarity of organization within your circuits. Wires and gates should be laid out in a fashion that facilitates comprehension.

Part A: Half Adder

Consider the problem of adding two bits x1 and x2. Since it is possible for both bits to be 1, the total sum could be 1 + 1 = 2 which in binary requires two bits of output. Thus, the sum can be be thought of as x1 + x2 = co s where co is the carry out bit and s is the sum bit.

  1. Complete the truth table for this problem, which is called a half adder.

    x1 x2 co s
    0 0    
    0 1    
    1 0    
    1 1    
  2. Identify the two gates necessary to compute the outputs co and s. (Each can be computed with a single gate.)

  3. Download the half_adder.circ starter file, open it in Logisim, and finish implementing the circuit. The starter file already has inputs named x1 and x2, and outputs co and s.

    WARNING: Do not change the names of the input/output pins during your implementation! This will affect the automated tests of your circuit.

  4. Test your circuit. It should display the sum of the two input bits, which will always be 0, 1, or 2 (displayed in binary).

  5. Upload your circuit to Gradescope. Within a few minutes, you will receive the autograder results from the exhaustive tests.

Part B: Full Adder

Half adders work when we want to add two one-bit numbers, but we often ask computers to add much larger numbers. The processor performs multi-bit addition by chaining together a series of adders. However, a half adder basically stands in isolation because it can’t take the carry from a previous column as input in a multi-bit addition. The full adder therefore incorporates not only the two bits of a number to sum, but also the carry-out bit from the previous column as a carry-in input bit, called ci.

The truth table for a full adder would look like the following:

ci x1 x2 co s
0 0 0    
0 0 1    
0 1 0    
0 1 1    
1 0 0    
1 0 1    
1 1 0    
1 1 1    
  1. Complete the truth table for the full adder above.

  2. Write down the Boolean algebra statements for co and s and reverse engineer what gates are required to implement the circuit.

  3. Download the full_adder.circ file, and finish implementing the full-adder circuit using your work above. The starter circuit file already has inputs named x1, x2, and ci, and outputs co and s.

    WARNING: Remember to not change the names or ordering of the input/output pins during your implementation!

  4. Test your circuit. It should display the sum of the three input bits, which will always be 0, 1, 2, or 3 (displayed in binary).

  5. Upload your circuit to Gradescope. Within a few minutes, you will receive the autograder results from the exhaustive tests.

Part C: 8-bit Adder

Now that we have a full adder circuit, you should chain them together to add a pair of 8-bit numbers. Download the add_bundle.circ starter file which has two 8-bit inputs, an 8-bit output, and a carry-out output that tells us if an overflow occurred. Note that there is no carry-in input for this adder.

The starter file includes an empty full adder subcircuit. Start by copying and pasting your solution from Part B here. Then you can use your full adder as a subcircuit in your 8-bit adder. You will need eight copies of it to implement the main 8-bit circuit.

Once you have an implementation of the 8-bit adder, you should test it. When you are confident in your solution, you should upload it to Gradescope. The autograder for Part C takes significantly longer since it exhaustively tests all possible inputs to the circuit.

Other Notes

  • If you have red error signals on any wires coming out of your subcircuits that otherwise tested successfully, try saving your file, closing Logisim, and re-opening your circuit file. This clears the state in your elements.

ACKNOWLEDGEMENT: This assignment was based on one written by Charlie Curtsinger and Jerod Weinman at Grinnell College and used with permission.