.. _UVM Components Diagrams:

UVM Components Diagrams
=======================


**UVM Components Diagrams** help you inspect and document the structure of a verification environment.

To generate the diagram, **Right-click** in the :ref:`Verification Hierarchy View` and select **Show Diagram**. Note that the generated diagram might not be completely accurate because it's missing the runtime information.

The following operations are available in the **right-click** context menu:

-  **Go to Instance** Jump to the instantiation of the selected element in the source code.
-  **Go to Type** Jump to the declaration of the selected element's type. It is available for nodes and labeled edges.


.. figure:: ../../images/e_component_diagram.png
	:align: center



.. _UVM Diagram Filters:

Diagram Filters
~~~~~~~~~~~~~~~

.. |filters| image:: ../../images/common/filter.png
   :class: inline

You can customize the diagram using the *Filters* button |filters| in the diagram editor toolbar.

.. figure:: ../../images/common/filters-dialog-drv-mon.png
	:align: center



Use the drop-down menu at the top of the dialog to select from available filters.

Use the buttons in the top-right corner of the dialog to create, duplicate, or delete the current filter.

Use the checkboxes at the bottom of the dialog to further clean up the diagram.

A filter is defined using filter rules (one per line). The general form of a filter rule is:

.. code-block::
  :emphasize-text: matching using

    command element_kinds matching regex [using color_name_or_code]

-  *command* is one of **hide**, **show**, or **color**
-  *element_kinds* is a comma-separated list of kinds. The available kinds are **instances**, **types**, **ports**, **port types** and **transaction types**
-  *regex* is a regular expression that matches the relevant diagram element labels
-  *color_name_or_code* is a color specified by `name <https://www.w3.org/wiki/CSS3/Color/Extended_color_keywords>`_, *6- or 3-digit hexadecimal code*, *comma-separated decimal RGB code* or the keyword *random*. This is relevant only for **color** rules.

.. tip::

	You can use content assist to write the filters (*CTRL + Space*).

To apply a filter rule only to elements under a specific instance, you must provide the relevant path in the *regex* section of the rule:

-  a *path* must always begin with the name of the top instance in the diagram (if *instance* is under *top_instance*, then **top_instance/instance/...** is valid, while **instance/...** is not)
-  a *path* consists only of names of instances and "**/**"
-  each level is separated from the previous using "**/**" (valid: **top_instance/inst1/inst2/...**; not valid: **top_instance.inst1.inst2...**)
-  regular expressions may be used in the *path* section of a rule (for example, **top_instance/.*/some_instance**)
-  if the *regex* contains "**/**", everything before the last "/" is the *path*, the rest is used to match the relevant diagram elements (in the following example, the bolded text is the path: **top_instance/.*/inst1/**.*drv.*)
-  if the *regex* does not contain "**/**", it applies to all elements of the appropriate *element_kinds*

.. tip::

	You can hide the hierarchy under an instance with the filter "hide instances matching **path/to/instance/.***".

With the predefined filter in the image above, the resulting diagram will be similar to the following:

.. figure:: ../../images/common/component-diagram-filter-drv-mon.png
	:align: center





