Next: , Previous: , Up: Assembler Instructions   [Contents][Index]


5.3.3 choice Instruction Block

This instruction block has the format

        choice
        case    ...
        case    ...
        ...
        end     choice

It consists of the choice instruction, at least one case instruction, and the end choice instruction. Instructions case and end choice must not have location labels assigned.

Each case instruction must have one of the following forms:

        case    number, loc_label
        case    var_name, loc_label

The above case instructions specify control transfer to location label loc_label with probability number or with a probability stored in variable var_name. Probability number must be in the range 0 to 1 inclusive. The assembler supports fixed-point and exponential notations for number. If a choice instruction block has a location label assigned, then you must not use the location label as the second argument of case instructions within the block.

The choice instruction block effectively sets profile probabilities in the action emission matrix or the state transition matrix. If a particular choice instruction block is prepended with an stt instruction, then the instruction block will set profile probabilities in the action emission matrix. If a particular choice instruction block is not prepended with an stt instruction, then the instruction block will set profile probabilities in the state transition matrix. See stt Instruction, for more information.

If the assembler considers it should assemble a user instruction at a particular place but encounters a choice instruction block at that place, then the assembler will assemble the nop instruction and treat the choice instruction block as possible transitions to states made after invocation of this nop instruction.

As opposed to a contiguous block of jprob instructions, a choice instruction block allows you to specify jump probabilities in a direct way. Let us consider a choice instruction block like this:

        choice
        case    prob1, L1
        case    prob2, L2
        case    prob3, L3
        end     choice

Probabilities of jumps to various destinations are below:

Jump destinationProbability value
Location label L1prob1
Location label L2prob2
Location label L3prob3
An instruction that follows the choice instruction block1-prob1-prob2-prob3

Compare this example to the corresponding example with a block of jprob instructions in the previous subsection.


Next: , Previous: , Up: Assembler Instructions   [Contents][Index]