EN TP1 Doc
EN TP1 Doc
FACULTY OF SCIENCE
COMPUTER SCIENCE DEPARTMENT
Objectives
The goal of this first homework is to familiarize you with the Logisim tool, and to build a combinatorial circuit in a
hierarchical way. The circuit you'll be building is a 4-bit adder/subtractor.
To create such a circuit, you'll need to build a 1-bit half-adder, a full 1-bit adder, a 4-bit adder, a 4-bit adder with flags,
and finally an extension of the 4-bit adder to take subtraction into account.
In this homework, we assume that numbers represented on 4 bits are coded in two's complement (Cà2). We ask you
to use only NAND gates in your circuits.
I. Designing a half-adder
This first circuit represents the basic building block of our 4-bit adder, taking two bits A and B as input and producing
an output S and a carry C. Figure 1 shows the input/output diagram of a complete 1-bit adder.
Page 1 sur 3
In this part, you are asked to:
a) Produce a full adder (1 bit) using the half-adder you have just built. Name the circuit “add_1b”. Use only NAND
gates.
b) Perform a few tests to check that your circuit is working correctly.
Reminder: The two's complement of a binary value is calculated by inverting the bits and adding 1 at the end.
Page 2 sur 3
So, how do you make this circuit?
Fortunately, the circuit is as simple to implement as the idea itself. All you have to do is invert each bit and set 1
(to add the 1) on the holdback C0 instead of 0. In other words, C0 is used to increase the value of the inverse of B by
1, and also a bit to detect whether B or -B is taken. The figure (Figure 4) shows the idea behind this circuit.
1. Building other types of 4-bit adders that are more efficient than the carry-propagation adder used so far in this
homework project.
2. Use registers to save both input numbers and calculation results.
3. Save calculation indicators in a specific register (Status register).
4. Use displays (e.g. 7-segment display) to display numbers in decimal.
5. Extend the circuit for logic operations.
6. Build a 4-bit ALU.
7. You can propose other possible ideas…