A newer version of this document is available. Customers should click here to go to the newest version.
1. About This Document
2. Intel® Simics® Simulator and Virtual Platforms
3. Intel® Simics® Simulator for Intel® FPGAs Device Portfolio
4. Installing the Intel® Simics® Simulator for Intel® FPGAs
5. Getting Started with Intel® Simics® Simulator
6. Debugging Target Software
7. Networking with the Simulated Target System
8. Intel® Simics® Scripting
9. Software Debug Examples with Intel® Simics® Simulator
10. Document Revision History for Intel® Simics® Simulator for Intel FPGAs User Guide
A. Intel® Simics® Simulator Command Reference
5.3.1. Version of the Intel® Simics® Simulator for Intel FPGAs Software
5.3.2. Simulation Run Control from CLI
5.3.3. Intel® Simics® Simulator Command Scope
5.3.4. Intel® Simics® Simulator CLI Variables and Operations
5.3.5. Intel® Simics® Simulator CLI Command Completion and Command History
5.3.6. Intel® Simics® Command-Line Interface Help
5.3.7. Capture of CLI Session to a File
5.3.8. Intel® Simics® Simulator File Location and Intel® Simics® Search Path
8.1.3. Control Flow Commands
The CLI scripting supports common flow control commands such as:
- if
- else
- while
- foreach
The following captures show examples of the use if command:
#Intel Simics simulator CLI
#Simple if condition
simics> $val = 10
simics> if $val > 5 {echo "Larger than 5!"}
Larger than 5!
# if/else used as part of a command
simics> $numCores = 4
simics> echo (if $numCores > 1 { "multi-"} else {"single-"}) + "core"
multi-core
simics> $numCores = 1
simics> echo (if $numCores > 1 { "multi-"} else {"single-"}) + "core"
single-core
simics> $b = 0
# if/else if/else used
simics> if $b == 1 {
....... echo "one"
....... } else if $b == 0 {
....... echo "zero"
....... } else {
....... echo "other"
....... }
zero
Note: Multi-line if-else statements must have } else { on the same line.
The following capture shows an example of a while loop:
#Intel Simics simulator CLI
# while loop example
simics> $loop = 3
simics> while $loop {
....... echo "Val:" + $loop
....... $loop -= 1
....... }
Val:3
0x2
Val:2
0x1
Val:1
0x0
Note: When using loop in scripts to automate a process or for device modeling, you must be cautious to prevent falling into an infinite loop condition as it leads to simulation hangs blocking the Intel® Simics® CLI to accept any command.
The following capture shows some examples of a foreach loop. The first one uses the range command to define elements to iterate. This command returns a list of integers that goes from 0 to 2.
The second example uses an actual list of objects that includes the CPUs that belong to the arm-cortex-a53 class which is retrieved with the list-objects command.
The third example creates the list explicitly using [ ] keys.
#Intel Simics simulator CLI
#1st example.
simics> foreach $loop in (range 3) {
....... echo $loop
....... }
0x0
0x1
0x2
#2nd example.
simics> foreach $cpu in (list-objects -all arm-cortex-a53){
....... echo "Cycles on " + ($cpu->name) + ": " + ($cpu.print-time -c)
....... }
Cycles on agilex.hps.core[0]: 1475824027943
Cycles on agilex.hps.core[1]: 1475824027400
Cycles on agilex.hps.core[2]: 1475824027400
Cycles on agilex.hps.core[3]: 1475824027400
#3rd example
simics> foreach $loop in [1, 2, 3] {
....... echo $loop
....... }
0x1
0x2