CSC 103

Adder Circuit

 

For this lab you will develop a circuit that adds two four-bit binary numbers. This is a complicated circuit with over 50 logic gates, but the structure is repetitive. We will take advantage of the structure in its complexity so as to complete the design in three easy steps, without involving too many pieces at one time.

The circuit simulator only provides you with three basic gates: AND, OR, and NOT. (Note that each of these gates may be rotated in any of the four main directions.) In addition, you have input and output points which stay on the outer edge of the circuit area, and tacks, which allow several wires to join at a single point.

We will build the adder in three steps, each using the results of the step before. First, we will build an XOR gate, since these are not provided by the circuit simulator. Then we will use the XOR and other gates to build an adder. Finally we will put four adders together.

Preparation

So that you may save your work, you should download the circuit simulator to your H drive or other storage and run the downloaded file, instead of launching it from the web page. Otherwise the Save button will report an error. Test the save button to be sure it works before you start the lab below.

XOR

XOR

XOR will be the first project. We can build XOR out of the three gates provided. One way is to build (A AND NOT B) OR (B AND NOT A). This is the circuit we will assemble.

Examine the picture at right and try to duplicate it in your simulator. Components may be added to the simulation area by dragging from the palette on the left. You can move them to a new position by dragging with the right-mouse button held down. You can create a wired connection by clicking the left mouse button on the wire's starting component and dragging it to the ending component. (It will not work in the other direction, i.e., from output to input.)

When you have finished, check the Power box to activate the simulator. Now when you click on an input node, the wires leading from it will turn red indicating they are on. Try all on/off combinations for the two inputs and make sure that the output has the correct values, as specified in the truth table for XOR. When everything works, enter XOR in the Title box and Save the circuit to a file.

1-Bit Adder

Adder

With the XOR circuit on the screen, click the Iconify button. This clears the simulator area and adds the XOR circuit to the palette. (Sadly, it doesn't look like the usual XOR in a standard circuit diagram. But it still works the same way.) Using the new gate, build a 1-bit adder as shown at right.

The two inputs at the top of the screen are the bits to be added. The input at the right is the carry-in bit (if any). The output at left is the carry-out, and the output at the bottom is the sum bit itself. Test your adder circuit to make sure it produces the correct output

4-Bit Adder

4 bit adder

Save and iconify your 1-bit adder. You are now ready to build a 4-bit adder. (Actually, you could add any number of bits you want, but four is enough to demonstrate the concept.) The circuit diagram is at right. When you have finished building it, test it out for a few inputs. Note that the group of inputs on the top left holds one number to be added, and the group on the right holds the other number. The carry bits move from right to left.