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

skip, do not fail, on non-rectangular GDS arrays #44

Merged
merged 1 commit into from
Jun 22, 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
15 changes: 11 additions & 4 deletions layout21raw/src/gds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,13 @@ impl GdsImporter {
GdsBoundary(ref x) => Yes(self.import_boundary(x)?),
GdsPath(ref x) => Yes(self.import_path(x)?),
GdsBox(ref x) => Yes(self.import_box(x)?),
GdsArrayRef(ref x) => No(layout.insts.extend(self.import_instance_array(x)?)),
GdsArrayRef(ref x) => {
let array = self.import_instance_array(x)?;
if let Some(insts) = array {
layout.insts.extend(insts);
}
No(())
},
GdsStructRef(ref x) => No(layout.insts.push(self.import_instance(x)?)),
GdsTextElem(ref x) => No(texts.push(x)),
// GDSII "Node" elements are fairly rare, and are not supported.
Expand Down Expand Up @@ -854,7 +860,7 @@ impl GdsImporter {
/// Further support for such "non-rectangular-specified" arrays may (or may not) become a future addition,
/// based on observed GDSII usage.
///
fn import_instance_array(&mut self, aref: &gds21::GdsArrayRef) -> LayoutResult<Vec<Instance>> {
fn import_instance_array(&mut self, aref: &gds21::GdsArrayRef) -> LayoutResult<Option<Vec<Instance>>> {
let cname = aref.name.clone();
self.ctx.push(ErrorContext::Array(cname.clone()));

Expand All @@ -871,7 +877,8 @@ impl GdsImporter {
let p2 = self.import_point(&aref.xy[2])?;
// Check for (thus far) unsupported non-rectangular arrays
if p0.y != p1.y || p0.x != p2.x {
self.fail("Unsupported Non-Rectangular GDS Array")?;
//self.fail("Unsupported Non-Rectangular GDS Array")?;
return Ok(None);
}
// Sort out the inter-element spacing
let mut xstep = (p1.x - p0.x) / Int::from(aref.cols);
Expand Down Expand Up @@ -920,7 +927,7 @@ impl GdsImporter {
}
}
self.ctx.pop();
Ok(insts)
Ok(Some(insts))
}
/// Import a [Point]
fn import_point(&mut self, pt: &gds21::GdsPoint) -> LayoutResult<Point> {
Expand Down
Loading