From 8222132d42b8bc03d29153957343293d9fb97658 Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Thu, 13 Jun 2024 02:58:02 -0700 Subject: [PATCH] Address review comments Signed-off-by: Eddie Hung --- .../interchange/DeviceResourcesWriter.java | 8 +++++--- src/com/xilinx/rapidwright/timing/DelayModel.java | 13 +++++-------- .../xilinx/rapidwright/timing/SmallDelayModel.java | 6 +++--- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/com/xilinx/rapidwright/interchange/DeviceResourcesWriter.java b/src/com/xilinx/rapidwright/interchange/DeviceResourcesWriter.java index f0e700b7d..ba5d67480 100644 --- a/src/com/xilinx/rapidwright/interchange/DeviceResourcesWriter.java +++ b/src/com/xilinx/rapidwright/interchange/DeviceResourcesWriter.java @@ -117,6 +117,8 @@ public class DeviceResourcesWriter { private static DelayEstimatorBase delayEstimator; private static DelayModel intrasiteAndLogicDelayModel; + private static final float PICSECONDS_TO_SECONDS = 1e-12f; + public static void populateSiteEnumerations(SiteInst siteInst, Site site) { if (!siteTypes.containsKey(siteInst.getSiteTypeEnum())) { if (site.getSiteTypeEnum() != siteInst.getSiteTypeEnum()) { @@ -662,7 +664,7 @@ public static void writeAllSiteTypesToBuilder(Design design, Device device, Devi if (delayPs != null && delayPs > 0) { DeviceResources.Device.CornerModel.Builder delayBuilder = spBuilder.initDelay(); DeviceResources.Device.CornerModelValues.Builder slowBuilder = delayBuilder.initSlow().initSlow(); - slowBuilder.initMax().setMax(delayPs * 1e-12f); + slowBuilder.initMax().setMax(delayPs * PICSECONDS_TO_SECONDS); } } } @@ -855,7 +857,7 @@ public static Map writeAllTileTypesToBuilder(Design desig DeviceResources.Device.PIPTiming.Builder timingBuilder = pipTimingsBuilder.get(index); DeviceResources.Device.CornerModel.Builder delayBuilder = timingBuilder.initInternalDelay(); DeviceResources.Device.CornerModelValues.Builder slowBuilder = delayBuilder.initSlow().initSlow(); - slowBuilder.initMax().setMax(slowMaxDelayPs * 1e-12f); + slowBuilder.initMax().setMax(slowMaxDelayPs * PICSECONDS_TO_SECONDS); } return tileTypeIndicies; @@ -961,7 +963,7 @@ public static void writeAllWiresAndNodesToBuilder(Device device, DeviceResources DeviceResources.Device.CornerModelValues.Builder resBuilder = timingBuilder.initResistance().initSlow().initSlow(); resBuilder.initMax().setMax(slowMaxDelayPs); DeviceResources.Device.CornerModelValues.Builder capBuilder = timingBuilder.initCapacitance().initSlow().initSlow(); - capBuilder.initMax().setMax(1e-12f); + capBuilder.initMax().setMax(PICSECONDS_TO_SECONDS); } } private static void populatePackages(StringEnumerator allStrings, Device device, DeviceResources.Device.Builder devBuilder) { diff --git a/src/com/xilinx/rapidwright/timing/DelayModel.java b/src/com/xilinx/rapidwright/timing/DelayModel.java index 3d5cdce39..8a8e5927e 100644 --- a/src/com/xilinx/rapidwright/timing/DelayModel.java +++ b/src/com/xilinx/rapidwright/timing/DelayModel.java @@ -53,14 +53,13 @@ public interface DelayModel { /** * Get the delay in ps between two bel pins within the given site name. * - * @param siteTypeName The name of the site type, such as SLICEL and SLICEM. + * @param siteType The SiteTypeEnum of BEL site, such as SLICEL and SLICEM. * @param frBelPin The bel pin which is the driver of the connection. Thus, it must be a bel output pin. * The bel name must be included, ie., AFF2/D. An input site pin is considered a valid frBelPin. * @param toBelPin The bel pin which is the sink of the connection (a bel input pin, or an output site pin). - * @return Intra-site delay in ps. Return -1 if the connection does not exist. - * @throws IllegalArgumentException if the given siteTypeName is not recognized by the model. + * @return Intra-site delay in ps. Return null if the connection does not exist. */ - public Short getIntraSiteDelay(SiteTypeEnum siteTypeName, String frBelPin, String toBelPin); + public Short getIntraSiteDelay(SiteTypeEnum siteType, String frBelPin, String toBelPin); /** * Get the delay between input and output pins of a bel. @@ -74,8 +73,7 @@ public interface DelayModel { * Where to get the config's value from the design? * There is no uniform way to find the value. It is to determined per case. * For example, some configs of carry8 is from bel, while some from cell. - * @return Logic delay in ps. Return -1 if the connection does not exist. - * @throws IllegalArgumentException if the given bel is not recognized by the model. + * @return Logic delay in ps. Return null if the connection does not exist. */ public Short getLogicDelay(short belIdx, String frBelPin, String toBelPin, int encodedConfig); @@ -85,8 +83,7 @@ public interface DelayModel { * @param belIdx The unique BEL timing model index, see {@link #getBELIndex(String)}. * @param frBelPin An input bel pin. It must NOT include bel name. * @param toBelPin An output bel pin. It must NOT include bel name. - * @return Logic delay in ps. Return -1 if the connection does not exist. - * @throws IllegalArgumentException if the given bel is not recognized by the model. + * @return Logic delay in ps. Return null if the connection does not exist. */ public Short getLogicDelay(short belIdx, String frBelPin, String toBelPin); diff --git a/src/com/xilinx/rapidwright/timing/SmallDelayModel.java b/src/com/xilinx/rapidwright/timing/SmallDelayModel.java index 4c618dd2b..ad27ab635 100644 --- a/src/com/xilinx/rapidwright/timing/SmallDelayModel.java +++ b/src/com/xilinx/rapidwright/timing/SmallDelayModel.java @@ -65,10 +65,10 @@ public Short getBELIndex(String belName) { /** * Implement the method with the same signature defined in DelayModel interface. */ - public Short getIntraSiteDelay(SiteTypeEnum siteTypeName, String frBelPin, String toBelPin) { + public Short getIntraSiteDelay(SiteTypeEnum siteType, String frBelPin, String toBelPin) { boolean verbose = false; Short delay; - Short idx = site2IdxMap.get(siteTypeName.name()); + Short idx = site2IdxMap.get(siteType.name()); if (idx == null) { return null; // throw new IllegalArgumentException("SmallDelayModel: Unknown site/belName to getIntraSiteDelay." @@ -80,7 +80,7 @@ public Short getIntraSiteDelay(SiteTypeEnum siteTypeName, String frBelPin, Strin if (delay == null) { if (verbose) { System.out.println("WARNING in SmallDelayModel: Unknown connection to getIntraSiteDelay." - + " site/belName " + siteTypeName + " frBelPin " + frBelPin + " toBelPin " + toBelPin); + + " site/belName " + siteType + " frBelPin " + frBelPin + " toBelPin " + toBelPin); } } }