.. _Template Configuration:

Template Configuration
======================

.. _template-config.xml:

template-config.xml
~~~~~~~~~~~~~~~~~~~

You may use the **template-config.xml** file in the template directory to:

-  specify default values and description for the parameters
-  define template parameter filters

.. code-block:: xml
  :caption: template-config.xml file syntax

  <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  <!DOCTYPE template-config PUBLIC "-//DVT//template_config" "template_config.dtd">
  <template-config version="1">
    <parameter-config name="pn" default-value="i2c" description="Package Name"/>
    <parameter-filter type="REJECT" identifier="__main__" path="*.py"/>
  </template-config>


The **<parameter-config>** tag allows you to define default values and description for parameters. Attributes:

-  **name**: the parameter name, excluding surrounding double underscores / **x_..._x** (mandatory)
-  **default-value**: the default value to be used when generating a project from template
-  **description**: the description to be displayed in the wizard when generating a project from template

If a config is specified multiple times for the same parameter, the last one has precedence. 
If a :ref:`template.config` file is also present in the template it has a lower priority (that is, it is analyzed before the template-config.xml).

  
The **<parameter-filter>** tag allows you to skip replacement of particular identifiers in particular template files. Attributes:

-  **type**: ALLOW or REJECT (mandatory)
-  **identifier**: a simple pattern to be matched against the full template parameter identifier (including surrounding underscores or **x_..._x**)
-  **path**: a simple pattern to be matched against the full path of the template file

At least one of the identifier or path attributes must exist.
Filters are cumulative. For example in a particular file you can allow **only** identifiers matching **__tp_*__** like this:

.. code-block::
  
     <parameter-filter type="REJECT" identifier="*" path="*/template/file.sv"/>
     <parameter-filter type="ALLOW" identifier="__tp_*__" path="*/template/file.sv"/>
 
The following parameters are predefined:

-  **__user__** expands to current user name
-  **__date__** expands to current date
-  **__year__** expands to current year


.. _template.config:

template.config
~~~~~~~~~~~~~~~

Starting with DVT 19.1.37, this file is deprecated, use :ref:`template-config.xml` instead.

You may use the **template.config** file in the template directory to specify default values and description for the parameters:

-  name,value,description

pkg_prefix,ti_i2c,The verification component prefix

PKG_PREFIX,TI_I2C,For defines

Some parameters are predefined:

-  **__user__** expands to current user name
-  **__date__** expands to current date
-  **__year__** expands to current year


