Previous - Up - Next


SIM_instruction_insert — link instructions

SIM_instruction_insert(instruction_id_t parent_ii, 
                       instruction_id_t ii);

This function links together instructions created by SIM_instruction_begin. The linking helps the user to keep track of dependences between instructions and as default, Simics will not accept any dependence violation. To model different (speculative) execution paths instructions can be linked together to form a tree (instruction tree). The instructions in a tree branch should be ordered in program execution order.

ii is the instruction to insert and ii_parent is the instruction id of the parent instruction. If zero the instruction will be inserted as child to the last inserted one, or as the root if the the tree is empty.

If the parent instruction already has a child the new instruction will be added as another child, thus creating an alternative execution path for the parent.

Instructions can be inserted in the tree after they are fetched and decoded (using SIM_instruction_proceed or similar), but must be inserted before they are executed. This is useful if different instruction should be inserted at different places. For example the instruction after a delay slot have a different parent depending on whether the delay slot can be annulled or not.

Instructions are automatically removed from the tree when they are committed (SIM_instruction_proceed/SIM_instruction_commit) or squashed (SIM_instruction_squash).

SIM_instruction_begin, SIM_instruction_proceed

Previous - Up - Next