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

add cell port constructor, consuming must connect setter #52

Merged
merged 1 commit into from
Oct 18, 2024
Merged
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
20 changes: 20 additions & 0 deletions substrate/src/layout/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1007,6 +1007,21 @@ impl CellPort {
}
}

pub fn with_shapes(
id: impl Into<PortId>,
layer: LayerKey,
shapes: impl IntoIterator<Item = Shape>,
) -> Self {
let mut map = HashMap::with_capacity(1);
let mut entry = map.entry(layer).or_insert_with(Vec::new);
entry.extend(shapes);
Self {
id: id.into(),
shapes: map,
must_connect: Default::default(),
}
}

pub fn with_element(id: impl Into<PortId>, elem: Element) -> Self {
let mut shapes = HashMap::with_capacity(1);
shapes.insert(elem.layer.layer(), vec![elem.into_inner()]);
Expand Down Expand Up @@ -1037,6 +1052,11 @@ impl CellPort {
self
}

pub fn must_connect(mut self, must_connect: impl Into<MustConnect>) -> Self {
self.set_must_connect(must_connect);
self
}

/// Returns the ID of the port.
#[inline]
pub fn id(&self) -> &PortId {
Expand Down
Loading