Visible to Intel only — GUID: rzo1684169780775
Ixiasoft
Visible to Intel only — GUID: rzo1684169780775
Ixiasoft
8.1.8.3. Branch Synchronization
The execution of the code inside of a branch is suspended once it reaches wait-for command and continues until the condition defined in the command is satisfied. This allows synchronizing the branch execution with an event that occurs in the simulation. The condition can be a specific value written or read in a register, a breakpoint trigger, elapse a certain amount of time, execute a certain number of steps or cycles, or also a specific string printed on the Intel® Simics® simulator CLI.
The create-script-barrier command creates a barrier, which is a mechanism that allows the synchronization in several branches in the target script. This command receives as a parameter a number that defines the number of branches that need to reach the barrier location. The location in the branches is defined using the wait-for-script-barrier command that receives as parameter the return value from the create-script-barrier.
The following figure describes the functionality of this synchronization mechanism. Here, initially the barrier is created with the create-script-barrier command, indicating the number of branches that requires to be synchronized. In each one of the branches to synchronize, the wait-for-script-barrier command is used, and the branch execution is suspended when they get to this command and resumed until the number of branches defined reaches to this barrier. After this, the branches execution resumes.
The number of the branches that need to reach the barrier can be updated using the script-barrier-limit command.
# CLI script to demonstrate branch synchronization $barrier_id = (create-script-barrier 2) $time_org = (ptime -c) echo "Setting barrier at time " + $time_org + " ID: " + $barrier_id script-branch { $timeB1Pre = (ptime -c) echo "Branch1: @" + $timeB1Pre + " will get to barrier in 500 cycles" bp.cycle.wait-for 500 $timeB1Pre = (ptime -c) echo "Wait in branch 1 at: " + $timeB1Pre wait-for-script-barrier $barrier_id $timeB1Post = (ptime -c) echo "Sync in branch 1 at: " + $timeB1Post } script-branch { $timeB2Pre = (ptime -c) echo "Branch2: @" + $timeB2Pre + " will get to barrier in 200 cycles" bp.cycle.wait-for 200 $timeB2Pre = (ptime -c) echo "Wait in branch 2 at: " + $timeB2Pre wait-for-script-barrier $barrier_id $timeB2Post = (ptime -c) echo "Sync in branch 2 at: " + $timeB2Post } run
# Output log from the script execution Setting barrier at time 0 ID: 1 Branch1: @0 will get to barrier in 500 cycles Branch2: @0 will get to barrier in 200 cycles Wait in branch 2 at: 200 Wait in branch 1 at: 500 Sync in branch 1 at: 500 Sync in branch 2 at: 500