diff --git a/.github/workflows/check-git-submodules.yml b/.github/workflows/check-git-submodules.yml index dbe52a759..161f57719 100644 --- a/.github/workflows/check-git-submodules.yml +++ b/.github/workflows/check-git-submodules.yml @@ -2,8 +2,6 @@ name: Submodule refs on origin on: pull_request: - branches: - - master jobs: check: diff --git a/src/com/xilinx/rapidwright/util/VivadoTools.java b/src/com/xilinx/rapidwright/util/VivadoTools.java index 67ca7b5de..183fd4fbd 100644 --- a/src/com/xilinx/rapidwright/util/VivadoTools.java +++ b/src/com/xilinx/rapidwright/util/VivadoTools.java @@ -39,6 +39,7 @@ public class VivadoTools { public static final String REPORT_ROUTE_STATUS = "report_route_status"; public static final String PLACE_DESIGN = "place_design"; + public static final String ROUTE_DESIGN = "route_design"; public static final String WRITE_CHECKPOINT = "write_checkpoint"; public static final String WRITE_EDIF = "write_edif"; @@ -337,11 +338,49 @@ public static Design placeDesign(Path dcp, Path workdir, boolean encrypted) { } /** - * Run Vivado's `get_timing_paths -setup` command on the provided DCP path - * (to find its worst setup timing path) and return its SLACK property as a float. - * - * @param dcp Path to DCP to report on. + * Run Vivado's `route_design` command on the design provided and get the + * `report_route_status` results. Note: this method does not preserve the routed + * output from Vivado. + * + * @param design The design to route and report on. * @param workdir Directory to work within. + * @return The results of `report_route_status`. + */ + public static ReportRouteStatusResult routeDesignAndGetStatus(Design design, Path workdir) { + boolean encrypted = !design.getNetlist().getEncryptedCells().isEmpty(); + Path dcp = workdir.resolve("routeDesignAndGetStatus.dcp"); + design.writeCheckpoint(dcp); + return routeDesignAndGetStatus(dcp, workdir, encrypted); + } + + /** + * Run Vivado's `route_design` command on the provided DCP path and return the + * `report_route_status` results. Note: this method does not preserve the routed + * output from Vivado. + * + * @param dcp Path to DCP to route and report on. + * @param workdir Directory to work within. + * @param encrypted Indicates whether DCP contains encrypted EDIF cells. + * @return The results of `report_route_status`. + */ + public static ReportRouteStatusResult routeDesignAndGetStatus(Path dcp, Path workdir, boolean encrypted) { + final Path outputLog = workdir.resolve("outputLog.log"); + + StringBuilder sb = new StringBuilder(); + sb.append(createTclDCPLoadCommand(dcp, encrypted)); + sb.append(ROUTE_DESIGN + "; "); + sb.append(REPORT_ROUTE_STATUS + "; "); + + List log = VivadoTools.runTcl(outputLog, sb.toString(), true); + return new ReportRouteStatusResult(log); + } + + /** + * Run Vivado's `get_timing_paths -setup` command on the provided DCP path (to + * find its worst setup timing path) and return its SLACK property as a float. + * + * @param dcp Path to DCP to report on. + * @param workdir Directory to work within. * @param encrypted Indicates whether DCP contains encrypted EDIF cells. * @return Worst slack of design as float. */ diff --git a/test/RapidWrightDCP b/test/RapidWrightDCP index 85c47fd5d..9c4416ef7 160000 --- a/test/RapidWrightDCP +++ b/test/RapidWrightDCP @@ -1 +1 @@ -Subproject commit 85c47fd5d6e01b012b827bb9288f65a402a17e0a +Subproject commit 9c4416ef76e590988dda9036e8101768f5574730 diff --git a/test/shared/com/xilinx/rapidwright/util/VivadoToolsHelper.java b/test/shared/com/xilinx/rapidwright/util/VivadoToolsHelper.java index 4037bced3..b106dafa4 100644 --- a/test/shared/com/xilinx/rapidwright/util/VivadoToolsHelper.java +++ b/test/shared/com/xilinx/rapidwright/util/VivadoToolsHelper.java @@ -22,10 +22,11 @@ package com.xilinx.rapidwright.util; -import com.xilinx.rapidwright.design.Design; +import java.nio.file.Path; + import org.junit.jupiter.api.Assertions; -import java.nio.file.Path; +import com.xilinx.rapidwright.design.Design; public class VivadoToolsHelper { public static void assertFullyRouted(Design design) { @@ -45,4 +46,18 @@ public static void assertFullyRouted(Path dcp) { ReportRouteStatusResult rrs = VivadoTools.reportRouteStatus(dcp); Assertions.assertTrue(rrs.isFullyRouted()); } + + /** + * Ensures that the provided design can be routed successfully in Vivado. + * + * @param design The design to route. + * @param dir The directory to work within. + */ + public static void assertRoutedSuccessfullyByVivado(Design design, Path dir) { + if (!FileTools.isVivadoOnPath()) { + return; + } + ReportRouteStatusResult rrs = VivadoTools.routeDesignAndGetStatus(design, dir); + Assertions.assertTrue(rrs.isFullyRouted()); + } } diff --git a/test/src/com/xilinx/rapidwright/design/TestSiteInst.java b/test/src/com/xilinx/rapidwright/design/TestSiteInst.java index 3a371d385..a694bdbc5 100644 --- a/test/src/com/xilinx/rapidwright/design/TestSiteInst.java +++ b/test/src/com/xilinx/rapidwright/design/TestSiteInst.java @@ -29,11 +29,14 @@ import com.xilinx.rapidwright.device.Device; import com.xilinx.rapidwright.device.Series; import com.xilinx.rapidwright.support.RapidWrightDCP; +import com.xilinx.rapidwright.util.VivadoToolsHelper; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; +import java.nio.file.Path; import java.util.Arrays; public class TestSiteInst { @@ -365,4 +368,11 @@ public void testUnrouteSiteUpdatesNetSiteInsts() { Assertions.assertTrue(net.getSiteInsts().isEmpty()); } + + @Test + public void testSiteRouting(@TempDir Path dir) { + Design design = RapidWrightDCP.loadDCP("gnl_2_4_3_1.3_gnl_3000_07_3_80_80_placed.dcp"); + design.routeSites(); + VivadoToolsHelper.assertRoutedSuccessfullyByVivado(design, dir); + } }