Create a subcircuit in five steps
Add the circuit
Choose Project, Add Circuit. Type a name that starts with a letter, for examplefa.Check: A new circuit appears in the circuit tree.
Build it with labelled pins
Draw the circuit with input pins for what goes in and output pins for what comes out. Label every pin: the labels become the port names.Check: Inputs and outputs have labels.
Go back to main
Double-clickmainin the circuit tree. Double-clicking a circuit’s name opens its layout (F90).Check: The main circuit is on the canvas.
Place the subcircuit
Click the new circuit’s name in the tree, then click the canvas. The box shows the pins’ labels as ports.Check: A box with ports is on the canvas.
Wire and test
Wire the ports and poke the inputs, as in the tutorial.Check: The outputs follow the inputs.
The layout of the fa subcircuit: input pins A, B and Cin on the left, two XOR gates, two AND gates and an OR gate, and output pins S and Cout on the right.
Logisim-evolution 5.0.0 with a 4-bit adder open. The circuit tree lists two circuits, fa and main. In the main circuit four small boxes labelled fa0 to fa3 show the ports of the fa subcircuit.
The name is invalid (it must follow the rule ([a-zA-Z]+\w*)).All the naming messages are on the error list.
Describe this circuit
Components: Input pin A; Splitter 1; Input pin B; Splitter 2; Input pin Cin; fa fa0; fa fa1; fa fa2; fa fa3; Splitter 3; Output pin S; Output pin Cout.
- Input pin A connects to Splitter 1 (net A), 4 bits wide.
- Splitter 1 connects to fa fa0 (net A0).
- Splitter 1 connects to fa fa1 (net A1).
- Splitter 1 connects to fa fa2 (net A2).
- Splitter 1 connects to fa fa3 (net A3).
- Input pin B connects to Splitter 2 (net B), 4 bits wide.
- Splitter 2 connects to fa fa0 (net B0).
- Splitter 2 connects to fa fa1 (net B1).
- Splitter 2 connects to fa fa2 (net B2).
- Splitter 2 connects to fa fa3 (net B3).
- Input pin Cin connects to fa fa0 (net Cin, c0).
- fa fa0 connects to Splitter 3 (net s0).
- fa fa0 connects to fa fa1 (net c1).
- fa fa1 connects to Splitter 3 (net s1).
- fa fa1 connects to fa fa2 (net c2).
- fa fa2 connects to Splitter 3 (net s2).
- fa fa2 connects to fa fa3 (net c3).
- fa fa3 connects to Splitter 3 (net s3).
- fa fa3 connects to Output pin Cout (net c4, Cout).
- Splitter 3 connects to Output pin S (net S), 4 bits wide.
Download circ-full-adder-ripple-4bit.circ.
How pins map to ports
Each input and output pin of the subcircuit becomes one port on its box, with the pin’s label as the port name. In our adder the box for fa has three ports on the left and two on the right, one per pin (F90). We did not test how Logisim chooses the sides when you add a pin, so check the box after you add or remove a pin: ports can move.
Edit the appearance
Select the subcircuit in the circuit tree and choose Project, Edit Circuit Appearance. An editor opens with a drawing toolbar and a box with one port marker per pin. Drag the markers to change where each port sits. Project, Edit Circuit Layout takes you back to the wiring.
The appearance editor for the fa subcircuit: a toolbar of drawing tools, a rectangular box with three blue port markers on its left edge and two on its right edge.
Custom appearance did not save
The project’s issue tracker has reports of a custom appearance resetting. We did not save a custom appearance and reopen it, so we cannot say whether it still happens in 5.0.0.
Set the main circuit
With a circuit selected in the tree, choose Project, Set As Main Circuit. The main circuit is the one autograders and the command line start from. See the command line.
Labels that autograders check
Signals between levels
A tunnel connects points inside one circuit, so it does not carry a signal into or out of a subcircuit (Tunnel). Use a pin. To look inside a running copy, use Simulate, Go In To State; each placed copy has its own state, so registers inside separate copies are separate (Simulate menu items, F46).
Reorder, rename, remove
Project, Move Circuit Up and Move Circuit Down (CtrlShiftU⌘⇧U (⌘⇧U on macOS) and CtrlShiftD⌘⇧D (⌘⇧D on macOS)) reorder the tree. A circuit that is used inside other circuits cannot be removed, and 5.0.0 says so. A subcircuit that would contain itself cannot be placed or pasted. See the error list.
Reuse a subcircuit in another file
Load the file as a library, or merge it. See Libraries.
Classic 2.7.1 differences
| Feature | 2.7.1 | 5.0.0 |
|---|---|---|
| Appearance editor | 2.7.1: untested | 5.0.0: yesopened in our test (F90) |
| Name rules | 2.7.1: untested | 5.0.0: yesmust follow the identifier rule in the message |
| Labels on opening an old file | 2.7.1: untested | 5.0.0: partialconverted to VHDL-safe names (F02) |
Cells say untested where we did not run 2.7.1.
To see which version made a file and what opens where, read the .circ file page.