Skip to content

Commit

Permalink
fix merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
rohanku committed Dec 28, 2023
2 parents f4cd5dc + cfc2191 commit 9f40537
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 18 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

24 changes: 9 additions & 15 deletions pdks/sky130pdk/src/atoll/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ use crate::layers::Sky130Layers;
use crate::mos::{MosParams, Nfet01v8};
use crate::Sky130Pdk;
use arcstr::ArcStr;
use atoll::grid::{AbstractLayer, AtollLayer, LayerStack, PdkLayer, RoutingGrid};
use atoll::grid::{AbstractLayer, LayerStack, PdkLayer, RoutingGrid};
use atoll::RoutingDir;
use serde::{Deserialize, Serialize};
use std::ops::{Deref, DerefMut};

use substrate::block::Block;
use substrate::geometry::bbox::Bbox;
use substrate::geometry::dir::Dir;
Expand All @@ -17,7 +17,7 @@ use substrate::io::layout::IoShape;
use substrate::io::{Array, InOut, Input, Io, MosIoSchematic, Signal};
use substrate::layout::element::Shape;
use substrate::layout::{CellBuilder, ExportsLayoutData, Layout};
use substrate::pdk::layers::{Layer, LayerId};
use substrate::pdk::layers::Layer;
use substrate::schematic::{ExportsNestedData, Schematic};

impl Sky130Layers {
Expand All @@ -36,8 +36,7 @@ impl Sky130Layers {
offset: 85,
endcap: 0,
},
}
.into(),
},
PdkLayer {
id: self.met1.drawing.id(),
inner: AbstractLayer {
Expand All @@ -47,8 +46,7 @@ impl Sky130Layers {
offset: 130,
endcap: 100,
},
}
.into(),
},
PdkLayer {
id: self.met2.drawing.id(),
inner: AbstractLayer {
Expand All @@ -58,8 +56,7 @@ impl Sky130Layers {
offset: 150,
endcap: 130,
},
}
.into(),
},
PdkLayer {
id: self.met3.drawing.id(),
inner: AbstractLayer {
Expand All @@ -69,8 +66,7 @@ impl Sky130Layers {
offset: 200,
endcap: 150,
},
}
.into(),
},
PdkLayer {
id: self.met4.drawing.id(),
inner: AbstractLayer {
Expand All @@ -80,8 +76,7 @@ impl Sky130Layers {
offset: 600,
endcap: 200,
},
}
.into(),
},
PdkLayer {
id: self.met5.drawing.id(),
inner: AbstractLayer {
Expand All @@ -91,8 +86,7 @@ impl Sky130Layers {
offset: 900,
endcap: 600,
},
}
.into(),
},
],
offset_x: 0,
offset_y: 0,
Expand Down
1 change: 1 addition & 0 deletions substrate/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ derive_builder = "0.12"
slotmap = "1"
downcast-rs = "1"
indexmap = { version = "2", features = ["serde"] }
num = "0.4"

config = { version = "0.2.5", registry = "substrate", path = "../config" }
examples = { version = "0.5.1", registry = "substrate", path = "../docs/examples" }
Expand Down
23 changes: 20 additions & 3 deletions substrate/src/layout/tracks.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! Routing track management.
use geometry::span::Span;
use num::integer::div_floor;
use serde::{Deserialize, Serialize};

/// A uniform set of tracks.
Expand Down Expand Up @@ -69,9 +70,15 @@ impl UniformTracks {
/// Converts a geometric coordinate to the index of the nearest track.
pub fn to_track_idx(&self, coord: i64, mode: RoundingMode) -> i64 {
match mode {
RoundingMode::Down => (coord - self.offset) / self.pitch(),
RoundingMode::Up => (coord - self.offset + self.pitch() - 1) / self.pitch(),
RoundingMode::Nearest => (coord - self.offset + self.pitch() / 2) / self.pitch(),
RoundingMode::Down => div_floor(coord - self.offset + self.line / 2, self.pitch()),
RoundingMode::Up => div_floor(
coord - self.offset + self.pitch() - 1 + self.line / 2,
self.pitch(),
),
RoundingMode::Nearest => div_floor(
coord - self.offset + self.pitch() / 2 + self.line / 2,
self.pitch(),
),
}
}
}
Expand Down Expand Up @@ -258,4 +265,14 @@ mod tests {
fn uniform_tracks_requires_even_spacing() {
UniformTracks::new(320, 645);
}

#[test]
fn uniform_tracks_to_track_idx() {
let tracks = UniformTracks::with_offset(260, 140, 130);
assert_eq!(tracks.to_track_idx(-20, RoundingMode::Down), -1);
assert_eq!(tracks.to_track_idx(-550, RoundingMode::Down), -2);
assert_eq!(tracks.to_track_idx(-200, RoundingMode::Down), -1);
assert_eq!(tracks.to_track_idx(-20, RoundingMode::Up), 0);
assert_eq!(tracks.to_track_idx(-550, RoundingMode::Up), -1);
}
}

0 comments on commit 9f40537

Please sign in to comment.