COMMAND NAME:

        DO

USAGE:

        DO <stmt> WHILE ( <condition> )

        The DO-WHILE control construct iterates a statement as long as some
        condition is met.  <Stmt> is any SCL statement including a compound
        statement.  <Condition> is an SCL expression.

        Flow of control passes through the DO-WHILE construct by first
        executing <stmt> and then evaluating <condition>.  If <condition>
        evaluates to true then the process is iterated.  This continues
        until <condition> evaluates to false.

EXAMPLE:

                dep 'clk*',$b1
                do
                {
                    sim c
                    dep 'clk*',(~#'clk*')
                } while (#'out<15..4>' < $xfff)

        In this example <stmt> is the compound statement delimited by curly
        braces.  It contains a simulate command and a deposit command.
        <Condition> is the expression #'out<15..4>' < $xfff.  When the flow
        of control enters this DO-WHILE construct, the simulate and deposit
        commands will be executed.  Next the expression will be evaluated.
        If the expression is true, that is if the binary operator <
        returns a 1 signifying that the value of the signal 'out<15..4>' is
        less than $xfff then the sequence will iterate again.  This will
        continue until such time that the expression evaluates to false.

CAUTION:

        It is possible for a DO-WHILE loop to iterate indefinitely in the
        case that <condition> never becomes false.  One way around this is
        to check a flag that indicates that a problem exists and terminate
        the loop if the flag is set.

                done = 0
                dep 'clk*',$b1
                do
                {
                    sim c
                    dep 'clk*',(~#'clk*')
                    done = <some other condition>
                } while (#'out<15..4>' < $xfff && !done)

        Here is the example repeated except that <condition> is also
        dependent on done remaining 0.  Each iteration of the loop also
        checks <some other condition> and sets done accordingly.  The loop
        will terminate if done becomes non-zero.

        During an interactive session you can interrupt the execution with
        ctrl-C.  This will pause the script.  Then you can set done to a
        non-zero value directly.  RESUME will continue the script, but,
        since done is no longer zero the loop will terminate and execution
        will continue with the statement that immediately follows the loop.

SEE ALSO:

        FOR
        WHILE
        BREAK
        CONTINUE
