Debugging subcircuits

As you test larger circuits, you will likely find bugs. To nail down what's going wrong, exploring what's going on in the subcircuits while running the overall circuit can help. To enter the subcircuit's state, you can use any of three different techniques. The most straightforward is probably to view the simulation hierarchy by clicking the second icon in the explorer pane's upper toolbar (), or by selecting "View Simulation Tree" from the Project menu. This switches the explorer pane so that it shows the hierarchy of subcircuits being simulated.

Double-clicking an element in this hierarchy will display what is happening inside that subcircuit.

The second way you can enter a subcircuit is to bring up its popup menu by right-clicking or control-clicking it, and then choosing the View option.

And the third way is to first ensure the Poke Tool is selected and then click the subcircuit you want to enter; a magnifying glass will appear over the subcircuit's center, and double-clicking the magnifying glass will enter the subcircuit's state.

In any case, once you enter the subcircuit, you'll see that the pins' values in the subcircuit match the values being sent through them from the containing circuit.

While in the subcircuit, you are allowed to alter the circuit. If the changes affect any of the subcircuit's outputs, they are propagated into the containing circuit. One exception: The subcircuit inputs are determined based on the values coming into the circuit from the supercircuit, so it doesn't make sense to toggle those values. If you attempt to poke a subcircuit's input, a dialog will pop up asking, The pin is tied to the supercircuit state. Create a new circuit state? Clicking No will cancel the toggle request, while clicking Yes will create a copy of the viewed state, divorced from the outer circuit, with the input pin toggled.

Once you have completed viewing and/or editing, you can return to the parent circuit either by double-clicking the parent circuit in the explorer pane, or via the Go Out To State submenu of the Simulate menu.

Next: Logisim libraries.