The Tcl call command invokes a user-defined C-interface function, or a Verilog user-defined VPI system task or function, or a SystemC function from the command line.
call Command Syntax
call [-systf | -predefined] task_or_function_name [arg1 [arg2 ...]]
call Command Options
This section describes the options that you can use with the Tcl call command.
|
Looks for the specified task or function name only in the table of user-defined PLI system tasks and functions. This option is available because the This option must appear before the task or function name on the command line. You cannot use this option with the The command |
|
Looks for the specified task or function name only in the table of predefined CFC library functions. You cannot use the This option must appear before the CFC function name on the command line. You cannot use this option with the The command |
call Command Arguments
Arguments to the system task or function can be either literals or names.
Literals can be:
- Integers
xcelium> call mytask 5 xcelium> call mytask 5 7
- Reals
xcelium> call mytask 3.4 xcelium> call mytask 22.928E+10
- Strings
Strings must be enclosed in double quotes. Enclose strings in curly braces or use the backslash character to escape quotes, spaces, and other characters that have special meaning to Tcl. For example:
xcelium> call mytask {"hello world"} xcelium> call mytask \"hello\ world\"
- Verilog literals, such as
8'h1f
Names can be full or relative path names of instances or objects. Relative pathnames are relative to the current debug scope (set by the scope command). Object names can include a bit select or part select. For example:
xcelium> call mytask top.u1
xcelium> call mytask top.u1.reg[3:5]
Expressions that include operators or function calls are not allowed. For example, the following two commands result in an error:
xcelium> call \$mytask a+b
xcelium> call \$mytask {func a}
However, literals can be created using Tcl's expr command. For example, if the desired argument is the expression (a+b), use the following:
xcelium> call \$mytask [expr #a + #b]
The result of the expression (a+b) is substituted on the command line and then treated by the call command as a literal.
expr command cannot evaluate calls to Verilog functions.If you are calling a user-defined system function, the result of the call command is the return value from the system function. Therefore, user-defined system functions can be used to generate literals for other commands. For example:
xcelium> call task [call func arg1 ...]
xcelium> force a = [call func arg1 ...]
call Command Examples
The following Verilog module contains a call to a user-defined system task and to a system function. The task and function can also be started from the command line.
module test();
initial begin $hello_task(); $hello_task($hello_func()); end endmodule
The following command starts the $hello_task system task:
xcelium> call \$hello_task
This task can also be started with any of the following:
xcelium> call hello_task xcelium> call {$hello_task} xcelium> call {hello_task}
The $hello_func function can be started with any of the following commands:
xcelium> call \$hello_func xcelium> call hello_func xcelium> call {$hello_func} xcelium> call {hello_func}
In the following command, the call command calls the $hello_task system task with a call to the system function $hello_func as an argument.
xcelium> call hello_task [call hello_func]
The following command displays a list of all registered user-defined system tasks and functions.
xcelium> call -systf
