How to modify a routed dcp?

154 views
Skip to first unread message

Jiang Weixiong

unread,
Apr 8, 2020, 12:43:25 AM4/8/20
to RapidWright
I'm a beginner at RapidWright and I'm trying to modify a routed dcp. 
The figure below is the block diagram of the routed dcp, I want to add an additional net to connect clk_wiz/clk_out1 to D6 pin.

1.PNG























My code is given below
public class ConnectMMCM {
   public static void main(String[] args) {
       if(args.length != 1) {
           System.out.println("USAGE: <dcp_file_name>");
           return;
       }
       Design design = Design.readCheckpoint(args[0]);

        Cell led0 = design.createAndPlaceIOB("led0", PinType.OUT, "D6", "LVCMOS33");
       Cell mmcm = null;
       for(Cell c : design.getCells()){
           if(c.getBEL().getName().contains("BUFCE"))
           {
               if(c.getSiteInst().getName().contains("BUFGCE_X0Y122"))
               {
                   mmcm = c;
               }  
            }
       }
       System.out.println(mmcm);
       
       Net clkout_net = design.createNet("clkout_net");
       clkout_net.connect(led0, "I");
       clkout_net.connect(mmcm, "O");
           
       design.routeSites();
       new Router(design).routeDesign();
       design.writeCheckpoint("HelloWorld.dcp");
   }
}
I load the routed dcp file first and then get the clk_wiz's clock out1, which is assigned to 
BUFGCE_X0Y122.
After that, I create a new net and try to connect the BUFCE_X0Y122 with the D6 pin.
However, it seems that it does not work
jiangwx@mb450itx:~/2020/RapidWright/RapidWright$ java com.xilinx.rapidwright.examples.ConnectMMCM workspace/zcu104_rw1/zcu104_rw1.runs/impl_1/step1_wrapper_routed.dcp 
==============================================================================
==                  Reading DCP: step1_wrapper_routed.dcp                   ==
==============================================================================
 XML Parse & Device Load:     0.712s
              EDIF Parse:     1.214s
        Read XDEF Header:     0.013s
        Read XDEF Caches:     0.060s
     Read XDEF Placement:     0.635s
       Read XDEF Routing:     0.544s
------------------------------------------------------------------------------
         [No GC] *Total*:     3.177s
step1_i/clk_wiz_0/inst/CLK_CORE_DRP_I/clk_inst/clkout1_buf(BEL: BUFCE)
Exception in thread "main" java.lang.RuntimeException: ERROR: Unable to route step1_i/clk_wiz_0/inst/CLK_CORE_DRP_I/p_0_out__0__0_i_43_n_0 in site SLICE_X59Y179
        at com.xilinx.rapidwright.design.SiteInst.routeSite(Unknown Source)
        at com.xilinx.rapidwright.design.Design.routeSites(Unknown Source)
        at com.xilinx.rapidwright.examples.ConnectMMCM.main(ConnectMMCM.java:38)
So could anyone tell me how to modify a routed dcp?

RapidWright

unread,
Apr 13, 2020, 1:30:46 PM4/13/20
to rapid...@googlegroups.com
My apologies for the late reply, but it does not appear that there is anything wrong with the approach you are taking from just looking at the code.  The error message seems to point at a deficiency in the RapidWright router with the particular DCP you are using.  The router is failing to route a different net than you are creating. If you happen to still have the DCP, feel free to post it and I could try taking a look.  

One other note, the for loop you have in finding the BUFCE Cell at BUFGCE_X0Y122, could be replaced with a call like this:

mmcm = d.getSiteInstFromSiteName("BUFGCE_X0Y122").getCell("BUFCE");


Message has been deleted

jiangwx

unread,
Apr 20, 2020, 2:02:09 AM4/20/20
to RapidWright
Hi 

I feel sorry for reply so late.
The attachment is the routed dcp file, looking forward to your reply!

Thank you very much.

在 2020年4月14日星期二 UTC+8上午1:30:46,RapidWright写道:

RapidWright

unread,
Apr 21, 2020, 9:26:45 PM4/21/20
to RapidWright
Thanks for the DCP, after taking a look, it does seem that changes to your approach were needed.  I also did have to make a few changes to RapidWright to get a good solution so you'll want to pull the latest changes from GitHub.  Here is my code:

import java.util.ArrayList;

