counter.html 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <html>
  2. <head>
  3. <title>Counter</title>
  4. </head>
  5. <body bgcolor="FFFFFF">
  6. <h1><img align="center" src="../../../../en/icons/counter.gif" width="32" height="32">
  7. <em>Counter</em></h1>
  8. <p><table>
  9. <tr><td><strong>Library:</strong></td>
  10. <td><a href="index.html">Memory</a></td></tr>
  11. <tr><td><strong>Introduced:</strong></td>
  12. <td>2.3.0</td></tr>
  13. <tr><td valign="top"><strong>Appearance:</strong></td>
  14. <td valign="top"><img src="../../../../en/img-libs/counter.png" width="34" height="44"></td></tr>
  15. </table></p>
  16. <h2>Behavior</h2>
  17. <p>The counter holds a single value, whose value is emitted on the output
  18. <var>Q</var>. Each time the clock input (diagrammed with a triangle on the
  19. component's south edge) triggers according to its Trigger attribute,
  20. the value in the counter may update based on
  21. the two inputs on the component's west edge: The upper input is called
  22. <var>load</var> and the lower is called <var>count</var>, and they are
  23. interpreted as follows.</p>
  24. <center><table><thead>
  25. <tr><td><var>load</var></td><td><var>count</var></td><td>trigger action</td></tr>
  26. </thead><tbody>
  27. <tr><td align="center">0 or z</td><td align="center">0</td>
  28. <td>The counter remains unchanged.</td></tr>
  29. <tr><td align="center">0 or z</td><td align="center">1 or z</td>
  30. <td>The counter increments.</td></tr>
  31. <tr><td align="center">1</td><td align="center">0</td>
  32. <td>The counter loads the value found at the
  33. <var>D</var> input.</td></tr>
  34. <tr><td align="center">1</td><td align="center">1 or z</td>
  35. <td>The counter decrements.</td></tr>
  36. </tbody></table></center>
  37. <p>The range of counting can be configured using the Maximum
  38. Value attribute. When the counter reaches this value, the next
  39. increment wraps the counter back to 0; and if it is at 0,
  40. then a decrement will wrap the counter around back to its maximum value.</p>
  41. <p>In addition to the output <var>Q</var>, the component also includes a
  42. single-bit output <var>carry</var>. This is 1 whenever the counter is at its
  43. maximum and the <var>load</var> and <var>count</var> inputs indicate that the
  44. component should increment on the next step - or when the counter is at 0
  45. and the <var>load</var> and <var>count</var> inputs indicate to decrement at
  46. the next step.</p>
  47. <p>The <var>clear</var> input resets the counter's value to 0 (all
  48. zeroes) asynchronously; that is, as long as the <var>clr</var> input
  49. is 1, the value is pinned to 0, regardless of the clock input.</p>
  50. <h2>Pins</h2>
  51. <dl>
  52. <dt>East edge, labeled <var>Q</var> (output, bit width matches Data Bits attribute)</dt>
  53. <dd>Outputs the value currently stored by the counter.</dd>
  54. <dt>East edge, lower pin (output, bit width 1)</dt>
  55. <dd>Carry: When <var>load</var> and <var>count</var> indicate to increment,
  56. this output is 1 whenever the counter is at its maximum. When <var>load</var>
  57. and <var>count</var> indicate to decrement, this output is 1 whenever the
  58. counter is at 0. At all other times, this output is 0.</dd>
  59. <dt>West edge, top pin (input, bit width 1)</dt>
  60. <dd>Load: When this is 1 while the <var>count</var> input is 0, the counter
  61. will load the value found at the <var>data</var> input at the next clock
  62. trigger - or, if the <var>count</var> input happens to be 1, the counter's
  63. value will decrement.</dd>
  64. <dt>West edge, middle pin labeled <var>D</var>
  65. (input, bit with matches Data Bits attribute)</dt>
  66. <dd>Data: When the clock triggers while <var>load</var> is 1
  67. and <var>count</var> is 0, the counter's value changes to the value found at
  68. this input.</dd>
  69. <dt>West edge, lower pin labeled <var>ct</var> (input, bit width 1)</dt>
  70. <dd>Count: When this is 1 or unconnected, the value in the counter increments
  71. whenever the clock input is triggered - or it decrements if the <var>load</var>
  72. input happens to also be 1.</dd>
  73. <dt>South edge, indicated with a triangle (input, bit width 1)
  74. <dd>Clock: At the instant that this is triggered as specified by the Trigger
  75. attribute, the counter updates as indicated by the <var>load</var> and
  76. <var>count</var> inputs.</dd>
  77. <dt>South edge, labeled 0 (input, bit width 1)
  78. <dd>Clear: When 0 or undefined, this input has no effect.
  79. As long as it is 1, the counter's value is asynchronously pinned to 0. This
  80. occurs asynchronously - that is, without regard to the current clock input
  81. value. As long as this is 1, the other inputs have no effect.</dd>
  82. </dl>
  83. <h2>Attributes</h2>
  84. <p>When the component is selected or being added,
  85. Alt-0 through Alt-9 alter its <q>Data Bits</q> attribute.</p>
  86. <dl>
  87. <dt>Data Bits</dt>
  88. <dd>The bit width of the value emitted by the component.</dd>
  89. <dt>Maximum Value</dt>
  90. <dd>The maximum value, at which point the counter will set its carry output.</dd>
  91. <dt>Action On Overflow</dt>
  92. <dd>The behavior when the counter attempts to increment beyond the maximum value
  93. or decrement beyond 0. Four possible actions are supported:
  94. <dl>
  95. <dt>Wrap around</dt>
  96. <dd>The next value is 0 (if incrementing - the maximum value if decrementing)</dd>
  97. <dt>Stay at value</dt>
  98. <dd>The counter's value remains at the maximum (or 0 if decrementing)</dd>
  99. <dt>Continue counting</dt>
  100. <dd>The counter continues incrementing/decrementing, keeping the number of bits
  101. as provided by the Data Bits attribute</dd>
  102. <dt>Load next value</dt>
  103. <dd>The next value is loaded from the D input.</dd>
  104. </dl></dd>
  105. <dt>Trigger</dt>
  106. <dd>Configures how the clock input is interpreted. The value <q>rising edge</q>
  107. indicates that the counter should update its value at the instant when the
  108. clock rises from 0 to 1. The <q>falling edge</q> value indicates that it should
  109. update at the instant the clock falls from 1 to 0.</dd>
  110. <dt>Label</dt>
  111. <dd>The text within the label associated with the component.</dd>
  112. <dt>Label Font</dt>
  113. <dd>The font with which to render the label.</dd>
  114. </dl>
  115. <h2>Poke Tool Behavior</h2>
  116. <p>Clicking the counter brings keyboard focus to the component
  117. (indicated by a red rectangle), and typing hexadecimal digits will
  118. change the value stored in the counter.</p>
  119. <h2>Text Tool Behavior</h2>
  120. <p>Allows the label associated with the component to be edited.</p>
  121. <p><a href="../index.html">Back to <em>Library Reference</em></a></p>
  122. </body>
  123. </html>