Managing a project

When you build larger circuits, you will want to be able to abstract portions of the circuit into smaller components (similar to the use of functions in programming). Logisim provides a facility to do this, called a subcircuit. A project is a collection of subcircuits grouped together.

In reality, even the simplest circuit is a project, but that is completely transparent to the beginning user. When you select the `Advanced Tools' option, though, one of the biggest changes is that you can suddenly manage your own project.

Files and subcircuits

A Logisim file actually stores a project, not an individual circuit. All subcircuits are embedded into the same file. Thus, any subcircuits you create do not have to be stored separately.

Defining subcircuits

To create a new subcircuit within the project, select the ``New Subcircuit...'' option from the Project menu. You will have to give a name for the subcircuit so that you can find it in menus.

Once you give a name, the editing window will clear. The old circuit is not lost! You are now editing the subcircuit, which can have any circuitry you want within it.

The subcircuit will have a set of inputs and a set of outputs. When you draw the subcircuit, designate inputs using the switch component and outputs using the LED component.

Using subcircuits

When you finish the subcircuit, you can switch back to the main circuit by selecting the main circuit's name (probably `main', unless you've renamed it) from the Project menu.

To refer to a subcircuit within another circuit, select the subcircuit tool (the far right tool, drawn as a box with light green and dark green dots on either side). Then select the desired subcircuit from the drop-down menu in the toolbar. From here, you can place the subcircuit into the circuit you are currently editing.

The subcircuit tool places a rectangle into the window, with ``pins'' running down its left and right sides. The pins on the left side correspond to inputs (the switches in the subcircuit), and the pins on the right are outputs (the LEDs in the subcircuit). The vertical ordering corresponds to the vertical ordering in the subcircuit. (For two switches/LEDs in the same row, the leftmost appears topmost, so the ordering is top-to-bottom, left-to-right.)

There's nothing wrong with adding several copies of the same subcircuit. Of course they can have different values flowing through them, but the underlying circuitry is identical.

Editing subcircuits

You can edit a subcircuit while it's being used in another circuit. In fact, this is quite common, especially when debugging the circuit.

If you move switches or LEDs around, however, you'll also alter the ordering of the pins, so any circuits that use the subcircuit would need to be modified to reflect the new ordering.

When you want to look inside a subcircuit being used in the currently displayed circuit, you can right-click it and select Edit Subcircuit. Of course, you can also edit a subcircuit by selecting its name directly from the Project menu.