Skip to content

Commit

Permalink
add track and grid helper functions for atoll
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulk29 committed Dec 31, 2023
1 parent 78ab8c4 commit 1e3d42b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion libs/atoll/src/abs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub struct GridCoord {
///
/// There are three coordinate systems used within the abstract view.
/// * Physical coordinates: the raw physical coordinate system of the cell, expressed in PDK database units.
/// * Track coordinates: track indices indexing the ATOLL [`LayerStack`]. Track is 0 is typically centered at the origin, or immediately to the upper left of the origin.
/// * Track coordinates: track indices indexing the ATOLL [`LayerStack`]. Track 0 is typically centered at the origin, or immediately to the upper left of the origin.
/// * Grid coordinates: these have the same spacing as track coordinates, but are shifted so that (0, 0) is always at the lower left. These are used to index [`LayerAbstract`]s.
///
/// ATOLL provides the following utilities for converting between these coordinate systems:
Expand Down
20 changes: 20 additions & 0 deletions libs/atoll/src/grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,26 @@ impl<L: AtollLayer> RoutingGrid<L> {
tracks.track(track)
}

/// The tracks on the given layer.
pub fn tracks(&self, layer: usize) -> UniformTracks {
self.stack.tracks(layer)
}

/// Returns the track grid for the given layer.
///
/// Returns a tuple containing the vertical going tracks followed by the horizontal going tracks.
/// In other words, the first element of the tuple is indexed by an x-coordinate,
/// and the second element of the tuple is indexed by a y-coordinate.
pub fn track_grid(&self, layer: usize) -> (UniformTracks, UniformTracks) {
let tracks = self.tracks(layer);
let adj_tracks = self.stack.tracks(self.grid_defining_layer(layer));

match self.stack.layer(layer).dir().track_dir() {
Dir::Horiz => (adj_tracks, tracks),
Dir::Vert => (tracks, adj_tracks),
}
}

/// Calculates the bounds of a particular track on the given layer.
///
/// The start and end coordinates are with respect to tracks on the grid defining layer.
Expand Down

0 comments on commit 1e3d42b

Please sign in to comment.