Converting RPMs to XDC Macros - 2023.2 English

Vivado Design Suite User Guide: Using Constraints (UG903)

Document ID
UG903
Release Date
2023-11-01
Version
2023.2 English
It is recommended to convert RPMs to XDC macros wherever feasible because XDC macros are the preferred method of implementing relative placement constraints. This process can be done manually by removing the RPM attributes from the HDL sources and creating equivalent XDC macros. Conversion can also be done somewhat automatically by using Tcl to replace RPM attributes with XDC macro constraints.

The automated process consists of the following steps:

  1. In all HDL sources, replace each RPM attribute with a similarly named string, for example:
    • Replace hu_set with m_hu_set
    • Replace u_set with m_u_set
    • Replace rloc with m_rloc

    This ensures that the RPMs are not processed however the inactive attributes are passed through to the synthesized netlist as cell properties.

  2. Open the synthesized design or run link_design and create XDC macros based on the inactive properties. For example, each HU_SET has a cell property called m_hu_set that can be used to create the equivalent XDC macro. Each cell within the original HU_SET has a property m_rloc that can be converted to an RLOC.
  3. Save the constraints which now include the XDC macros definitions.

The conversion is best accomplished using Tcl by building XDC macros cell lists based on their unique m_hu_set or m_uset values. Following is a simple VHDL conversion example.

The original VHDL source includes a HU_SET RPM called set0 with two cells, one with RLOC X0Y0 and the other with RLOC X0Y1.

signal r0 : std_logic; 
signal r1 : std_logic;

attribute hu_set : string; 
attribute rloc : string;

attribute hu_set of r0 : signal is "set0"; 
attribute hu_set of r1 : signal is "set0";

attribute rloc of r0 : signal is "X0Y0"; 
attribute rloc of r1 : signal is "X0Y1";

Next the VHDL source is modified to replace hu_set and RLOC with similarly named but inactive attributes:

signal r0 : std_logic; 
signal r1 : std_logic;

attribute m_hu_set : string; 
attribute m_rloc : string;

attribute m_hu_set of r0 : signal is "set0"; 
attribute m_hu_set of r1 : signal is "set0";

attribute m_rloc of r0 : signal is "X0Y0"; 
attribute m_rloc of r1 : signal is "X0Y1";

After synthesis, the cells can be filtered based on these similarly named properties:

Vivado% get_cells -filter {m_hu_set == "set0"} 
r0_reg r1_reg

Vivado% get_property m_rloc [get_cells {r0_reg r1_reg}] 
X0Y0 X0Y1

This provides the necessary information to create an XDC macro to replace the RPM:

Vivado% create_macro set0
Vivado% update_macro set0 {r0_reg X0Y0 r1_reg X0Y1}

These two XDC constraints can be saved as part of the design constraints. Large amounts of RPM conversions are better handled using a Tcl script. Following is an example script to convert HU_SET RPMs to XDC macros.

# create a sorted list of all unique RPMs according to m_hu_set values 
set RPMs [lsort -uniq [get_property m_hu_set [get_cells -hier -filter
{primitive_level != INTERNAL}]]]

# remove the first element which is empty (no m_hu_set property) 
set RPMs [lrange $RPMs 1 end]

# iterate over list of RPMs, convert each to an XDC macro
# get each RPM cell of the RPM with its RLOC
# build a list for the update_macro command
foreach rpm $RPMs {
  create_macro $rpm
  set cells [get_cells -hier -filter "m_hu_set == $rpm"]
  set rlocs [list]
  foreach cell $cells { lappend rlocs $cell
    lappend rlocs [get_property m_rloc $cell]
  }
  update_macro $rpm $rlocs
  puts "created XDC macro $rpm, cell list: rlocs"
} 
foreach rpm $RPMs {
create_macro $rpm
set cells [get_cells -hier -filter "m_hu_set == $rpm"] set rlocs [list]
foreach cell $cells { lappend rlocs $cell
lappend rlocs [get_property m_rloc $cell]
}
update_macro $rpm $rlocs
puts "created XDC macro $rpm, cell list: $rlocs"
}