-
Notifications
You must be signed in to change notification settings - Fork 121
[VersalClockRouting] VDISTR tree storage map for Versal #1311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
clavin-xlnx
wants to merge
8
commits into
2025.2.0
Choose a base branch
from
versal_vdistr_clk
base: 2025.2.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
ada5afb
[VersalClockRouting] VDISTR tree storage map for Versal
clavin-xlnx c337264
Preliminary v80 support
clavin-xlnx 4b02f06
Refactoring to use preferred clk root; adds VersalClockTree object
clavin-xlnx 2a52068
Update storage format and file for vdistr paths on Versal
clavin-xlnx 7a73ccd
Increasing the search space for clock root column candidates
clavin-xlnx c84bffe
Apply suggestions from code review
clavin-xlnx 0c868d4
Add an assert
clavin-xlnx 0802222
Merge branch '2025.2.0' into versal_vdistr_clk
clavin-xlnx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,143 @@ | ||
| /* | ||
| * Copyright (c) 2025, Advanced Micro Devices, Inc. | ||
| * All rights reserved. | ||
| * | ||
| * Author: Chris Lavin, AMD Research and Advanced Development. | ||
| * | ||
| * This file is part of RapidWright. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| * | ||
| */ | ||
| package com.xilinx.rapidwright.router; | ||
|
|
||
| import java.util.ArrayList; | ||
| import java.util.Collections; | ||
| import java.util.List; | ||
| import java.util.Map; | ||
| import java.util.Set; | ||
|
|
||
| import com.xilinx.rapidwright.device.ClockRegion; | ||
| import com.xilinx.rapidwright.device.IntentCode; | ||
| import com.xilinx.rapidwright.util.Pair; | ||
|
|
||
| /** | ||
| * For a given clock region Y coordinate domain range (e.g. Y1-Y5), provides a | ||
| * set of clock root options with corresponding vertical distribution paths for | ||
| * each target clock region. | ||
| */ | ||
| public class VersalClockTree { | ||
|
|
||
| private int minMaxYKey; | ||
|
|
||
| private int preferredClockRootY; | ||
|
|
||
| /** | ||
| * The key to this map is the clock root y coordinate. The value is a list of | ||
| * vertical distribution paths for each target clock region. | ||
| */ | ||
| private Map<Integer, int[][]> clockRootPathSets; | ||
|
|
||
| /** | ||
| * Only used for serialization purposes | ||
| */ | ||
| public VersalClockTree() { | ||
|
|
||
| } | ||
|
|
||
| public VersalClockTree(int minY, int maxY) { | ||
| this.minMaxYKey = getMinMaxYRangeKey(minY, maxY); | ||
| } | ||
|
|
||
| public int getMinY() { | ||
| return minMaxYKey >>> 16; | ||
| } | ||
|
|
||
| public int getMaxY() { | ||
| return minMaxYKey & 0xffff; | ||
| } | ||
|
|
||
| public int getMinMaxYKey() { | ||
| return minMaxYKey; | ||
| } | ||
|
|
||
| public int getPreferredClockRootYCoord() { | ||
| return preferredClockRootY; | ||
| } | ||
|
|
||
| public void setPreferredClockRootYCoord(int clockRootYCoord) { | ||
| this.preferredClockRootY = clockRootYCoord; | ||
| } | ||
|
|
||
| public Map<Integer, int[][]> getClockRootPathSets() { | ||
| return clockRootPathSets; | ||
| } | ||
|
|
||
| public void setClockRootPathSets(Map<Integer, int[][]> clockRootPathSets) { | ||
| this.clockRootPathSets = clockRootPathSets; | ||
| } | ||
|
|
||
| public Set<Integer> getClockRootOptions() { | ||
| return clockRootPathSets.keySet(); | ||
| } | ||
|
|
||
| /** | ||
| * Gets the vertical distribution path of the target clock region for the | ||
| * preferred clock root. | ||
| * | ||
| * @param target The destination clock region that needs to be routed via | ||
| * vertical distribution lines. | ||
| * @return A sequence of vertical distribution constraints (target IntentCode | ||
| * and ClockRegion). | ||
| */ | ||
| public List<Pair<IntentCode, ClockRegion>> getClockRegionVDistrPath(ClockRegion target) { | ||
| return getClockRegionVDistrPath(target, preferredClockRootY); | ||
| } | ||
|
|
||
| /** | ||
| * Gets the vertical distribution path of the target clock region for the | ||
| * provided clock root. | ||
| * | ||
| * @param target The destination clock region that needs to be routed | ||
| * via vertical distribution lines. | ||
| * @param clockRootYCoord The desired clock root Y coordinate path set to use. | ||
| * @return A sequence of vertical distribution constraints (target IntentCode | ||
| * and ClockRegion). | ||
| */ | ||
| public List<Pair<IntentCode, ClockRegion>> getClockRegionVDistrPath(ClockRegion target, | ||
| int clockRootYCoord) { | ||
| int[][] pathData = clockRootPathSets.get(clockRootYCoord); | ||
|
|
||
| if (pathData == null) { | ||
| System.err.println( | ||
| "Missing VDISTR tree for " + target.getDevice() + " targeting CR " + target); | ||
| Pair<IntentCode, ClockRegion> simple = new Pair<>(IntentCode.NODE_GLOBAL_VDISTR, target); | ||
| return Collections.singletonList(simple); | ||
| } | ||
|
|
||
| int[] crPathData = pathData[target.getInstanceY()]; | ||
| List<Pair<IntentCode, ClockRegion>> vdistrPath = new ArrayList<>(crPathData.length); | ||
| for (int value : crPathData) { | ||
| IntentCode vdistrCode = IntentCode.values()[value >>> 16]; | ||
| int crY = value & 0xffff; | ||
| ClockRegion cr = target.getDevice().getClockRegion(crY, target.getInstanceX()); | ||
| vdistrPath.add(new Pair<>(vdistrCode, cr)); | ||
| } | ||
| return vdistrPath; | ||
| } | ||
|
|
||
| public static int getMinMaxYRangeKey(int minY, int maxY) { | ||
| assert (minY >= 0 && maxY >= 0 && maxY >= minY); | ||
| return (minY << 16) | maxY; | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the plan (in a future PR, prior to final 2025.2.0 release) to support more devices than just the V80 that the data file in this PR supports? If so, should this be turned into a Exception (after which any code to do suboptimal vertical routing can also be removed?)