Lab 5 - Combinational Logic Modules - Adders and Subtractors
Lab 5 - Combinational Logic Modules - Adders and Subtractors
Objective/s:
Equipment Required
Theory
Digital logic circuits can be classified into two main types: combinational and sequential. A
combinational circuit is a logic circuit that is made up of combinations of logic gates. The application
of inputs into combinational circuits generates the output instantaneously. Some examples of
typical combinational circuits are binary adders, subtractors, comparators, decoders, encoders,
multiplexers, and demultiplexers. All these digital components will be covered and discussed
practically starting from this lab.
A sequential circuit, on the other hand, is made up of a combinational circuit and memory elements,
called flip-flops. The outputs of the sequential circuits depend not only on the inputs but also on the
output of the memory elements. Some examples of sequential circuits are counters and shift
registers.
Procedures/Lab Work:
1. Hierarchical Design
Hierarchical design is a design technique in which pre-designed modules are used to build larger
ones. In this lab, you will hierarchically build the full adder using half adders. The full adder will then
be used to build a larger adder-subtractor circuit. Historically, in the field of digital design, Small
Scale Integrated circuits (SSI) are used to build Medium Scale Integrated circuits (MSI), which in turn
are used to build Large Scale Integrated circuits (LSI). LSI modules are finally used to build Very Large
Scale Integrated circuits (VLSI) and Ultra Large Scale Integrated circuits (ULSI).
Binary adders and subtractors are combinational circuits that can perform the operations of
Since there are two inputs (x and y), only four possible combinations of inputs can be applied. These
four possibilities, and their resulting Sum (S) and Carry (C) are shown in following truth table.
From the truth table, we could get the Boolean expression of C and S as
Full Adder (FA) is a combinational circuit that adds three bits. It generates two outputs: Sum (S) and
carry (C). Full adders allow for the addition of multi-bit numbers. A Designer just needs to provide a
way for carries to propagate between bit positions.
From the truth table, we could get the Boolean expression of Cout and S as
The previous figure also shows that the full adder could be built using half adders. By comparing the
full adder circuit to the half adder one, you could simply implement the full adder circuit using half
adders as follow
c) Adder-Subtractor Circuit
The subtraction of two binary numbers can be done by taking the 2’s complement of the subtrahend
and adding it to the minued. The 2’s complement can be obtained by taking the 1’s complement (i.e.,
inverting all the bits) and adding 1. For example, to perform A – B, we complement the four bits of B,
add them to their corresponding four bits of A, and add 1. The simplest way to add a binary 1 is to insert
it through the input carry.
An XOR gate could be used as an inverter if we place logic 1 at one of the inputs. This helps in getting
the 1’s complement of the subtrahend. Then, we add 1 to get the 2’s complement. The 2's complement
is finally added to the minued to get the final result of the subtraction.
The following figure shows the adder-subtractor circuit. The mode input M controls the operation.
When M=0, the circuit is an adder. Whereas, when M=1, the circuit becomes a subtractor. Although the
figure is for only four bits, this circuit can be cascaded for any number of inputs.
Note: During subtraction, if A ≥ B, the result is a positive number and the output carry is equal to 1. If
A < B, the subtraction gives a negative difference represented in the 2’s complement format and the
output carry is equal to 0. Therefore, during subtraction, the carry actually represents the inversion of
the borrow.
4. Now, let's start to design the most inner module, the Half Adder (HA). From the project
menu, click on Add Circuit.
5. The Input Circuit Name window will appear. Enter HA as the name of the circuit and
click OK
6. A new module named HA is created for you and added to the explorer pane. The
magnifying glass over the HA indicates that it is the module that is currently viewed on
the canvas.
8. Check the operation of the HA module, either by using the poke tool or the
combinational analysis window. The truth table should agree with the half-adder.
9. Before using the half adder hierarchically in larger designs, let's adjust it appearance
first. From the project menu, click on Edit Circuit Appearance.
11. Enlarge the module and move input and output ports to proper locations
12. From the toolbar, click on the Add text button ( ). Then, click beside the two inputs and
name them x and y. Similarly, name the two outputs S and C, as shown below.
14. You are completely done with the half adder. You are ready to use it to build the full
adder circuit. Before doing that, remember to save your work by clicking Ctrl+S.
2. The new module is created for you in the explorer pane and an empty sheet is opened
in thecanvas for it.
3. Now, let's build the FA using two HAs, as discussed.
4. From the explorer pane, click on the HA module and insert two of them into the canvas.
5. From the toolbar, click on the OR gate button and insert one of it into the canvas.
Change the Number of Inputs attribute to 2.
6. Wire the circuit, according to the circuit diagram as shown below.
9. Now, you successfully build the FA using HAs. Remember to save your work before
hierarchically use the FA to build the adder subtractor circuit.
1. Now, we reach the top level module, the adder subtractor. Therefore, in the explorer
pane, double click on the main file.
2. Use four FAs and four XORs to build the adder subtractor circuit, as discussed.
4. Use the poke tool to simulate your circuit. Apply to following values though A's and B's
and record their corresponding values of S's and C4. Interpret your results (i.e., Explain
why S and C have these values). Have you TA to check your work.
5. Now, let's use another convenient method when dealing with multiple related bits, like
A's, B's and S's. A common practice in the digital logic field is to combine these bits in a
wire bundle,called the bus. So, let's see how we could create these busses in Logisim.
6. From the Wiring folder in the explorer pane, click on Splitter and insert it into the
canvas.
7. The splitter you just inserted will be used to create the bus of input A. Input A has four
bits, A3A2A1A0. Therefore, in the attribute table, change the Bit Width In attribute to 4.
8. From the toolbar, insert an input pin. In the attribute table, label it as A and change its
Data Bits attribute to 4.
9. The input pin should have extended in the canvas to have 4 bits.
10. Wire the new 4-bit port, A, to the left side of the splitter.
11. Remove the old input pin, A0, and wire bit 0 (i.e., the top right bit) of the splitter instead
of it.
13. Finally, insert two more splitters for bus B and Bus S. Your final circuit
should appear as follow.
14. Use the poke tool to practice simulating your final circuit and fill in the following table
again.
1. Design a 4-bit binary decrementer circuit using four half adders. Simulate the circuit using Logisim to
ensure that it works properly. Include your design and snapshots from Logisim to your report.
Reference(s)
1. Introduction to Logic Circuits & Logic Design with Verilog, 1st Edition, Brock J. LaMeres
2. Digital Design, 3rd Edition, M. Morris Mano
3. Digital Principles and Logic Design, A. Saba & N Manna
Experiment Title
Experiment No. _
I. Introduction
II. Objectives
VI. Conclusion