Intel® Simics® Simulator for Intel® FPGAs: User Guide

ID 784383
Date 7/08/2024
Public
Document Table of Contents

8.1.8. Script Branches

Script branches allow you to write sequences of CLI commands that can be postponed, waiting for things to happen in the simulator, without breaking the sequential flow of commands. This is typically used to avoid breaking a script into many small sections, each run as a callback using Python.

A simple example of a script branch is shown in the following:

#Intel Simics simulator CLI 

simics> script-branch "script branch description (optional)" {
.......     echo "This is a script branch test - Waiting here..."
.......     system.board.fpga.soc_inst.hps_subsys.agilex_hps.core[0].bp-wait-for-step 10
.......     echo "Processor registers after 10 steps" 
.......     system.board.fpga.soc_inst.hps_subsys.agilex_hps.core[0].print-processor-registers
....... }

This is a script branch test - Waiting here...
1
simics> r 11 steps
Processor system...agilex_hps.core[0] is stalling - may take a long time to finish.
Processor registers after 10 steps
aarch64
x0    = 0x00000000000000e0  x16   = 0x000000004990d57c  
x1    = 0xffff0003fef95d60  x17   = 0x000000000000001c  
x2    = 0x000000000003501e  x18   = 0x00000000aecda0d8  
x3    = 0x0000000000000000  x19   = 0x0000000000000000  
x4    = 0x0000000066666666  x20   = 0xffff800009dd9ae0  
x5    = 0x00ffffffffffffff  x21   = 0xffff800009dd99e8  
x6    = 0x000006b81049b3e3  x22   = 0xffff8000098fabf8  
x7    = 0x0000000000000000  x23   = 0xffff800009dd9b10  
x8    = 0xffff800009de3ef0  x24   = 0x0000000000000000  
x9    = 0xffff800009dd3ce0  x25   = 0x0000000000000000  
x10   = 0x0000000000000990  x26   = 0xffff800009de3500  
x11   = 0x0000000000000001  x27   = 0x000000007fefe8cc  
x12   = 0x0000000000000000  x28   = 0x00000000077a0018  
x13   = 0x0000000000000001  x29   = 0xffff800009dd3d60  
x14   = 0x000000000000015d  x30   = 0xffff800008f432b8  
x15   = 0x00000000a7611c7e  
 
pc = 0xffff800008010a98

The example above executes the first echo command at once, and then waits there until the first 10 instructions (steps) have run. When the step counter for the processor has reached 10, the script branch resumes and runs the next two commands (echo and print-processor-registers).

A big difference between script branches and the main script is that the main script (also called main branch) may be interrupted by you through pressing the stop button or typing Ctrl-C. The script branches are unaffected by such actions and can exist in the background, coexisting with any interactive command line use.

When a script branch is started (using script-branch), it begins executing immediately, and runs until a wait-for- command is issued. Execution is then resumed in the main script, i.e., there is never any concurrent activity. When the activity that the script branch is waiting for completes, the branch continues.