Skip to content

Commit

Permalink
initial dijkstra router impl
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulk29 committed Jan 2, 2024
1 parent 62a9514 commit 86c5219
Show file tree
Hide file tree
Showing 6 changed files with 313 additions and 28 deletions.
55 changes: 49 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions libs/atoll/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ ena = "0.14"
tracing = "0.1"
num = "0.4.1"
serde = { version = "1.0.192", features = ["derive"] }
pathfinding = "4.8.0"
36 changes: 22 additions & 14 deletions libs/atoll/src/abs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,38 @@ use substrate::pdk::Pdk;
use substrate::schematic::ExportsNestedData;
use substrate::{arcstr, layout};

#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Serialize, Deserialize)]
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Ord, PartialOrd, Serialize, Deserialize)]
pub struct TrackCoord {
pub layer: usize,
pub x: i64,
pub y: i64,
}

#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Serialize, Deserialize)]
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Ord, PartialOrd, Serialize, Deserialize)]
pub struct GridCoord {
pub layer: usize,
pub x: usize,
pub y: usize,
}

impl TrackCoord {
pub fn coord(&self, dir: Dir) -> i64 {
match dir {
Dir::Horiz => self.x,
Dir::Vert => self.y,
}
}
}

impl GridCoord {
pub fn coord(&self, dir: Dir) -> usize {
match dir {
Dir::Horiz => self.x,
Dir::Vert => self.y,
}
}
}

/// The abstract view of an ATOLL tile.
///
/// # Coordinates
Expand Down Expand Up @@ -225,11 +243,7 @@ impl Abstract {
let xofs = xmin * slice.lcm_unit_width() / grid.xpitch(layer);
let yofs = ymin * slice.lcm_unit_height() / grid.ypitch(layer);
state.layer_mut(layer)[((x - xofs) as usize, (y - yofs) as usize)] =
PointState::Routed {
net,
via_down: false,
via_up: false,
};
PointState::Routed { net };
}
}
}
Expand Down Expand Up @@ -373,16 +387,10 @@ impl InstanceAbstract {
assert_eq!(point_state, &PointState::Available);
*point_state = PointState::Blocked;
}
PointState::Routed {
net,
via_up,
via_down,
} => {
PointState::Routed { net } => {
assert_eq!(point_state, &PointState::Available);
*point_state = PointState::Routed {
net: net_translation[&net],
via_up,
via_down,
};
}
}
Expand Down
Loading

0 comments on commit 86c5219

Please sign in to comment.