.. _Rename Port Across the Design Hierarchy:

Rename Port Across the Design Hierarchy
=======================================

When you want to uniformly name a port which is directly propagated across several levels of the design, you can use **Rename across the Design Hierarchy** refactoring.

If the port is directly connected to a sub instance port, then the sub instance port will also be renamed, and so on recursively across the whole sub design hierarchy tree.

If the port is directly connected to a parent instance port, then the parent instance port will also be renamed only if it is part of the current editor instance :ref:`Design Breadcrumb` path, and so on recursively up the design top.

For every port, both the definition and all its references are renamed.

Place the editor cursor on the port, **right click** and select **Refactor > Rename Port Across the Design Hierarchy**.

.. figure:: ../../images/common/rename_across_dh_trigger.png



A dialog pops-up and allows you to configure:

-  the new port name
-  whether you want to perform the refactoring only in **parent instances**, only in **sub-instances** or both
-  the maximum number of design hierarchy levels across which the renaming will be done; instances situated in the design hierarchy more than the specified number of levels above or below the starting point will not be affected

.. note:: 

 That the full hierarchical path to the refactoring starting port is highlighted in yellow.

.. figure:: ../../images/common/rename_across_dh_dialog.png



You can **preview the changes** in a :ref:`Schematic Diagrams`.

.. figure:: ../../images/common/rename_across_dh_diagram.png



The diagram shows all the instances, ports and port connections affected by the refactoring.

-  Instances reached from the refactoring starting point have **green background**
-  Instances situated elsewhere in the design but affected by the refactoring have **blue background**
-  Instances where name conflicts are detected have an **orange border**, and all the conflicting ports or signals are also shown

.. note:: 

 Naming conflicts can appear when:

 -  one of the affected instances already has a port or signal that has the new name
 -  several ports of the same module would be renamed

When done previewing, click the **Resume** button on the Diagram Editor top bar to return to the refactoring dialog. 

You can also preview the changes using a source code diff by clicking the **Preview >** button.

Click **OK** to perform the refactoring.


