Task Variables

Visual Studio Code supports variable substitution in Task configuration files. Beside these, DVT provides the following additional variables:

Variable

Arguments

Description

dvt.getActiveBuildConfigFullPath

Returns the full path to the currently used build configuration file

dvt.getActiveBuildConfigName

Returns the name of the currently used build configuration file, including its extension. Example: default.build

dvt.getPathToSignal

(SystemVerilog and VHDL only)

<separator> - [optional] Separator to be used when multiple signals are selected

Default value: \n

Returns the hierarchical full path of the signal under the cursor or of all the signals selected inside a diagram. The separator is used between multiple signals.

Example: soc.bus.tx / soc.bus.rx (separator set to /)

Note

You must place the cursor on a signal in your codebase or select at least one signal in a diagram before calling the task associated with this command.

dvt.simCompileFileList

(VHDL only)

"comp_deps" - [optional] If provided as first argument, the entities instantiated through components will also be considered a compilation dependency.

<file_path> - [optional] If provided as argument, all the files required for the compilation of the provided file are listed (including itself).

List of files compiled by DVT, in compilation dependency order, including library and compile syntax information. Each line in the variable expansion has the format:

<library> <language_syntax> <file_full_path>

Usage

If the task variable does to not take any arguments, or you do not want to pass any optional arguments, the variable value can be accessed directly using the VS Code Command Variable syntax: ${command:<variable_name>}

Print the name of the currently used build config
{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Print Active Build Config Name",
            "type": "shell",
            "command": "echo ${command:dvt.getActiveBuildConfigName}"
        }
    ]
}

To access and pass arguments to variables, you need to use the Input Variables syntax:

Print the path to the signals selected in diagram using / as separator
{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Print Path to Signals",
            "type": "shell",
            "command": "echo ${input:callCommand}"
        }
    ],
    "inputs": [
        {
            "id": "callCommand",
            "type": "command",
            "command": "dvt.getPathToSignal",
            "args": [
                "/"
            ]
        }
    ]
}