Xilinx / RapidWright

Build Customized FPGA Implementations for Vivado
http://www.rapidwright.io
Other
276 stars 106 forks source link

make blackblox issue #967

Open pwang7 opened 4 months ago

pwang7 commented 4 months ago

I'm using MakeBlackbox in my design following the tutorial Reuse Timing-closed Logic As A Shell .

In my design, I use two hard IPs: XDMA and CMAC. However, after I cut several blackboxes from my logic, some modules of XDMA and CMAC become blackbox too, such as udma_wrapper, ram_top, i_cmac_usplus_0_top, as depicted in the attached pictures:

1945516018 1240702647 782670545

How to avoid affecting IP modules when making blackboxes?

clavin-xlnx commented 4 months ago

RapidWright is unable to decrypt netlists and most IPs have their netlist encrypted. Thus, when you load a DCP back into Vivado from RapidWright, you often cannot simply reload the DCP from RapidWright, but you need to use the Tcl script that gets generated when encrypted IPs are detected. This way, the Tcl script is able to reassemble the encrypted portions back into the top level design. If this is not done, the IPs will look like black boxes.

When you write out the DCP from RapidWright, do you see a message about using a Tcl script to load the design back into Vivado? The message may looks something like "...may contain encrypted cells. To correctly load the design into Vivado please source this Tcl script to open the checkpoint:..."

pwang7 commented 4 months ago

RapidWright is unable to decrypt netlists and most IPs have their netlist encrypted. Thus, when you load a DCP back into Vivado from RapidWright, you often cannot simply reload the DCP from RapidWright, but you need to use the Tcl script that gets generated when encrypted IPs are detected. This way, the Tcl script is able to reassemble the encrypted portions back into the top level design. If this is not done, the IPs will look like black boxes.

When you write out the DCP from RapidWright, do you see a message about using a Tcl script to load the design back into Vivado? The message may looks something like "...may contain encrypted cells. To correctly load the design into Vivado please source this Tcl script to open the checkpoint:..."

Thanks Chris! Now I can successfully load the shell DCP.

After load the shell DCP, I read back the DCP for the blackbox,

read_checkpoint -cell <CELL_NAME> <BLACKBOX_SYNTH.dcp>

and tried to place design. However, Vivado gives me another error:

ERROR: [Common 17-53] User Exception: No open design. Please open an elaborated, synthesized or implemented design before executing this command.

I guess Vivado is in non-project mode after read checkpoint, then how to open design?

clavin-xlnx commented 4 months ago

When you load the DCP from a Tcl script, Vivado will be in project mode. You can try writing out a new DCP after loading it via Tcl and then re-opening the newly written DCP in Vivado and try that to see if it alleviates the error message you are seeing.

However, this error is puzzling and makes me think that either the wrong window was active when you ran the read_checkpoint -cell command as you should not have to write out the DCP a second time in Vivado to make this work.

pwang7 commented 4 months ago

When you load the DCP from a Tcl script, Vivado will be in project mode. You can try writing out a new DCP after loading it via Tcl and then re-opening the newly written DCP in Vivado and try that to see if it alleviates the error message you are seeing.

However, this error is puzzling and makes me think that either the wrong window was active when you ran the read_checkpoint -cell command as you should not have to write out the DCP a second time in Vivado to make this work.

Thanks Chris! Writing out a new DCP after loading encrypted netlists via Tcl, it works.

However, when I use the latest version, rapidwright-2023.2.1-standalone-lin64.jar, MakeBlackbox reports the following runtime exception:

==============================================================================
==                               MakeBlackbox                               ==
==============================================================================
                Read DCP:     9.741s
Exception in thread "main" java.lang.RuntimeException: ERROR: Cell corresponding to pin 'cmac_inst/inst/i_cmac_usplus_0_top/ctl_rx_check_etype_gcp' not found.
        at com.xilinx.rapidwright.eco.ECOTools.connectNet(ECOTools.java:402)
        at com.xilinx.rapidwright.eco.ECOTools.createAndPlaceInlineCellOnInputPin(ECOTools.java:1171)
        at com.xilinx.rapidwright.design.DesignTools.prepareShellBlackBoxForRouting(DesignTools.java:4013)
        at com.xilinx.rapidwright.util.MakeBlackBox.main(MakeBlackBox.java:53)

Previously, I used rapidwright-2023.2.0-standalone-lin64.jar, and MakeBlackbox works.

clavin-xlnx commented 4 months ago

However, when I use the latest version, rapidwright-2023.2.1-standalone-lin64.jar, MakeBlackbox reports the following runtime exception:

==============================================================================
==                               MakeBlackbox                               ==
==============================================================================
                Read DCP:     9.741s
Exception in thread "main" java.lang.RuntimeException: ERROR: Cell corresponding to pin 'cmac_inst/inst/i_cmac_usplus_0_top/ctl_rx_check_etype_gcp' not found.
        at com.xilinx.rapidwright.eco.ECOTools.connectNet(ECOTools.java:402)
        at com.xilinx.rapidwright.eco.ECOTools.createAndPlaceInlineCellOnInputPin(ECOTools.java:1171)
        at com.xilinx.rapidwright.design.DesignTools.prepareShellBlackBoxForRouting(DesignTools.java:4013)
        at com.xilinx.rapidwright.util.MakeBlackBox.main(MakeBlackBox.java:53)

Previously, I used rapidwright-2023.2.0-standalone-lin64.jar, and MakeBlackbox works.

Would you be able to provide an example design that triggers this error? It appears that it might be a bug and a test case would make it much easier to reproduce and diagnose.

pwang7 commented 4 months ago

However, when I use the latest version, rapidwright-2023.2.1-standalone-lin64.jar, MakeBlackbox reports the following runtime exception:

==============================================================================
==                               MakeBlackbox                               ==
==============================================================================
                Read DCP:     9.741s
Exception in thread "main" java.lang.RuntimeException: ERROR: Cell corresponding to pin 'cmac_inst/inst/i_cmac_usplus_0_top/ctl_rx_check_etype_gcp' not found.
        at com.xilinx.rapidwright.eco.ECOTools.connectNet(ECOTools.java:402)
        at com.xilinx.rapidwright.eco.ECOTools.createAndPlaceInlineCellOnInputPin(ECOTools.java:1171)
        at com.xilinx.rapidwright.design.DesignTools.prepareShellBlackBoxForRouting(DesignTools.java:4013)
        at com.xilinx.rapidwright.util.MakeBlackBox.main(MakeBlackBox.java:53)

Previously, I used rapidwright-2023.2.0-standalone-lin64.jar, and MakeBlackbox works.

Would you be able to provide an example design that triggers this error? It appears that it might be a bug and a test case would make it much easier to reproduce and diagnose.

I uploaded my design post_route.dcp to Google drive. The command to reproduce this exception is:

java -cp ./rapidwright-2023.2.1-standalone-lin64.jar com.xilinx.rapidwright.util.MakeBlackBox post_route.dcp shell.dcp bsv_userlogic_top_inst/bsvTopCore/sq
clavin-xlnx commented 4 months ago

Thanks, I have reproduced the issue and will starting working on a fix once we root cause the error.

clavin-xlnx commented 4 months ago

I have created a fix for the issue, you can find it in #970. Let us know how it goes.

pwang7 commented 4 months ago

I have created a fix for the issue, you can find it in #970. Let us know how it goes.

Great! Let me try it.