Macros are stored as XDC constraints. Because they are Tcl commands, you can use them in both XDC constraint files and Tcl scripts, as well as interactively.
Write macros with the write_xdc command. Read macros with the
read_xdc command. Use the -cell option to
limit scope to specific cells. The -cell option is especially
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 macro m0 from cell
inst_0, and apply them to inst_1 and
inst_2:
% read_xdc inst_0.xdc -cell {inst_1 inst_2}
% get_macros
m0 inst_1_m0 inst_2_m0
-cell option, the new macro name must
be unique. The tool adds the cell name as a prefix to the macro name to create a
unique macro name. In example four, two new macros were created:
inst_1_m0 and inst_2_m0.