Managing Macros - 2022.1 English

Vivado Design Suite User Guide: Using Constraints (UG903)

Document ID
UG903
Release Date
2022-06-01
Version
2022.1 English

Macros are stored as XDC constraints. By definition, they are Tcl commands. This allows the macros to be used in both XDC constraint files and Tcl scripts, and used interactively.

Macros are written using the write_xdc command. Macros are read using the read_xdc command. The -cell option can be used to limit scope to particular cells.

The -cell option is particularly useful for applying a relative placement from one macro to similar instances in different hierarchies.

Managing Macros Example One

Write all XDC constraints in memory, including macros:

% write_xdc constrs.xdc

Managing Macros Example Two

A design contains three instances of a cell:

inst_0, inst_1, and inst_2.

A macro is created inside inst_0:

% create_macro m0
% update_macro m0 {reg0 X0Y0 reg1 X0Y1}
% write_xdc -cell inst_0 inst_0.xdc

Managing Macros Example Three

Write all XDC constraints including macro m0, for the cell inst_0:

% write_xdc -cell inst_0.xdc inst_0.xdc

Managing Macros Example Four

Read the XDC constraints including the macro m0 from cell inst_0, and apply it to inst_1 and inst_2:

% read_xdc inst_0 -cell {inst_1 inst_2}
% get_macros
m0 inst_1_m0 inst_2_m0
Tip: When a macro is read and applied to another cell using the -cell option, the new macro name must be unique. The cell name is applied as a prefix to the macro name to create a unique macro name. In Example Four, two new unique macros were created. They are inst_1_m0 and inst_2_m0.