Lab 5 - Combinational Logic-Adders and Subtractors
Lab 5 - Combinational Logic-Adders and Subtractors
Objective(s):
Outcome(s):
• The students are able to differentiate combinational and sequential logic circuits.
• The students are able to make binary adders and subtractors using logisim.
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.
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
addition and subtraction of binary numbers, respectively. In this lab, we will study and construct
various adder and subtractor circuits.
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.
X Y C S
0 0 0 0
0 1 0 1
1 0 0 1
1 1 1 0
From the truth table, we could get the Boolean expression of C and S as
C = x.y
S = x ⨁ y = x'.y + x.y'
Accordingly, the logic circuit of the half adder is drawn below.
b) Full Adder (FA) Circuit
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.
X Y z (Cin) Cout S
0 0 0 0 0
0 0 1 0 1
0 1 0 0 1
0 1 1 1 0
1 0 0 0 1
1 0 1 1 0
1 1 0 1 0
1 1 1 1 1
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.
11. Finally, click on the HA module on the explorer pane. Then, in the attribute table, write HA beside
the Shared Label attribute. This would be the name of the module when used in largerdesigns.
Also, change the Shared Label Facing attribute to North.
12. 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.
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). Write your answers in the lab report
Addition (M=0) Subtraction (M=1)
C4S3S2S1S0
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. Similarly, change
the Fan Out attribute to 4 (i.e., the splitter would split the 4-bit bus into 4 separate wires).
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.
12. Repeat step 11 to remove input pins A1, A2, and A3 and connect bit 1, bit 2, and bit 3 of the
splitter instead of them.
13. Finally, insert two more splitters for bus B and bus S. For each bus, repeat step 6 to step 12. Change
the Facing attribute to the S bus to West instead of East. 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.
C4S3S2S1S0
Instructions: The answers from this part will be attached in the “answers to questions” part of the
laboratory report.
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.