| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <html>
- <head>
- <title>Using subcircuits</title>
- </head>
- <body bgcolor="FFFFFF">
- <h1>Using subcircuits</h1>
- <p>Now suppose we want to build a 4-to-1 multiplexer using
- instances of our 2-to-1 multiplexer. Of course, we would first create
- a new circuit, which we'll call "4:1 MUX." To add 2-to-1 multiplexers
- into our circuit, we click the 2:1 MUX circuit <em>once</em> in the
- explorer pane to select it as a tool, and then we can add copies of
- it, represented as boxes, by clicking within the canvas.</p>
- <center><img src="../../../img-guide/subcirc-4-add.png" width="393" height="285"></center>
- <p>If you were to double-click the 2:1 MUX circuit in the explorer pane,
- then the window would switch to editing the 2:1 MUX circuit instead.</p>
- <p>After building up the circuit, we end up with the following.</p>
- <center><img src="../../../img-guide/subcirc-4-done.png" width="393" height="285"></center>
- <p>Our circuit for a 4-to-1 multiplexer uses three copies of the
- 2-to-1 multiplexer, each drawn as a box with pins along the side.
- The pins on this box correspond to the input and output pins in the
- 2:1 MUX circuit. The two pins on the west side of the box correspond
- to the two pins that face east in the 2:1 MUX circuit; the pin on
- the box's east side corresponds to the 2:1 MUX's west-facing pin
- (which happens to be an output pin); and the pin on the box's south
- side corresponds to the 2:1 MUX's north-facing pin. The order of
- the two pins on the box's west side correspond to the same top-down
- ordering from the subcircuit's design. (If there were several pins
- on the box's north or south side, they would correspond to the same
- left-right order in the subcircuit.)</p>
- <p>If the pins in the subcircuit's layout have labels associated with
- them, then Logisim will display that label in a <strong>tip</strong>
- (that is, a temporary text box) when the user hovers the mouse over the
- corresponding location of the subcircuit component. (If you find these
- tips irritating, you can disable them via the
- <a href="../prefs/layout.html">Preferences window's Layout
- tab</a>.)</p>
- <center><img src="../../../img-guide/subcirc-4-tip.png" width="393" height="285"></center>
- <p>Several other components will display these tips, too: For some of the
- pins of a built-in <a href="../../libs/mem/flipflops.html">flip-flop</a>,
- for example, hovering over it explains what that pin does.</p>
- <p>Incidentally, every pin to a circuit must be either an input or
- an output. Many manufactured chips have pins that behave as an input
- in some situations and as an output in others; you cannot construct
- such chips within Logisim (at least, in the current version).</p>
- <p>Logisim will maintain different state information for all subcircuits
- appearing in a circuit. For example, if a circuit contains a
- flip-flop, and that circuit is used as a subcircuit several
- times, then each subcircuit's flip-flop will have its own value
- when simulating the larger circuit.</p>
- <p>Now that we have the 4-to-1 multiplexer defined, we can now use it
- in other circuits. Logisim has no limits on how deeply circuits
- can be nested - though it will object to nesting circuits within
- themselves!</p>
- <p><strong>Note:</strong> There's nothing wrong with editing a
- circuit that is being used as a subcircuit; in fact, this is quite
- common. Be aware, though, that any changes to a circuit's pins (adding,
- deleting, or moving them) will rearrange them also in the containing
- circuit. Thus, if you change any pins in a circuit, you will also
- need to edit any circuits using it as a subcircuit.</p>
- <p><strong>Next:</strong> <a href="appear.html">Editing subcircuit appearance</a>.</p>
- </body>
- </html>
|