Product Documentation
Spectre AMS Designer and Xcelium Simulator Mixed-Signal User Guide
Product Version 22.09, September 2022

call

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 | -predefinedtask_or_function_name [arg1 [arg2 ...]]

call Command Options

This section describes the options that you can use with the Tcl call command.

 -systf [task_or_function_name

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 call command is also used to invoke functions from the VHDL C-interface, and there may be a user-defined C-interface function with the same name as a PLI system task or function. The -systf option causes the lookup in the C-interface task list to be skipped.

This option must appear before the task or function name on the command line.

You cannot use this option with the -predefined option.

The command call -systf with no task or function, the name argument displays a list of all registered user-defined system tasks and functions.

-predefined [function_name

Looks for the specified task or function name only in the table of predefined CFC library functions.

You cannot use the -predefined option when calling a user-defined system task or function.

This option must appear before the CFC function name on the command line.

You cannot use this option with the -systf option.

The command call -predefined with no function, the name argument displays a list of all predefined C function names.

call Command Arguments

Arguments to the system task or function can be either literals or names.

Literals can be:

xcelium> call mytask 5 
xcelium> call mytask 5 7 

xcelium> call mytask 3.4 
xcelium> call mytask 22.928E+10 

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\" 

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.

The 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




 ⠀
X