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

ID 784383
Date 4/01/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

8.1.4. Local Variables

Within command blocks, it can be useful to have variables that are local to the scope and thus do not collide with the names of global variables. By adding local before the first assignment of a variable, the variable is made local. The following capture shows an example of the use of local variable inside of the block that is part of an if command. You can see that inside the block, the value printed corresponds to the local variable, while you can still print the global variable from outside of the block.

#Intel Simics simulator CLI 

simics> $myVar = 10

simics> if TRUE {

....... local $myVar = 20

....... echo "Loacl Var:" + $myVar

....... }

Loacl Var:20
simics> echo $myVar

10