shifter.html 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <html>
  2. <head>
  3. <title>Shifter</title>
  4. </head>
  5. <body bgcolor="FFFFFF">
  6. <h1><img align="center" src="../../../../en/icons/shifter.gif" width="32" height="32">
  7. <em>Shifter</em></h1>
  8. <p><table>
  9. <tr><td><strong>Library:</strong></td>
  10. <td><a href="index.html">Arithmetic</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/shifter.png" width="44" height="42"></td></tr>
  15. </table></p>
  16. <h2>Behavior</h2>
  17. <p>This component includes two inputs, <var>data</var> and <var>dist</var>, and
  18. it has one output, which is the result of shifting <var>data</var> by
  19. <var>dist</var> places. Both <var>data</var> and output have the same number of
  20. bits in them. The component supports the following shift types:</p>
  21. <ul>
  22. <li>Logical Left: All bits in <var>data</var> are shifted up <var>dist</var> places,
  23. with the bottom <var>dist</var> places filled with 0's. For example,
  24. 11001011 logically shifted left twice is 00101100. (The top two ones are lost.)</li>
  25. <li>Logical Right: All bits in <var>data</var> are shifted down <var>dist</var>
  26. places, with the upper <var>dist</var> places filled with 0's. For example,
  27. 11001011 logically shifted right twice is 00110010. (The bottom two ones are
  28. lost.)</li>
  29. <li>Arithmetic Right: All bits in <var>data</var> are shifted down <var>dist</var>
  30. places, with the upper <var>dist</var> places filled with repetitions of
  31. whatever the uppermost bit in <var>data</var>. For example, 11001011
  32. arithmetically shifted right twice is 11110010.</li>
  33. <li>Rotate Left: All bits in <var>data</var> are shifted up <var>dist</var>
  34. places, with the top <var>dist</var> places wrapped around into the bottom.
  35. For example, 11001011 rotated left twice is 00101111.</li>
  36. <li>Rotate Right: All bits in <var>data</var> are shifted down <var>dist</var>
  37. places, with the bottom <var>dist</var> places wrapped around into the top.
  38. For example, 11001011 rotated right twice is 11110010.</li>
  39. </ul>
  40. <p>Note that if <var>dist</var> contains any floating or error inputs, then
  41. the output is composed entirely of error values, since there is no way to
  42. guess how far to shift the input.</p>
  43. <h2>Pins</h2>
  44. <dl>
  45. <dt>West edge, north end (input, bit width matches the Data Bits attribute)</dt>
  46. <dd>The value to be shifted.</dd>
  47. <dt>West edge, south end (input, bit width is computed as below)</dt>
  48. <dd>The number of bits by which to shift the <var>data</var> input.
  49. This input should have as many bits as is the minimum number to indicate
  50. any shift distance from 0 up to one less than Data Bits; that is, it should
  51. be the ceiling of the base-2 logarithm of Data Bits. For example, if Data Bits
  52. were 8, this input would require 3 bits; but if it were 9, it would require
  53. 4 bits.</dd>
  54. <dt>East edge (output, bit width matches the Data Bits attribute)
  55. <dd>The result of shifting the input value by the input distance.</dd>
  56. </dl>
  57. <h2>Attributes</h2>
  58. <p>When the component is selected or being added,
  59. Alt-0 through Alt-9 alter its <q>Data Bits</q> attribute.</p>
  60. <dl>
  61. <dt>Data Bits</dt>
  62. <dd>The bit width of the <var>data</var> input and of the output.</dd>
  63. <dt>Shift Type</dt>
  64. <dd>One of the five possible shift types as outlined above (Logical Left,
  65. Logical Right, Arithmetic Right, Rotate Left, Rotate Right).</dd>
  66. </dl>
  67. <h2>Poke Tool Behavior</h2>
  68. <p>None.</p>
  69. <h2>Text Tool Behavior</h2>
  70. <p>None.</p>
  71. <p><a href="../index.html">Back to <em>Library Reference</em></a></p>
  72. </body>
  73. </html>