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

  1. CASE
  2. Overview
  3. This is the keyword of a statement that provides a condition-testing
  4. structure for Boolean equations that is more efficient than nesting
  5. IF-THEN-ELSE statements for each condition.  The CASE statement more
  6. efficiently supports multiple values than the nested IF-THEN-ELSE
  7. statement.
  8.  
  9. For additional details about specifying outputs in CASE and
  10. IF-THEN-ELSE statements, refer to the PALASM 4 User's Manual, Chapter
  11. 10, introduction.
  12.  
  13. Syntax───────────────────────────────────────────────────────────────
  14.  
  15.                    CASE (Condition signals)
  16.                    BEGIN
  17.                    Value:   BEGIN
  18.                                 Action statement
  19.                             END
  20.                    Value:   BEGIN
  21.                                 Action statement
  22.                             END
  23.                    Keyword: BEGIN
  24.                                 Action statement
  25.                             END
  26.                    END
  27.  
  28. ─────────────────────────────────────────────────────────────────────
  29.  
  30. Device support:  All PLD devices.
  31. ·
  32. Syntax
  33. You can only use the CASE statement in the equations segment of
  34. Boolean designs.
  35.  
  36. Syntax───────────────────────────────────────────────────────────────
  37.  
  38.                    CASE (Condition signals)
  39.                    BEGIN
  40.                    Value:   BEGIN
  41.                                 Action statement
  42.                             END
  43.                    Value:   BEGIN
  44.                                 Action statement
  45.                             END
  46.                    Keyword: BEGIN
  47.                                 Action statement
  48.                             END
  49.                    END
  50. Example──────────────────────────────────────────────────────────────
  51.  
  52.                    CASE (A,D)
  53.                    BEGIN
  54.                    0: BEGIN
  55.                          C = A * B
  56.                       END
  57.                    3: BEGIN
  58.                          C = A + B
  59.                       END
  60.                    2: BEGIN
  61.                          C = 1
  62.                       END
  63.                    OTHERWISE: BEGIN
  64.                          C = 0
  65.                       END
  66.                    END
  67. ─────────────────────────────────────────────────────────────────────
  68. ·
  69. Definitions
  70.  
  71. You can use GROUP, STRING, and VECTOR notation in a CASE statement.
  72.  
  73. Condition       Defines a set of signals that will be tested against a
  74. Signals         list of values to determine which of the actions in
  75.                 following statements should be implemented.
  76.  
  77.                 The set is concatenated into a single binary value
  78.                 using signal values as individual bits.  Each signal
  79.                 value in the set is represented by a name and has a
  80.                 binary value of either 0 or 1.  Each signal name can
  81.                 be either an input or an output.  The following rules
  82.                 must be observed.
  83.  
  84.                 ■  Follow the keyword in a CASE statement with the
  85.                    condition signals.
  86.  
  87.                 ■  Enclose signal names or vector notation in
  88.                    parentheses separated by commas: for example,
  89.                    (A,B,C[0..4])
  90.  
  91.                    Important: Signal names or vector notation must be
  92.                    separated by commas.
  93.  
  94.                 ■  Define each signal name or vector notation and it's
  95.                    value in a pin or node statement in the declaration
  96.                    segment.
  97.  
  98. Value           Define the constant from the following action
  99.                 statement.  This value will be tested against the
  100.                 present value of the condition signals to determine
  101.                 whether that action is taken or skipped.  The rules
  102.                 below apply.
  103.  
  104.                 ■  The value can be any constant; however, do not
  105.                    duplicate values.  The default constant is decimal.
  106.                    Non-decimal constants are expressed with the
  107.                    following prefixes.#b Binary#h Hexadecimal#o
  108.                    OctalAll values are converted to binary during
  109.                    compilation.
  110.  
  111.                 ■  The value must end with a colon and precede an
  112.                    action statement.
  113.  
  114. Action          Defines the logic for a particular condition-signal
  115. Statement       value.  This logic is implemented when the value
  116.                 preceding this statement matches the current value of
  117.                 the condition signals.  The following rules apply.
  118.  
  119.                 ■  Precede each action statement with a value.
  120.  
  121.                 ■  Enclose each statement with BEGIN and END.
  122.  
  123.                 Action statements inside the BEGIN-END block can be
  124.                 any expression that is valid within the equations
  125.                 section of the design.
  126.  
  127.                 An action is a series of any PALASM statements that
  128.                 are legal within the equations section.
  129.  
  130. Otherwise       Use this keyword to identify the beginning of an
  131.                 optional statement that indicates the action for
  132.                 default values of the CASE statement.  When you define
  133.                 every possible value, you do not need this statement.
  134.                 However, any unspecified conditions are assumed to be
  135.                 "don't care"; they are not assumed to be false.
  136.                 Signals for which default conditions are not specified
  137.                 are eliminated from the design during the logic
  138.                 reduction process.
  139.  
  140.                 The otherwise statement generates the condition as
  141.                 identified and shown below.
  142.  
  143.                 ■  OR all conditions for values defined in action
  144.                    statements before this statement.
  145.  
  146.                 ■  Complement the entire OR term, then AND it with the
  147.                    right side of the Otherwise statement.
  148.  
  149.                    CASE (A,D)
  150.                     BEGIN
  151.                          0: BEGIN
  152.                                 C = A * B
  153.                             END
  154.                          3: BEGIN
  155.                                 C = A + B
  156.                             END
  157.                          2: BEGIN
  158.                                 C = 1
  159.                             END
  160.                          OTHERWISE: BEGIN
  161.                                 C = 0
  162.                             END
  163.                     END
  164.  
  165.                 At each clock cycle, or anytime the signals change,
  166.                 the condition signals (A,B) are evaluated.  When the
  167.                 value of the signals matches the value in one of
  168.                 the following action statements, the logic defined
  169.                 in that statement is implemented.  Otherwise, C = 0.
  170.  
  171.                 The syntax example is expanded during compilation
  172.                 into the following Boolean equation.
  173.  
  174.                 C = (VCC * /A * /B)
  175.                     + /(VCC * A * B)
  176.                     + (D * /(/A * /B + A * B))
  177. ·
  178. Use
  179. You can specify how the software treats default values for the
  180. IF...THEN...ELSE and CASE statements.  All examples used in this
  181. section assume the "Don't Care" default to be in effect.
  182.  
  183. From the Logic Synthesis Options form (accessed from the Setup menu),
  184. fill in the "Use 'IF-THEN-ELSE', 'CASE' default as" field as follows:
  185.  
  186. Don't care      Unspecified default conditions are assumed to be don't
  187.                 care.
  188.  
  189. Off             Unspecified default conditions are assumed to be
  190.                 false.
  191.  
  192. The don't-care option requires that you specify both the on and off
  193. sets. The off option requires you to specify only the on sets; the
  194. software assumes all other conditions to be off.
  195.  
  196. You may lose signals from the design if you select the Don't-care
  197. option and do not specify all of the default conditions.  If the
  198. software treats these signals as don't care, they will be eliminated
  199. from the design during logic reduction.
  200.  
  201. Important:  When translating designs created with PLPL, you must
  202. select the Off option because PLPL treats unspecified default
  203. conditions as false.
  204.  
  205. You can nest CASE statements within IF-THEN-ELSE statements and other
  206. CASE statements.
  207.  
  208. For example,
  209.  
  210.             CASE (A,D)
  211.             BEGIN
  212.                 0:  BEGIN   C=A*B   END
  213.                 1:  CASE (C,D)
  214.                     BEGIN
  215.                     0:      BEGIN   E=C*D   END
  216.                     1:      BEGIN   E=C+D   END
  217.                     OTHERWISE:      E=1     END
  218.                     END
  219.                  OTHERWISE:         C=0     END
  220.             END
  221.  
  222. There is no limit to the number of nested statements you can include
  223. in a design; however, too many nests may cause you to run out of
  224. memory.
  225.  
  226. If any equations are incompletely specified or ambiguous, the
  227. unspecified signals are assumed to be "don't care." This increases
  228. the amount of logic reduction possible during the minimization
  229. process.  However, if you have not fully evaluated the consequences of
  230. these "don't care" signals, the equations resulting from compilation
  231. may be very different than you intended.
  232. ·
  233. Related Topics
  234. GROUP
  235. IF-THEN-ELSE, EQUATIONS
  236. VECTOR
  237. ·
  238.