Creating HDL Text Modules, страница 14

•  Tcl/Tk scripts can be invoked from Design Browser or from the Console window by entering their name (without the file extension):

          runscript <scriptname> [ <parameter_value> ...]

•  Tcl/Tk scripts can provide the same functionality as the Active-HDL macro language.

3.24 Using Tcl/Tk Scripts

          A TCL script can call other scripts of any type (BASIC, Perl, TCL), as well as a macro command file. To enable this, the following line should be included in the TCL script file:

                    package require ::aldec::scripter 1.0

          To execute a BASIC script, use the following statement:

                    ::aldec::scripter::ExecuteScript "runscript
          <script_filename> <parameters>"

          To execute a TCL script, use the following statement:

                    source "<script_filename>"

          To execute a Perl script, use the following statement:

                    ::aldec::scripter::RunConsoleCommand           "<script_filename>"     "<parameters>"

          To execute the macro file, use the following statement:

                    ::aldec::scripter::RunDo "<script_filename>"

                                               3.25  Using Tcl/Tk Scripts

Active-HDL comes with a Modulator example that employs a Tcl/Tk script to run an automated simulation. Tcl/Tk scripts are executed in Active-HDL similarly to the macro command files.

•    Select the TCL/TK file in the Design Browser window, then choose 
   the Execute command from the context menu.

The simulation is controlled from within the Tcl/Tk window by clicking appropriate buttons or sliding the scroll bars.

3.26  Using BASIC and Perl Scripts

Active-HDL allows you to work with Perl and Visual Basic scripts as well.

•  Perl and Basic scripts can be invoked from the Design Browser or from the Console window.

•  To execute a script file in the Design Browser, add it to the design using the Add New File wizard. Then click the script file name and choose the Execute option from the pop-up menu.

•  In the Console window, enter the script file name (without the file extension):

          runscript <scriptname> [ <parameter_value> ...]

Note: In order to execute scripts from the Console window without runscript prefix, BASIC scripts should be stored in the Scripts folder located in the Active-HDL home directory and Perl scripts should be stored in the Scripts/Perl folder.

3.27  Using BASIC and Perl Scripts

The command interpreter provides a few special features related to the string  interpretation:

•   Any string surrounded by brace brackets ({ }) is treated exactly as it looks.   This is useful when you use values (for example, strings with spaces or other special characters inside) that would be normally misinterpreted:

set time 10" --this command will fail (# Error: missing ")

set time {10"} --this command will succeed.

•  The exclamation mark (!) sign preceding a string allows executing system shell commands. The Console window also allows users to execute system shell commands.

 set --           displays the Aldec’s environment       variables, while

!set -- displays the system variables.

3.28  Using BASIC and Perl Scripts

•  Any string surrounded by square brackets ([ ]) is treated as a valid Active-HDL macro language subcommand and executed in the first place. The result of the subcommand replaces the square brackets before the higher level command runs. This is used for nesting commands.

•  The macro files can be easily created by using the GUI interface. Users can do this if the Command transcript on option in the Preferences | Environment | Console category is checked. When this option is checked, user's actions are translated into the Active-HDL Macro Language commands and displayed in the Console window. Then, they can be copied and pasted it to a new script file. The next time, that series of macro commands can be executed automatically as a script.