Lab: Starting Logisim
CSC 211 - Computer Organization & Architecture - Weinman
- Summary:
- You will experiment with a free logic simulator during
class.
Preparation
Logisim is a free graphical
tool for designing and simulating logic diagrams.
To start Logisim on the MathLAN, run the following command in your
terminal window.
-
java -jar /home/weinman/courses/CSC211/labs/logisim.jar &
Exercises
A. Tutorial
- To learn the basics of Logisim, complete the Beginner's
Tutorial of the Guide to Being a Logisim User, up through
step 4.
- Quickly read about the libraries
and attributes of Logisim through its explorer pane, attribute table,
and tool/component attributes.
- Read about creating
circuits in Logisim (but don't go on to Using subcircuits
yet).
B. Add it Up
Consider the problem of adding two bits x1 and x2:
Here s represents the "sum" or the rightmost bit, while co
represents the carry (for reasons we'll understand in the next day's
class, this is the carry out, hence the subscript).
- 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 | | |
- Identify the sole two gates necessary to represent the co
and s outputs of a half-adder circuit.
- Create a new circuit in Logisim by using the menu command Project > Add Circuit....
Call the new circuit half-adder.
- Build a half-adder circuit in Logisim. (Note that additional gates
are available in the Logisim explorer pane.)
- You may find it visually helpful to arrange your two outputs such
that the carry-out bit is to the left of the sum bit. This way, the
two output bits can be read as a normal two-digit binary number, making
it easy to test your circuit.
- Be sure to label your input and output pins with the text tool.
- Test your circuit. It should display the sum of the two input bits,
which will always be 0, 1, or 2 (displayed in binary).
C. Subcircuits
You now have a simple half adder circuit, which you will reuse as
a module in a circuit for doing multiple single bit additions.
- Create a new circuit (not a new project) called double-half-adder.
- Read about using
sub-circuits.
- Use your half-adder as a subcircuit to create a new circuit that has
four inputs and two outputs so that
and any carries are simply ignored.
- Go on to read about debugging
subcircuits.
This circuit of two half adders could be the basis for what is known
as the Hamming
distance, which counts the number of bits that differ. How to get
the final result (in hardware) is left as an exercise for the reader.
For those with extra time
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 | | |
- Complete the truth table for a full adder.
- Use a KMap to identify reduced functions for both co and s.
- Implement the full-adder circuit using the resulting simplified functions.
Copyright © 2015 Jerod
Weinman.
This work is licensed under a Creative
Commons Attribution-Noncommercial-Share Alike 4.0 International License.