get_pblocks in RapidWright #1235
-
|
Hi RapidWright Experts, Is there a way to retrieve pblock information directly in RapidWright? I couldn't find a method like Thank you for your help! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
This is a great question. Typically, RapidWright relies on the pblock shape to be provided via a package com.xilinx.rapidwright.examples;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import com.xilinx.rapidwright.design.ConstraintGroup;
import com.xilinx.rapidwright.design.Design;
import com.xilinx.rapidwright.design.blocks.PBlock;
public class ExtractPBlock {
public static void main(String[] args) {
Design d = Design.readCheckpoint("test/RapidWrightDCP/microblazeAndILA_3pblocks.dcp");
Map<String, PBlock> pblocks = new HashMap<>();
for (ConstraintGroup cg : ConstraintGroup.values()) {
for (String tclLine : d.getXDCConstraints(cg)) {
if (tclLine.contains("resize_pblock")) {
// resize_pblock [get_pblocks pblock_base_mb_i] -add {CLOCKREGION_X1Y1:CLOCKREGION_X1Y1}
// resize_pblock [get_pblocks pblock_dbg_hub] -add {CLOCKREGION_X0Y1:CLOCKREGION_X0Y1}
// resize_pblock [get_pblocks pblock_u_ila_0] -add {CLOCKREGION_X2Y1:CLOCKREGION_X2Y1}
String name = tclLine.substring(tclLine.indexOf("[get_pblocks ") + 13,
tclLine.indexOf("]"));
String range = tclLine.substring(tclLine.indexOf("{") + 1, tclLine.indexOf("}"));
pblocks.put(name, new PBlock(d.getDevice(), range));
}
}
}
for (Entry<String, PBlock> e : pblocks.entrySet()) {
System.out.println(e.getKey() + "=" + e.getValue());
}
}
} |
Beta Was this translation helpful? Give feedback.
This is a great question. Typically, RapidWright relies on the pblock shape to be provided via a
String. However, it is possible with a bit of work to extract it from the XDC constraints stored in the DCP. RapidWright does not have a Tcl interpreter or Tcl-specific parsing capabilities (yet). However, if the pblock specification commands are consistent, you could extract them like this: