expr.html 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <html>
  2. <head>
  3. <title>Creating expressions</title>
  4. </head>
  5. <body bgcolor="FFFFFF">
  6. <h1>Creating expressions</h1>
  7. <p>For each output variable, the Combinational Analysis window
  8. maintains two structures - the relevant column of the truth table,
  9. and a Boolean expression - specifying how each output relates to its
  10. input. You can edit either the truth table or the expression; the other
  11. will automatically change as necessary to keep them consistent.</p>
  12. <p>As we will see on the next page, the Boolean expressions are
  13. particularly useful because the Combinational Analysis window will
  14. use these when told to build a circuit corresponding to the current
  15. state.</p>
  16. <p>You can view and edit the expressions using the window's last two
  17. tabs, the Expression tab and the Minimized tab.</p>
  18. <h2>The Expression tab</h2>
  19. <center><img src="../../../img-guide/analyze-expr.png" width="466" height="323"></center>
  20. <p>The Expression tab allows you to view and edit the current
  21. expression associated with each output variable. You can select the
  22. output expression you want to view and edit using the selector labeled
  23. "Output:" at the pane's top.</p>
  24. <p>Just below the selector will appear the expression formatted in a
  25. particularly common notation, where an OR is represented as addition,
  26. an AND is represented as multiplication, and a NOT is denoted with a bar
  27. above the portion affected by the NOT.</p>
  28. <p>The text pane below this displays the same information in ASCII form.
  29. Here, a NOT is represented with a tilde ('~').</p>
  30. <p>You can edit the expression in the text pane and click the Enter
  31. button to make it take effect; doing this will also update the truth
  32. table to make it correspond. The Clear button clears the text pane,
  33. and the Revert button changes the pane back to representing the
  34. current expression.</p>
  35. <p>Note that your edited expression will be lost if you edit the truth table.</p>
  36. <p>In addition to multiplication and addition standing for AND and OR, an expression
  37. you type may contain any of C/Java logical operators, as well as simply the words themselves.</p>
  38. <center><table>
  39. <tr><th>highest precedence</th><td align="center"><tt>~</tt> <tt>!</tt> <tt>'</tt></td> <th>NOT</th></tr>
  40. <tr><th></th><td align="center">(none) <tt>&amp;</tt> <tt>&amp;&amp;</tt></td> <th>AND</th></tr>
  41. <tr><th></th><td align="center"><tt>^</tt></td> <th>XOR</th></tr>
  42. <tr><th>lowest precedence</th><td align="center"><tt>+</tt> <tt>|</tt> <tt>||</tt></td> <th>OR</th></tr>
  43. </table></center>
  44. <p>The following examples are all valid representations of the same expression. You could
  45. also mix the operators.</p>
  46. <table>
  47. <tr><td><tt>a' (b + c)</tt></td></tr>
  48. <tr><td><tt>!a &amp;&amp; (b || c)</tt></td></tr>
  49. <tr><td><tt>NOT a AND (b OR c)</tt></td></tr>
  50. </table>
  51. <p>In general, parentheses within a sequence of ANDs (or ORs or
  52. XORs) do not matter. (In particular, when Logisim creates a
  53. corresponding circuit, it will ignore such parentheses.)</p>
  54. <h2>The Minimized tab</h2>
  55. <center><img src="../../../img-guide/analyze-min.png" width="466" height="323"></center>
  56. <p>The final tab displays a minimized expression
  57. corresponding to a column of the truth table. You can select which
  58. output's minimized expression you want to view using the selector
  59. at top, and you can indicate whether you want to derive a sum-of-products
  60. expression or a product-of-sums expression using the selector below.</p>
  61. <p>If there are four or fewer inputs, a Karnaugh map corresponding
  62. to the variable will appear below the selector. You can click the
  63. Karnaugh map to change the corresponding truth table values. The
  64. Karnaugh map will also display the currently selected terms for the
  65. minimized expression as solid semitransparent rounded rectangles.</p>
  66. <p>Below this is the minimized expression itself, formatted as in the
  67. Expression tab's display. If there are more than four inputs,
  68. the Karnaugh map will not appear; but the minimized expression will
  69. still be computed. (Logisim uses the Quine-McCluskey algorithm to
  70. compute the minimized expression. This is equivalent to a Karnaugh map,
  71. but it applies to any number of input variables.)</p>
  72. <p>The Set As Expression button allows you to select the minimized
  73. expression as the expression corresponding to the variable. This will
  74. generally not be necessary, as edits to the truth table result in using
  75. the minimized expression for the changed column; but if you enter an
  76. expression through the Expression tab, this can be a convenient way
  77. to switch to the corresponding minimized expression.</p>
  78. <p><strong>Next:</strong> <a href="gen.html">Generating a circuit</a>.</p>
  79. </body>
  80. </html>