import com.xilinx.rapidwright.design.Cell;
import com.xilinx.rapidwright.design.Design;
import com.xilinx.rapidwright.design.PinType;
import com.xilinx.rapidwright.design.SitePinInst;
import com.xilinx.rapidwright.edif.EDIFHierPortInst;
import com.xilinx.rapidwright.edif.EDIFNet;
import com.xilinx.rapidwright.edif.EDIFNetlist;
import com.xilinx.rapidwright.edif.EDIFTools;
import com.xilinx.rapidwright.router.Router;

public class ConnectMMCM {
    
    public static void main(String[] args) {
        if(args.length != 1) {
            System.out.println("USAGE: <dcp_file_name>");
            return;
        }
        Design design = Design.readCheckpoint(args[0]);   

        // Create our D6 input clock IO
        Cell clkInputIO = design.createAndPlaceIOB("clkInputIO", PinType.IN, "D6", "LVCMOS33");
        
        // Grab a hold of the current BUFG being driven by the MMCM
        Cell mmcmBUFG = design.getSiteInstFromSiteName("BUFGCE_X0Y122").getCell("BUFCE");
        System.out.println(mmcmBUFG);

        // Create our new net driven by the clk from D6
        String clkInputNetName = "myNewClkNet";
        Net clkInputNet = design.createNet(clkInputNetName);
        clkInputNet.connect(clkInputIO, "O");
        
        // Disconnect it logically from the MMCM
        EDIFNet targetNet = mmcmBUFG.getEDIFCellInst().getPortInst("I").getNet();
        targetNet.removePortInst("mmcme4_adv_inst/CLKOUT0");
        
        // Disconnect it physically from the MMCM
        SitePinInst sink = mmcmBUFG.getSitePinFromLogicalPin("I", null);
        sink.getNet().removeSource();
        clkInputNet.addPin(sink);
        
        // Logically connect the clk net through levels of hierarchy to reach the MMCM BUFG
        EDIFHierPortInst src = new EDIFHierPortInst(
                                    EDIFNetlist.getHierParentName(clkInputNet.getName()),
                                    clkInputNet.getLogicalNet().getPortInst("clkInputIO_IBUF_inst/O")
                                    );
        EDIFHierPortInst snk = new EDIFHierPortInst(
                                    EDIFNetlist.getHierParentName(mmcmBUFG.getName()),
                                    targetNet.getPortInst("clkout1_buf/I")
                                    );
        EDIFTools.connectPortInstsThruHier(src, snk, design.getNetlist(), clkInputNetName);
        
        // Route just the sites we touched
        clkInputIO.getSiteInst().routeSite();
        mmcmBUFG.getSiteInst().routeSite();

        // Just route the MMCM BUFG input pin, keep everything else the same
        Router router = new Router(design);
        ArrayList<SitePinInst> sinks = new ArrayList<>();
        sinks.add(sink);
        router.routePinsReEntrant(sinks, false);

        design.writeCheckpoint("ClockSourcedFromD6.dcp");
    }
}

This code loads in your DCP, instantiates an IO at D6, disconnects the MMCM output to the BUFG and connects the D6 input instead and routes the design.  A few things to note, when making changes, you have to be aware of both the logical and physical netlist representations and update each accordingly.  Also, the design had multiple levels of hierarchy between the desired source (D6) and the sink (BUFG).  This means that multiple nets and ports have to be created in order to make the connection.  I added a method in EDIFTools to enable this (see https://github.com/Xilinx/RapidWright/blob/master/src/com/xilinx/rapidwright/edif/EDIFTools.java#L454).  Here are the results in Vivado's schematic tool: 

ConnectMMCM.png


jiangwx

unread,
Apr 22, 2020, 8:30:09 AM4/22/20
to RapidWright
Thank you very very much for your detailed reply!
I will have a try.

qaarah

unread,
May 30, 2020, 9:07:07 AM5/30/20
to RapidWright
Hi, 
Thanks for the post and the code. I am following this post for my practice and learning of RapidWright. I am also new and have posted a question already, https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!topic/rapidwright/30gqjO0J29I
where I want to add an additional net from the output of a register (Could also be a LUT) to drive one of the available IO pins. Considering the above dcp, could you please provide a code for that as well. 
Thanks, 
Best Regards, 
Qaa
Reply all
Reply to author
Forward
0 new messages