Skip to content
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

fix(atoll): store via information in blocked grid points #393

Merged
merged 3 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions libs/atoll/src/abs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,9 @@ impl Abstract {
match layer {
LayerAbstract::Available => {}
LayerAbstract::Blocked => {
state.layer_mut(i).fill(PointState::Blocked);
state
.layer_mut(i)
.fill(PointState::Blocked { has_via: false });
}
LayerAbstract::Detailed { states } => {
*state.layer_mut(i) = states.clone();
Expand Down Expand Up @@ -396,7 +398,7 @@ impl InstanceAbstract {
LayerAbstract::Available => {}
LayerAbstract::Blocked => {
assert_eq!(point_state, &PointState::Available);
*point_state = PointState::Blocked;
*point_state = PointState::Blocked { has_via: false };
}
LayerAbstract::Detailed { states } => {
let new_state = states[match inst.orientation {
Expand All @@ -420,8 +422,8 @@ impl InstanceAbstract {
// TODO: decide semantics for conflicting net labels
match new_state {
PointState::Available => {}
PointState::Blocked => {
*point_state = PointState::Blocked;
PointState::Blocked { has_via } => {
*point_state = PointState::Blocked { has_via };
}
PointState::Routed { net, has_via } => {
if let Some(translation) = net_translation.get(&net) {
Expand All @@ -430,15 +432,15 @@ impl InstanceAbstract {
has_via,
};
} else {
*point_state = PointState::Blocked;
*point_state = PointState::Blocked { has_via };
}
}
PointState::Reserved { net } => {
if let Some(translation) = net_translation.get(&net) {
*point_state =
PointState::Reserved { net: *translation };
} else {
*point_state = PointState::Blocked;
*point_state = PointState::Blocked { has_via: false };
}
}
}
Expand Down Expand Up @@ -480,7 +482,7 @@ impl InstanceAbstract {
has_via: false,
}
} else {
PointState::Blocked
PointState::Blocked { has_via: false }
};
}
}
Expand Down Expand Up @@ -607,7 +609,13 @@ impl<PDK: Pdk> Draw<PDK> for &DebugAbstract {
let pt = self.abs.grid_to_physical(GridCoord { layer: i, x, y });
let rect = match states[(x, y)] {
PointState::Available => Rect::from_point(pt).expand_all(20),
PointState::Blocked => Rect::from_point(pt).expand_all(40),
PointState::Blocked { has_via } => {
if has_via {
Rect::from_point(pt).expand_all(40)
} else {
Rect::from_point(pt).expand_all(33)
}
}
PointState::Routed { has_via, .. } => {
if has_via {
Rect::from_point(pt).expand_all(37)
Expand Down
7 changes: 4 additions & 3 deletions libs/atoll/src/grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ impl<L: AtollLayer + Clone> RoutingState<L> {
match self[coord] {
PointState::Routed { net: grid_net, .. } => self.roots[&grid_net] == self.roots[&net],
PointState::Available => true,
PointState::Blocked => false,
PointState::Blocked { .. } => false,
PointState::Reserved { .. } => false,
}
}
Expand All @@ -800,6 +800,7 @@ impl<L: AtollLayer + Clone> RoutingState<L> {
pub(crate) fn has_via(&self, coord: GridCoord) -> bool {
match self[coord] {
PointState::Routed { has_via, .. } => has_via,
PointState::Blocked { has_via, .. } => has_via,
_ => false,
}
}
Expand All @@ -809,7 +810,7 @@ impl<L: AtollLayer + Clone> RoutingState<L> {
match self[coord] {
PointState::Routed { .. } => false,
PointState::Available => true,
PointState::Blocked => false,
PointState::Blocked { .. } => false,
PointState::Reserved { net: grid_net } => self.roots[&net] == self.roots[&grid_net],
}
}
Expand All @@ -820,7 +821,7 @@ impl<L: AtollLayer + Clone> RoutingState<L> {
match self[coord] {
PointState::Routed { .. } => false,
PointState::Available => true,
PointState::Blocked => false,
PointState::Blocked { .. } => false,
PointState::Reserved { .. } => false,
}
}
Expand Down
10 changes: 7 additions & 3 deletions libs/atoll/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,10 @@ pub enum PointState {
/// The grid point is available for routing.
Available,
/// The grid point is blocked.
Blocked,
Blocked {
/// Whether there is a via at this point.
has_via: bool,
},
/// The grid point is occupied by a known net.
Routed {
/// The net occupying this routing space.
Expand All @@ -163,7 +166,7 @@ impl PointState {
match self {
Self::Available => true,
Self::Routed { net: n, .. } => *n == net,
Self::Blocked => false,
Self::Blocked { .. } => false,
PointState::Reserved { .. } => false, // todo might need to change this
}
}
Expand All @@ -173,7 +176,7 @@ impl PointState {
match self {
Self::Available => false,
Self::Routed { net: n, .. } => *n == net,
Self::Blocked => false,
Self::Blocked { .. } => false,
PointState::Reserved { .. } => false,
}
}
Expand All @@ -182,6 +185,7 @@ impl PointState {
pub fn has_via(&self) -> bool {
match self {
Self::Routed { has_via, .. } => *has_via,
Self::Blocked { has_via, .. } => *has_via,
_ => false,
}
}
Expand Down
25 changes: 16 additions & 9 deletions libs/atoll/src/straps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ impl<'a> GreedyStrapperState<'a> {
.layer(strap.layer)
.dir()
.track_dir();
let via_spacing = self
let strap_via_spacing = self
.routing_state
.grid
.slice()
Expand Down Expand Up @@ -189,12 +189,19 @@ impl<'a> GreedyStrapperState<'a> {
.layer(top.layer)
.dir()
.track_dir();
let via_spacing = self
.routing_state
.grid
.slice()
.layer(top.layer)
.strap_via_spacing();
let via_spacing = if self.strap_idx(top).is_some() {
self.routing_state
.grid
.slice()
.layer(top.layer)
.strap_via_spacing()
} else {
self.routing_state
.grid
.slice()
.layer(top.layer)
.via_spacing()
};
let routing_coord = top.coord(track_dir);
for i in (routing_coord + 1)
.checked_sub(via_spacing)
Expand All @@ -212,8 +219,8 @@ impl<'a> GreedyStrapperState<'a> {
}
}
if let Some((from, _)) = vias.last() {
if from.coord(track_dir) + via_spacing > track_coord
&& from.coord(track_dir) < track_coord + via_spacing
if from.coord(track_dir) + strap_via_spacing > track_coord
&& from.coord(track_dir) < track_coord + strap_via_spacing
{
has_via = true;
}
Expand Down
Loading