# Configuring a Top Level Circuit

### Available Subcircuits

When the project was created you may have edited the SPICE file to eliminate voltage and current sources. More work may be required to prepare a single subcircuit that has exactly the terminals that s2ibis2 needs for testing the buffer model. SpiTran will create a top level circuit that instantiates all of the required subcircuits, wires nodes together, and terminates the unused nodes. Here is what the main window looks like after a project has been created:

### Instantiated Subcircuits

In this example we have an IO_OUT subcircuit that implements a driving stage, an IO_IN subcircuit that models the load of a logic sensing stage, and an IO_TEST_LOAD that is not part of the buffer, but could be used for testing the buffer. To create a bi-directional buffer we only need the first two subcircuits. Select the row(s) of the Available Subcircuits table that you wish to instantiate, then click Instantiate. The result looks like this:
Note that the rows in the first table correspond to .subckt definitions in the SPICE buffer file, and the rows in the second table correspond to X subckt calls that will appear in the top level circuit that SpiTran creates. Unique node names are generated for the instantiated subcircuits. In this example, the OUT terminal of the first subcircuit must be connected to the IN subcircuit of the second subcircuit to form a bi-directional buffer. Following SPICE conventions this is done simply by applying the same node name to both terminals. The other nodes can be renamed for clarity, if desired. The result might look like this:
The names you enter are arbitrary, but they must adhere to the conventions of your SPICE simulator.

### Configuring Top Level Circuit Nets

The top level circuit must have 5 nodes that s2ibis2 will use:

- The positive supply voltage (power, or vdd)
- The negative supply voltage (ground, or vss)
- The signal output/input of the buffer
- A control input to make the buffer drive High or Low
- A control input to make the buffer go into high impedance state (tristate)

Your circuit must have nodes for each of these. If other nodes are present they must be terminated so that they have no effect on operation. Click Configure Nets... to open the Node/Net Configuration dialog:
For each row in the table, select the cell in the Pin Type column, then click on the marker to open a popup menu with these choices:

- Input - the data input control for a driver, or the input of an input-only buffer
- Output - the output of an output-only buffer
- Vcc - the positive voltage supply
- Gnd - the negative voltage supply
- Enable - the control for enabling a driver
- Float - unused; may be left floating
- I/O - the input and output of a bi-directional buffer

Set each Pin Type. For rows that are set to Float, also set the remaining columns. Click on the cells and type to edit. You may use tab to traverse the columns. Note that the cells for non-float rows can not be edited. Set the R column to the value of a resistor that will terminate the floating node. Set the remaining columns to the voltage that the other end of the resistor is connected to. Be sure to set all three voltages, even if they are the same value. You may need to use specific resistance and voltage values to provide proper pullup or pulldown for some nodes of your buffer. For nodes that are of little consequence, you can use a 1000 ohm resistor tied to 0 volts. When the settings are finished the dialog may look like this:
Click OK when all nodes have been configured. This information will be saved in the project file when the project is saved.