Skip to content

Commit

Permalink
Merge pull request #46 from dan-fritchman/revert-45-main
Browse files Browse the repository at this point in the history
Revert "Made parser capable of handling USEMINSPACING and MASKS in rectangles"
  • Loading branch information
dan-fritchman authored Jun 22, 2024
2 parents 9e71d36 + f4efb0d commit ef6a881
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 25 deletions.
5 changes: 2 additions & 3 deletions lef21/src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ pub struct LefLibrary {
/// "Use Min Spacing" Option
#[serde(default, skip_serializing)]
#[builder(default)]
pub use_min_spacing: Option<LefOnOff>,
pub use_min_spacing: Option<Unsupported>,
/// Clearance Measure
#[serde(default, skip_serializing)]
#[builder(default)]
Expand Down Expand Up @@ -426,7 +426,7 @@ pub enum LefGeometry {
/// rectangles, polygons, and paths.
#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema, PartialEq, Eq)]
pub enum LefShape {
Rect(Option<LefDecimal>, LefPoint, LefPoint),
Rect(LefPoint, LefPoint),
Polygon(Vec<LefPoint>),
Path(Vec<LefPoint>),
}
Expand Down Expand Up @@ -610,7 +610,6 @@ enumstr!(
DesignRuleWidth: "DESIGNRULEWIDTH",
Spacing: "SPACING",
Bump: "BUMP",
Mask: "MASK",

// UNITS Fields
Units: "UNITS",
Expand Down
19 changes: 4 additions & 15 deletions lef21/src/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -503,15 +503,9 @@ impl<'src> LefParser<'src> {
self.expect_key(LefKey::Library)?; // Expect END LIBRARY
break;
}
LefKey::UseMinSpacing => {
self.advance()?;
self.expect_key(LefKey::Obs)?;
let e = self.parse_enum::<LefOnOff>()?;
self.expect(TokenType::SemiColon)?;
lib.use_min_spacing(e)
}
LefKey::BeginExtension
| LefKey::ManufacturingGrid
| LefKey::UseMinSpacing
| LefKey::ClearanceMeasure
| LefKey::PropertyDefinitions
| LefKey::MaxViaStack
Expand Down Expand Up @@ -837,21 +831,16 @@ impl<'src> LefParser<'src> {
match self.peek_key()? {
LefKey::Rect => {
self.advance()?;
let mut mask = None;
if self.matches(TokenType::Name) {
if self.get_key()? == LefKey::Mask {
mask = Some(self.parse_number()?);
} else {
// The ITERATE construction would go here, but is not supported.
self.fail(LefParseErrorType::Unsupported)?;
}
// The ITERATE construction would go here, but is not supported.
self.fail(LefParseErrorType::Unsupported)?;
}
// Parse the two points
let p1 = self.parse_point()?;
let p2 = self.parse_point()?;
self.expect(TokenType::SemiColon)?;
// And return the Rect
Ok(LefGeometry::Shape(LefShape::Rect(mask, p1, p2)))
Ok(LefGeometry::Shape(LefShape::Rect(p1, p2)))
}
LefKey::Polygon => {
self.advance()?;
Expand Down
9 changes: 2 additions & 7 deletions lef21/src/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,13 +294,8 @@ impl<'wr> LefWriter<'wr> {
match geom {
LefGeometry::Iterate { .. } => unimplemented!(),
LefGeometry::Shape(ref shape) => match shape {
LefShape::Rect(mask, p0, p1) => {
let mut line = format!("{Rect} ");
match mask {
Some(mask) => line.push_str(&format!("MASK {mask} ")),
None => (),
};
self.write_line(format_args_f!("{line}{p0} {p1} ; "))?;
LefShape::Rect(p0, p1) => {
self.write_line(format_args_f!("{Rect} {p0} {p1} ; "))?;
}
LefShape::Polygon(pts) => {
let ptstr = pts
Expand Down

0 comments on commit ef6a881

Please sign in to comment.