using.html 3.6 KB

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