If you like designing logic circuits, Logisim is a great tool. It allows you to design circuits and run simulations of your circuit to see how it works. I suspect a lot of EE students today are already familiar with Logisim, but I had never heard of it until recently. In this tutorial, I will tell you a little about it, and provide some examples of circuits I have designed with it.
Logisim is available free from SourceForge here. As the website says: It is “an educational tool for designing and simulating digital logic circuits, featuring a simple-to-learn interface, hierarchical circuits, wire bundles, and a large component library.” Downloads are available for Windows, MAC, and Linux. It is easy to install, but it is a Java application, so you need Java installed on your system.
Key FeaturesLogisim comes with a large assortment of logic components: gates, multiplexers, flip flops, registers, counters, math functions, memory, various input and output devices. A small sample is shown below:
It is worth mentioning that Logisim just assumes power and ground is available to all components as required, so they are not shown or necessary. An LED for example just has 1 lead, its anode, while the cathode is assumed to be at ground. And a button just has one lead which goes from 0 to 1 when the pushed.
If you need something that is not already there, you can design it as a “sub-circuit”. It is like taking your circuit and turning it into an IC. This means it is encapsulated and given a name, and then can be used like any of the other available components. As this extreme example below, we have encapsuled all the logic of a digital clock, including the conversion from binary to BCD and the 7-segment drivers, and packaged it as a component called Clock. It has three inputs to set the time, and 7 outputs to drive six 7-segment displays and a blinking colon.
Most components can be assigned bit widths up to 32 bits. This tremendously helps to keep circuits looking clean and simple. Wires automatically become “data buses” when attached to a multi-bit input. Both ends of a wire need to be attached to the same bit width, or the system will complain. Splitters are available to combine bits onto or split bits off of a multi-bit bus. Below you can see an 8-bit wide 4:1 multiplexer with all its inputs and outputs broken out by splitters. You can also see the error message you get when you try to connect two different bit-widths.
A clock is available which can tick once or at a frequency from 0.5 Hz up to 2K Hz. I personally found on my Windows 11 system that above 250 Hz the clock became somewhat erratic, as our simulation is running on a highly multitasked operating system. Shown below are the clock component and its available frequency (tick rates are actually twice the frequency).
The first two tools in the tool bar are a finger and a pointer. Selecting the finger puts you in simulation mode where poking an element changes its state, i.e. a 0 becomes a 1 or a 1 becomes a 0. Selecting the pointer puts you in edit mode, where selecting a component allows you to move it, delete it, or change its properties. This is something that you need to pay attention to. I still find myself trying to edit something with the finger or poking something with the pointer.
The user interface is fairly intuitive, but when you need help, an extensive help menu is available. The Tutorial is a quick way to learn the basics. The components themselves are somewhat intuitive, but the Library Reference gives you detailed information about each component. I think it is probably a good idea to read about a component the first time you try to use it.
One thing that is important to know about is wire colors:
Gray: The wire's bit width is unknown, as it is not attached to anything.
Blue: The wire carries a one-bit value, but nothing is driving a specific value onto the wire.
Dark green: The wire is carrying a one-bit 0 value.
Bright green: The wire is carrying a one-bit 1 value.
Black: The wire is carrying a multi-bit value. Some or all of the bits may not be specified.
Red: The wire is carrying an error value. This often arises because a gate cannot determine the proper output, perhaps because it has no inputs. It could also arise because two components are trying to send different values onto the wire. Multi-bit wires will turn red when any of the bits carried are error values.
Orange: The components attached to the wire do not agree in bit width. The bit-width of each end is shown in this case.
Some Sample CircuitsLogisim saves logic circuits as.circ files. The file saves all your work including any sub-circuits. It remembers your clock frequency, but you must Initiate Ticks in the Simulate menu to start the clock. All the circuits I will discuss here are contained in the attached ZIP file. We will start with something simple, and work our way up to more complicated circuits.
6-bit Binary Counter
Our first circuit uses toggle flip flops to built an asynchronous 6-bit binary counter, capable of counting from 0 to 63. There are a couple of things to discuss here. All the T inputs on the flip flops must be enabled (set to 1) to get them to count. The outputs of our counter are the NOT_Qs, and each is attached to a red LED. The reason our output appears at NOT_Q is because the first rising clock pulse sets all the Q outputs high, and then the Q outputs count down from 63 to 0. What we want as our output is the NOT_Qs, which proceed to count from 0 to 63.
4-digit decade Counter
This is another counter, but more complicated. We are using four counter components, rather than individual flip flops, and setting each to 4 bit-width. The counters need the ct pin enabled to put them in counter mode. These counters each count from 0 to 15. But we are looking for decade counters. We put a splitter on each counter output, and connect an AND gate to the second and fourth bits. The gate’s output is attached to the counters 0 or reset pin, so that when the count transitions from 9 to 10, the counter resets to 0. The gate’s output also triggers the clock in the next counter.
So now that we have a 4-digit decade counter, we will display its output using 7-segment displays. I created a ROM with a 4-bit address and 7-bit output, and put the 7-bit codes in it to display the numbers. I would normally just create one ROM and multiplex the output through the ROM and to each digit fast enough to make it look like they are all on at once. But when I tried to do that in Logisim, I found that the clock didn’t run fast enough and regularly enough to get the displays to look like they were on all the time. I suspect this is a result of trying to run the simulation on a multi-tasked operating system like Windows 11. In any case, I had to resort to making 3 more copies of the 7-segment driver ROM as a work-around.
16-bit Arithmetic Logic Unit
The arithmetic logic unit or ALU is one of the main components of a computer CPU. It is a complex piece of combinational logic. It has two 16-bit inputs and it performs a number of different operations on those two numbers, all in parallel. Then an op-code drives the selection on a multiplexer of which operation appears on the 16-bit output. The operations this ALU performs are:
- Add A+B
- Sub A-B
- Negate A
- Increment A
- Decrement A
- AND A and B
- OR A and B
- XOR A and B
- Compare A and B
- Shift A right by B bits
- Shift A left by B bits
All the inputs and output are binary. In addition to the primary 16-bit output, there are 4 flags: carry out, and >, <, = flags are the results of the compare operation. The compare output is actually operational all the time, not just when the compare op code is present. There are carry in bits on several operations, but I didn’t combine them and bring them out as an actual input. By poking the various inputs, you can experiment with inputs and check out the output.
ALU with Readouts
I thought it might be fun to add 7-segment displays to the inputs and output of my ALU. However, the combinational logic to convert a 16-bit number into a 5-digit decimal number is very complicated. It involves first converting the binary number to 5 BCD (binary coded decimal) numbers and then putting each of those results through a conversion to 7-segment code. Fortunately, a You Tube user named "7404 IC" had already created in Logisim exactly what was needed. I was able to take his circuit and create a sub-circuit with it. It is labelled BCD and does all the conversions at once. So, if you want to play around with the ALU, you still have to poke binary number inputs, but now you can clearly see the inputs and output in decimal as you experiment.
The Clock
Earlier I showed you a version of the clock where all the inner workings were encapsulated in a sub-circuit. But in the section, we will look at the actual clock circuit for this 12 hour clock.
There are basically three parts to this circuit. At the top we have the output: 6 digits of 7 segment display with blinking colons between hours and minutes and between minutes and seconds. The colons are 4 LEDs. The two digit displays for hours, minutes, and seconds are each converted from binary to 7 segment BCD by an 8-bit version of “7404 IC”s circuit which is labelled 7SD. For the hour display, I added an adder with “1” as one of the inputs to shift the hours to go from 1-12 instead of 0-11.
The second part of the circuit is the actual counters from hours, minutes, and seconds. All three have AND gates on there outputs to make them reset when they reach their count, i.e. 60 from minutes and seconds, and 12 for hours.
The third part of the circuit lets you set the time. For hours, it is straight forward: the clock pulse for hours goes though an OR Gate. A button is on the other input to that OR gate, so pushing it advances hours. For seconds and minutes, it’s more complicated. The master clock is set at 8 Hz and goes into a 3-bit counter with output of 1 Hz and 4 Hz. Those two clock outputs go to multiplexers where pushing the seconds or minutes set buttons cause the 4 Hz clock to switch in and rapidly advance the counts in the minutes or seconds counters. Those buttons also open up transmission gates so that running seconds or minutes through 60 does not cause the next number to advance during the setting process.
I like Logisim and recommend it. It takes a little time to get used to, but then allows rapid design and simulation of very complex logic.




Comments