Click or drag to resize

12.5.3.4 Flow-Control between Command Lists

The following Flow-Control Commands are available for altering the sequence of execution between entire command lists.

Inter-List Branch Commands: diverting to a different List

These may be used to effect a conditional or unconditional transfer of execution away from the current list.

If the branch is taken, execution continues at the beginning of the target list, and finishes normally at the end it.

Roughly equivalent to:
void otherList ()
{
    // do other stuff
    quit();
}

void mainList()
{
    // do local stuff

    if (IOPort.Read() == CONDITION) otherList();    // BRANCH_LIST_COND

    // do more local stuff, but only if branch was not taken.

    if (flagVariable == true) otherList();    // BRANCH_LIST_COND_FLAG

    // do even more local stuff, but only if branch was not taken.

    otherList();    // BRANCH_LIST 

    // we never get here.
}

ListAPI Method

SP-ICE-3 Command

AppendBranchList(Int32, UInt32, IOPort, Boolean, Boolean, UInt32)[COND]

BRANCH_LIST_COND

AppendBranchList(Int32, String, Boolean)[FLAG]

BRANCH_LIST_COND_FLAG

AppendBranchList(Int32)

BRANCH_LIST

Inter-List Call Commands: calling a Sub-Routine

These may be used to effect conditional or unconditional sub-routine calls from the current list.

The conditional call can be dependent upon the condition or value read from an I/O Port, or upon the state of a boolean flag variable.

When execution reaches the end of a sub-routine list, it automatically returns to the calling list at the command following the call command.

Roughly equivalent to:
void subList1 ()
{
    // do 1 stuff
    return;
}

void subList2 ()
{
    // do 2 stuff
    return;
}

void subList3 ()
{
    // do 3 stuff
    return;
}

void mainList()
{
    // do local stuff

    // unconditional call:
    subList1();    // CALL_LIST

    // do more local stuff

    // conditional call:
    if (IOPort.Read() == CONDITION) subList2();    // CALL_LIST_COND

    // do much more local stuff

    // conditional call:
    if (flagVariable == true) subList3();    // CALL_LIST_COND_FLAG

    // do even more local stuff
}

ListAPI Method

SP-ICE-3 Command

AppendCallList(Int32)

CALL_LIST

AppendCallList(Int32, UInt32, IOPort, Boolean, Boolean, UInt32)[COND]

CALL_LIST_COND

AppendCallList(Int32, String, Boolean)[FLAG]

CALL_LIST_COND_FLAG

Inter-List Switch Commands: diverting to one of several other Lists.

These may be used to effect the selection, dependent upon the condition or value read from an I/O Port, or upon the value of an integer variable, of any one of several alternate lists, to which execution is transferred.

Roughly equivalent to:
void otherListA ()
{
    // do A stuff
    stop;
}

void otherListB ()
{
    // do B stuff
    stop;
}

void otherListC ()
{
    // do C stuff
    stop;
}

void mainList()
{
    // do stuff

    switch (IOPort.Read()) {    // SWITCH

        case CONDA: otherListA();    // CASE_BRANCH_LIST

        case CONDB: otherListB();    // CASE_BRANCH_LIST

        default: otherListC();    // DEFAULT_BRANCH_LIST
    }

    // we never get here
}

ListAPI Method

SP-ICE-3 Command

AppendSwitch(IOPort, Boolean, UInt32)[PORT]

SWITCH

AppendSwitch(String)[VAR]

SWITCH_VALUE

AppendCaseBranchList(Int32, UInt32)[COND]

CASE_BRANCH_LIST

AppendCaseBranchList(Int32, Int32)[VAL]

CASE_BRANCH_LIST

AppendDefaultBranchList(Int32)

DEFAULT_BRANCH_LIST

Inter-List Switch Commands: calling one of several Sub-Routines.

These may be used to effect the selection, dependent upon some condition, of any one of several alternative sub-routines, which is then called from current list.

When execution reaches the end of a sub-routine list, it automatically returns to the calling list at the command following the end of the switch block.

Roughly equivalent to:
void subListA ()
{
// do A stuff
return;
}

void subListB ()
{
// do B stuff
return;
}

void subListC ()
{
// do C stuff
return;
}

void mainList()
{
// do stuff

switch (IOPort.Read())  // SWITCH
{
case CONDA: subListA();    // CASE_CALL_LIST
break;

case CONDB: subListB();    // CASE_CALL_LIST
break;

default: subListC();    // DEFAULT_CALL_LIST
break;
}

// do more stuff
}

ListAPI Method

SP-ICE-3 Command

AppendSwitch(IOPort, Boolean)[PORT]

SWITCH

AppendSwitch(IntegerVariable)[VAR]

SWITCH_VALUE

AppendCaseCallList(Int32, UInt32)[COND]

CASE_CALL_LIST

AppendCaseCallList(Int32, Int32)[VAL]

CASE_CALL_LIST

AppendDefaultCallList(Int32)

DEFAULT_CALL_LIST

Exit List Commands: early return from Sub-Routines

An unconditional or unconditional exit command can be used to force execution to return from a sub-routine to the calling list.

Roughly equivalent to:
void subList1 ()
{
    // do some 1 stuff

    // check an early termination condition
    if (IOPort.Read() == CONDITION) return;    // EXIT_LIST_COND

    // do more 1 stuff

    // check another early termination condition
    if (flagVariable == true) return;    // EXIT_LIST_COND_FLAG


    // do even more 1 stuff

    return;
}

void mainList()
{
    // do some main stuff

    // unconditional call:
    subList1();    // CALL_LIST

    // do more main stuff
}

ListAPI Method

SP-ICE-3 Command

AppendExitList

EXIT_LIST

AppendExitList(UInt32, IOPort, Boolean, Boolean, UInt32)[PORT]

EXIT_LIST

AppendExitList(String, Boolean)[VAR]

EXIT_LIST_FLAG

See Also