home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s205 / 1.ddi / BACKUP.001 / DOC_LREF_LR28.DOC < prev    next >
Encoding:
Text File  |  1991-02-28  |  2.8 KB  |  97 lines

  1. IF-THEN-ELSE, SIMULATION
  2. Overview
  3. This construct provides conditional statements used during simulation.
  4. This construct literally means "if the condition is true, do this; if
  5. not, do that."
  6.  
  7.  
  8. Syntax───────────────────────────────────────────────────────────────
  9.             IF (Condition) THEN
  10.                 BEGIN
  11.                     Task
  12.                 END
  13.             ELSE
  14.                 BEGIN
  15.                     Task
  16.                 END
  17.  
  18. ────────────────────────────────────────────────────────────────────
  19.  
  20. Device Support:  All PLD devices.
  21. ·
  22. Syntax
  23. You use this construct in Boolean and state-machine designs.
  24.  
  25. Syntax───────────────────────────────────────────────────────────────
  26.             IF (Condition) THEN
  27.                 BEGIN
  28.                     Task
  29.                 END
  30.             ELSE
  31.                 BEGIN
  32.                     Task
  33.                 END
  34. Example──────────────────────────────────────────────────────────────
  35.             SIMULATION
  36.             SETF /OE /CLOCK COUNT
  37.             IF (J = 5) THEN
  38.                 BEGIN
  39.                     CHECK Q0
  40.                 END
  41.             ELSE
  42.                 BEGIN
  43.                     CHECK /Q0
  44.                 END
  45.             ...
  46. ────────────────────────────────────────────────────────────────────
  47. ·
  48. Definitions
  49.  
  50. Condition       Defines any Boolean expression.
  51.  
  52.                 ■  You can use more than one condition if you separate
  53.                    them by commas.  The software ANDs multiple
  54.                    conditions together.
  55.  
  56.                 ■  You can use parentheses to enclose the IF
  57.                    condition.  However, you cannot nest parentheses.
  58.  
  59.                 The condition can be any Boolean expression of logic
  60.                 signals or mathematical equality: =, >, <, >=, <=, and
  61.                 <>.
  62.  
  63. Task            Defines the simulation task the software performs
  64.                 during the IF-THEN-ELSE loop.  You use BEGIN-END
  65.                 statements to enclose the task and indent them to make
  66.                 your program easier to follow.
  67. ·
  68. Use
  69. There is no limit to the number of constructs you can have in your
  70. design.  However, minimal nesting makes the file easier to follow and
  71. faster to compile.
  72.  
  73. You can nest IF-THEN-ELSE constructs within other IF-THEN-ELSE
  74. constructs and with the following statements.
  75.  
  76. ■    CASE
  77.  
  78. ■    FOR-TO-DO
  79.  
  80. ■    WHILE-DO
  81.  
  82. If the condition is false when the construct is reached, the task is
  83. not executed.
  84.  
  85. Note: If you nest the IF-THEN-ELSE construct in a FOR-TO-DO construct,
  86.       the condition can also be the index variable of the FOR-TO-DO
  87.       construct.  You cannot use an index variable outside its
  88.       defining FOR-TO-DO construct.
  89. ·
  90. Related Topics
  91. Boolean Equation
  92. CASE
  93. EXPRESSION
  94. IF-THEN-ELSE, EQUATIONS
  95. ·
  96.