home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s205 / 1.ddi / BACKUP.001 / DOC_LREF_LR27.DOC < prev    next >
Encoding:
Text File  |  1991-03-06  |  5.1 KB  |  146 lines

  1. IF-THEN-ELSE, EQUATIONS
  2. Overview
  3. This construct provides a conditional statement for Boolean logic.
  4. This construct literally means "if the condition is true, do this; if
  5. not, do that."
  6.  
  7. For additional details about specifying outputs in IF-THEN-ELSE and
  8. CASE statements, refer to the PALASM 4 User's Manual, Chapter 10,
  9. introduction.
  10.  
  11. Syntax───────────────────────────────────────────────────────────────
  12.  
  13.             IF (Condition) THEN
  14.                 BEGIN
  15.                     Boolean equations
  16.                 END
  17.             ELSE
  18.                 BEGIN
  19.                     Boolean equations
  20.                 END
  21.  
  22. ─────────────────────────────────────────────────────────────────────
  23.  
  24. Device Support:  All PLD devices.
  25. ·
  26. Syntax
  27. You use this construct in the equations segment of Boolean and
  28. state-machine designs.
  29.  
  30. Syntax───────────────────────────────────────────────────────────────
  31.  
  32.             IF (Condition) THEN
  33.                 BEGIN
  34.                     Boolean equations
  35.                 END
  36.             ELSE
  37.                 BEGIN
  38.                     Boolean equations
  39.                 END
  40.  
  41. Example──────────────────────────────────────────────────────────────
  42.  
  43.             EQUATIONS
  44.             IF (/I1,/I2 = #b11) THEN
  45.                 BEGIN
  46.                     O3 = A * B
  47.                 END
  48.             ELSE
  49.                 BEGIN
  50.                     O3 = A * /B
  51.                 END
  52.             ...
  53. ────────────────────────────────────────────────────────────────────
  54. ·
  55. Definitions
  56.  
  57. Condition       Defines any Boolean expression whose form consists of
  58.                 a pin, signal, range, or vector, an equal sign, =, and
  59.                 a binary, decimal, hexadecimal, or octal radix number.
  60.  
  61.                 ■  You can use more than one condition if you separate
  62.                    them by commas.  The software ANDs multiple
  63.                    conditions together.
  64.  
  65.                 ■  You can use parentheses to enclose the condition;
  66.                    they are optional, but it is better to include
  67.                    them.  You can nest parentheses.
  68.  
  69.                 ■  You cannot use group names or arithmetic
  70.                    expressions.
  71.  
  72.                 ■  You can use a test condition in place of any
  73.                    variable name in a Boolean expression as in the
  74.                    example, A * B * (C,D = 1).
  75.  
  76.                 The software ANDs conditions with vectors.  For
  77.                 example:
  78.  
  79.                 IF (A[1..3])  becomes IF (A[1] * A[2] * A[3])
  80.                 IF (/A[1..3]) becomes IF (/(A[1] * A[2] * A[3]))
  81.  
  82. Boolean         Defines any Boolean equation or set of equations, as
  83. Equation        well as IF-THEN-ELSE, and CASE constructs.  The
  84.                 equation must be enclosed by BEGIN-END statements.
  85. ·
  86. Use
  87. You can specify how the software treats default values for the
  88. IF...THEN...ELSE and CASE statements.  All examples used in this
  89. section assume the "Don't Care" default to be in effect.
  90.  
  91. From the Logic Synthesis Options form (accessed from the Setup menu),
  92. fill in the "Use 'IF-THEN-ELSE', 'CASE' default as" field as follows:
  93.  
  94. Don't care      Unspecified default conditions are assumed to be don't
  95.                 care.
  96.  
  97. Off             Unspecified default conditions are assumed to be
  98.                 false.
  99.  
  100. The don't-care option requires that you specify both the on and off
  101. sets. The off option requires you to specify only the on sets; the
  102. software assumes all other conditions to be off.
  103.  
  104. You may lose signals from the design if you select the Don't-care
  105. option and do not specify all of the default conditions.  If the
  106. software treats these signals as don't care, they will be eliminated
  107. from the design during logic reduction.
  108.  
  109. Important:  When translating designs created with PLPL, you must
  110. select the Off option because PLPL treats unspecified default
  111. conditions as false.
  112.  
  113. There is no limit to the number of constructs you can have in your
  114. design.  However, minimal nesting makes the file easier to follow and
  115. faster to compile.
  116.  
  117. You can use an IF clause without an ELSE clause but when the IF clause
  118. is false no logic is defined.  In the case of multiple or nested
  119. IF-THEN-ELSE statements, an ELSE clause always matches the last
  120. IF-THEN clause.
  121.  
  122. You can nest IF-THEN-ELSE constructs within CASE and other
  123. IF-THEN-ELSE constructs.  The following examples show how the software
  124. expands IF-THEN-ELSE constructs.
  125.  
  126. IF-THEN-ELSE                     Expands To
  127. ─────────────────────────────────────────────────────────────────────
  128. IF (A) THEN B = 1                B = VCC *  A  - that is    B =  A
  129.  
  130. IF (A) THEN B = 1  ELSE B = 0    B = VCC *  A  ┐         ┌  B =  A
  131.                                                ├ that is ┤
  132.                                 /B = VCC * /A  ┘         └ /B = /A
  133.  
  134. IF (A) THEN B = 0               /B = VCC *  A  - that is   /B =  A
  135.  
  136. IF (A) THEN /B = 1              /B = VCC *  A  - that is   /B =  A
  137. ─────────────────────────────────────────────────────────────────────
  138. ·
  139. Related Topics
  140. Boolean Equation
  141. CASE
  142. EXPRESSION
  143. IF-THEN-ELSE, SIMULATION
  144. ·
  145.