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

  1. FOR-TO-DO
  2. Overview
  3. This construct, also known as a For loop, defines the number of times
  4. to repeat a simulation block bounded by BEGIN-END.
  5.  
  6.  
  7.  
  8.  
  9. Device Support:  All PLD devices.
  10. ·
  11. Syntax
  12. You use this construct in either the simulation segment of a PDS file
  13. or in an auxiliary simulation file for any PLD design.
  14.  
  15. Syntax───────────────────────────────────────────────────────────────
  16.  
  17.             FOR Variable := Start TO End DO
  18.                 BEGIN
  19.                      Action Statement
  20.                 END
  21. Example──────────────────────────────────────────────────────────────
  22.  
  23.             SIMULATION
  24.             SETF /OE /CLOCK COUNT
  25.             FOR X := 1 TO 20 DO
  26.                 BEGIN
  27.                     CLOCKF CLK
  28.                 END
  29. ─────────────────────────────────────────────────────────────────────
  30. ·
  31. Definitions
  32.  
  33. Variable        Defines the index variable that identifies the For
  34.                 loop.
  35.  
  36.                 ■  The variable can include up to 14 alphanumeric
  37.                    characters and must end with :=, which is a
  38.                    convention not the registered operator.
  39.  
  40.                 ■  The variable cannot be used anywhere else in the
  41.                    design file.
  42.  
  43. Start           Defines the lower limit of the loop.
  44.  
  45.                 ■  Use only integers following the variable := and
  46.                    preceding the word TO.
  47.  
  48.                 ■  Ensure the number is greater than or equal to zero
  49.                    and less than the upper limit.
  50.  
  51.                 Important: If the start and end numbers are the same,
  52.                 the task is executed once.
  53.  
  54. End             Defines the upper limit of the loop.  It must be
  55.                 greater than or equal to zero.
  56.  
  57.                 ■  Use only integers following the word TO and
  58.                    preceding the word DO.
  59.  
  60.                 ■  Ensure the number is greater than or equal to zero
  61.                    and more than the lower limit.
  62.  
  63.                 Important: If the start and end numbers are the same,
  64.                 the task is executed once.
  65.  
  66. Action          Defines the simulation task to be repeated using this
  67.                 loop.  The following rules apply.
  68.  
  69.                 ■  Enclose each statement with BEGIN and END.
  70.  
  71.                 ■  Use any valid simulation statements between BEGIN
  72.                    and END, including nested FOR loops..
  73. ·
  74. Use
  75. There is no limit to the number of simulation constructs you can
  76. include in a design.  However, minimal nesting makes the file easier
  77. to follow and faster to compile.  You can nest For loops within other
  78. For loops and within the following statements and constructs.
  79.  
  80. ■    IF-THEN-ELSE
  81.  
  82. ■    WHILE-DO
  83.  
  84.      It's best to use the WHILE-DO construct when you do not have a
  85.      fixed number of repetitions and you prefer to base repetitions on
  86.      a condition.
  87.  
  88. For example, you can test the For loop by nesting WHILE-DO or
  89. IF-THEN-ELSE constructs within the For loop as shown below.
  90.  
  91.         FOR X := 1 to 5 DO
  92.             BEGIN
  93.                 IF X = 1 THEN
  94.                 BEGIN
  95.                     SETF A * B
  96.                 END
  97.             END
  98.         ...
  99. ·
  100. Related Topics
  101. CASE
  102. IF-THEN-ELSE, SIMULATION
  103. WHILE-DO
  104. ·
  105.