.LEF File Format – LEF58 properties

Library Exchange Format

Newer process rules are written in a LEF file as properties whose names begin LEF58_, each holding the rule as a quoted string. The LEF grammar passes the string through unread. This page describes how OpenROAD's database, OpenDB, reads those strings. The syntax below is the behaviour of OpenDB's parsers, and the last section is what OpenROAD's router does with some of the rules; neither is the Cadence definition of these properties, and another program may accept more, less or something else. Which properties are read for which kind of layer is listed under Layer properties.

How a string is read

  • White space separates words but is not required: a keyword is matched character by character at the next position that is not white space.
  • Keywords come in the order shown. Where alternatives are given they are tried from left to right, and the first that fits is taken.
  • A name is a letter followed by any characters other than space, tab and line feed. A name written against a ; therefore takes the semicolon with it.
  • Distances are in micrometres and areas in square micrometres; OpenDB converts them to its database units.

The string is handled in one of three ways, given for each property below:

ReadingWhat happens
wholeThe entire string must fit the grammar.
rule by ruleThe string is cut at every ;. Each piece that is not blank is given its semicolon back and judged alone: a piece that does not fit is reported and the others are kept.
all rulesThe string must end with ;, and is then cut and read in the same way; if any piece fails, the string is reported.

In the syntax below, [ ] marks an optional part, | separates alternatives, ( ) groups, + means one or more and * any number. Brackets that belong to the string are written "(" and ")".

Routing layers

LEF58_SPACING, end of line

Used when the string does not contain WRONGDIRECTION; read rule by rule. A rule without ENDOFLINE is reported as unsupported.

SPACING space ENDOFLINE eolWidth [EXACTWIDTH] [WRONGDIRSPACING space]
  ( within | TOCONCAVECORNER [MINLENGTH l] [MINADJACENTLENGTH l1 [l2]]
    | TONOTCHLENGTH l ) [;]

within:
  [OPPOSITEWIDTH w] WITHIN within [wrongDirWithin] [SAMEMASK]
  [EXCEPTEXACTWIDTH exactWidth otherWidth] [FILLCONCAVECORNER triangle]
  [WITHCUT [CUTCLASS number] [ABOVE] cutSpace [ENCLOSUREEND width [WITHIN d]]]
  [ENDPRLSPACING space PRL length]
  [ENDTOEND space [oneCutSpace twoCutSpace] [EXTENSION ext [wrongDirExt]]
    [OTHERENDWIDTH w]]
  [MAXLENGTH l | MINLENGTH l [TWOSIDES]] [EQUALRECTWIDTH]
  [PARALLELEDGE [SUBTRACTEOLWIDTH] parSpace WITHIN parWithin [PRL length]
    [MINLENGTH l] [TWOEDGES] [SAMEMETAL] [NONEOLCORNERONLY] [PARALLELSAMEMASK]]
  [ENCLOSECUT [ABOVE | BELOW] distance CUTSPACING cutToMetal [ALLCUTS]]

LEF58_SPACING, wrong direction

Used when the string contains WRONGDIRECTION; read whole.

SPACING space WRONGDIRECTION [NONEOL width] [PRL length] [LENGTH length] ;

LEF58_SPACINGTABLE

Read whole, one or more tables, and only when the string contains PARALLELRUNLENGTH. Every WIDTH row has as many spacings as there are run lengths.

( SPACINGTABLE PARALLELRUNLENGTH [WRONGDIRECTION] [SAMEMASK] [EXCEPTEOL eolWidth]
    length+
    ( WIDTH w [EXCEPTWITHIN low high] spacing+ )+
  [SPACINGTABLE INFLUENCE ( WIDTH w WITHIN d SPACING space )+ ;] ; )+

LEF58_MINSTEP and LEF57_MINSTEP

Read whole.

( MINSTEP length [MAXEDGES n] [EXCEPTRECTANGLE]
  [ MINADJACENTLENGTH l1 [CONVEXCORNER | CONCAVECORNER | l2]
  | MINBETWEENLENGTH l [EXCEPTSAMECORNERS]
  | NOADJACENTEOL width [MINADJACENTLENGTH l]
  | NOBETWEENEOL width ] ; )+

LEF58_CORNERSPACING

All rules. Where a WIDTH entry gives one spacing, the second equals it.

CORNERSPACING
  ( CONVEXCORNER [SAMEMASK] [CORNERONLY within | CORNERTOCORNER]
      [EXCEPTEOL eolWidth [EXCEPTJOGLENGTH jog [EDGELENGTH l] [INCLUDELSHAPE]]]
  | CONCAVECORNER [MINLENGTH l [EXCEPTNOTCH [notchLength]]] )
  [EXCEPTSAMENET | EXCEPTSAMEMETAL]
  ( WIDTH w SPACING space1 [space2] )+ ;

Other routing properties

PropertyReadingSyntax
LEF58_RIGHTWAYONGRIDONLYwholeRIGHTWAYONGRIDONLY [CHECKMASK] ;
LEF58_RECTONLYwholeRECTONLY [EXCEPTNONCOREPINS] ;
LEF58_EOLEXTENSIONSPACINGrule by ruleEOLEXTENSIONSPACING space [PARALLELONLY] ( ENDOFLINE eolWidth EXTENSION extension )+ ;
LEF58_EOLKEEPOUTrule by ruleEOLKEEPOUT eolWidth EXTENSION backward side forward [EXCEPTWITHIN low high] [CLASS name] [CORNERONLY] ;
LEF58_WIDTHTABLErule by ruleWIDTHTABLE width+ [WRONGDIRECTION] [ORTHOGONAL] ;
LEF58_MINIMUMCUTrule by ruleMINIMUMCUT ( cuts | ( CUTCLASS name cuts )+ ) WIDTH w [WITHIN cutDistance] [FROMABOVE | FROMBELOW] [LENGTH l WITHIN d | AREA area [WITHIN d] | SAMEMETALOVERLAP | FULLYENCLOSED] ;
LEF58_PITCHwholePITCH x [y] [FIRSTLASTPITCH pitch] ; – after a mismatch the pitch is set to 0 and the first and last pitch to -1
LEF58_AREArule by ruleAREA area [MASK n] [EXCEPTMINWIDTH w] [EXCEPTEDGELENGTH l1 [l2]] [EXCEPTMINSIZE width height] [EXCEPTSTEP x y] [RECTWIDTH w] [EXCEPTRECTANGLE] [LAYER name OVERLAP n] ;
LEF58_FORBIDDENSPACINGrule by ruleFORBIDDENSPACING space1 space2 [WIDTH w [WITHIN d] [PRL length] [TWOEDGES d] ;] – the semicolon lies inside the optional part, so a rule without WIDTH does not fit
LEF58_TWOWIRESFORBIDDENSPACINGrule by ruleTWOWIRESFORBIDDENSPACING minSpace maxSpace MINSPANLENGTH l [EXACTSPANLENGTH] MAXSPANLENGTH l [EXACTSPANLENGTH] PRL length ;
LEF58_MINWIDTHwholeMINWIDTH w [WRONGDIRECTION] ;
LEF58_VOLTAGESPACINGwhole( VOLTAGESPACING [TOCUT [ABOVE | BELOW]] ( voltage spacing )+ ; )+ – TOCUT without a side means both

Layer type, backside and antenna

LEF58_TYPE

Routing, cut and masterslice layers; read whole.

TYPE ( NWELL | PWELL | ABOVEDIEEDGE | BELOWDIEEDGE | DIFFUSION | TRIMPOLY | MIMCAP
     | STACKEDMIMCAP | TSVMETAL | PASSIVATION | HIGHR | TRIMMETAL | REGION | MEOL
     | WELLDISTANCE | CPODE | TSV | PADMETAL | POLYROUTING ) ;

LEF58_BACKSIDE

Routing and cut layers; read whole: BACKSIDE ;

LEF58_ANTENNAGATEPLUSDIFF and LEF57_ANTENNAGATEPLUSDIFF

Routing and cut layers; read whole. Without an oxide the rule is for OXIDE1. OXIDE3 fits the grammar, but OpenDB keeps two oxide models only: it warns and stores nothing.

ANTENNAGATEPLUSDIFF [OXIDE1 | OXIDE2 | OXIDE3]
  ( factor | PWL "(" ( "(" diffusionArea ratio ")" )+ ")" ) ;

Cut layers

LEF58_SPACING and LEF57_SPACING

Read whole, one or more rules.

( SPACING space
  ( MAXXY | SAMEMASK
  | [CENTERTOCENTER] [SAMENET | SAMEMETAL | SAMEVIA]
    [layer | adjacent | overlap | within | edge | AREA cutArea] ) ; )+

layer:    LAYER name [ STACK | ORTHOGONALSPACING space | CUTCLASS name [class] ]
class:    SHORTEDGEONLY [PRL length]
        | CONCAVECORNER [ WIDTH w ENCLOSURE e EDGELENGTH l
                        | PARALLEL length WITHIN w ENCLOSURE e
                        | EDGELENGTH l ENCLOSURE edgeEnclosure adjacentEnclosure ]
        | EXTENSION extension | NONEOLCONVEXCORNER eolWidth [MINLENGTH l]
        | ABOVEWIDTH w [ENCLOSURE e] | MASKOVERLAP | WRONGDIRECTION
adjacent: ADJACENTCUTS ( 1 | 2 | 3 ) [EXACTALIGNED n] [TWOCUTS n [SAMECUT]]
          WITHIN w [w2] [EXCEPTSAMEPGNET] [CUTCLASS name [TO ALL]]
          [SIDEPARALLELOVERLAP | NOPRL] [SAMEMASK]
overlap:  PARALLELOVERLAP [EXCEPTSAMENET | EXCEPTSAMEMETAL | EXCEPTSAMEVIA
          | EXCEPTSAMEMETALOVERLAP]
within:   PARALLELWITHIN w [EXCEPTSAMENET] [CUTCLASS name
          [LONGEDGEONLY | ENCLOSURE e ( ABOVE | BELOW ) PARALLEL length WITHIN w]]
edge:     SAMEMETALSHAREDEDGE w [ABOVE] [CUTCLASS name] [EXCEPTTWOEDGES]
          [EXCEPTSAMEVIA n]
  • TO ALL is matched as one piece of text, with a single space.
  • EXCEPTSAMEMETALOVERLAP can never be read: EXCEPTSAMEMETAL is tried first, takes its beginning and leaves text that fits nothing.
  • The value after ORTHOGONALSPACING is not stored as a spacing.

LEF58_CUTCLASS

Read whole. ORIENT is reported as unsupported.

( CUTCLASS name WIDTH w [LENGTH l] [CUTS n] [ORIENT word] ; )+

LEF58_ENCLOSURE

Read rule by rule. A cut class that the layer does not define is reported.

ENCLOSURE [CUTCLASS name] [ABOVE | BELOW]
  ( EOL width [MINLENGTH l] [EOLONLY] [SHORTEDGEONEOL] overhang1 overhang2
      [ SIDESPACING space EXTENSION forward backward
      | ENDSPACING space EXTENSION extension ]
  | overhang1 overhang2
  | [OFFCENTERLINE] END overhang SIDE overhang
  | HORIZONTAL overhang VERTICAL overhang )
  [WIDTH w [INCLUDEABUTTED] [EXCEPTEXTRACUT within [PRL | NOSHAREDEDGE]]]
  [LENGTH l] [EXTRACUT [EXTRAONLY]] [REDUNDANTCUT within]
  [PARALLEL length [length2] WITHIN w [w2] [BELOWENCLOSURE e]]
  [CONCAVECORNERS n] ;

LEF58_ENCLOSURETABLE

Read whole, one rule. A rule naming an unknown cut class is dropped. The LAYER part is recognised and thrown away.

ENCLOSURETABLE [CUTCLASS name] ( DEFAULT group+ )* ( WIDTH w group+ )+ ;
group:  [ABOVE | BELOW] overhang1 overhang2 overhang3 overhang4 [LAYER name [OVERLAP n]]

LEF58_SPACINGTABLE

Read whole, one or more tables of either form.

SPACINGTABLE ORTHOGONAL ( WITHIN w SPACING space )+ ;

SPACINGTABLE [DEFAULT space] [SAMEMASK] [SAMENET | SAMEMETAL | SAMEVIA]
  [LAYER name [NOSTACK] [NONZEROENCLOSURE | PRLFORALIGNEDCUT ( a TO b )+]]
  [CENTERTOCENTER ( a TO b )+]
  [CENTERANDEDGE [NOPRL] ( a TO b )+]
  [PRL length [HORIZONTAL | VERTICAL] [MAXXY] ( a TO b length )*]
  [ENDEXTENSION extension ( TO class extension )* [SIDEEXTENSION ( TO class extension )+]]
  [EXACTALIGNEDSPACING [HORIZONTAL | VERTICAL] ( class space )+]
  [NONOPPOSITEENCLOSURESPACING ( class space )+]
  [OPPOSITEENCLOSURERESIZESPACING ( class resize1 resize2 space )+]
  CUTCLASS ( name [SIDE | END] )+ ( cell cell )+ ( name [SIDE | END] ( cell cell )+ )* ;

In the closing table the last name before the first numbers heads the first row; the names before it head the columns. A column heading without SIDE or END stands for both. Cells come in pairs, and each is a spacing or -, which takes the DEFAULT value.

Other cut properties

PropertyReadingSyntax
LEF58_ARRAYSPACINGwholeARRAYSPACING [CUTCLASS name] [PARALLELOVERLAP] [LONGARRAY] [WIDTH viaWidth] [WITHIN w ARRAYWIDTH width] CUTSPACING space ( ARRAYCUTS n SPACING space )+ ;
LEF58_KEEPOUTZONErule by ruleKEEPOUTZONE CUTCLASS name [TO name] [EXCEPTEXACTALIGNED [SIDE | END] space] ( EXTENSION side forward | ENDEXTENSION endSide endForward SIDEEXTENSION sideSide sideForward ) SPIRALEXTENSION extension ;
LEF58_MAXSPACINGall rulesMAXSPACING space [CUTCLASS name] ;

Implant layers

In a list of layer names, the names end at one of the rule's own keywords or at ;. The names in implant width, spacing and core edge length rules are looked up after the whole file has been read; a rule naming a layer that is never defined is dropped with a warning.

PropertyReadingSyntax
LEF58_SPACINGall rulesSPACING space ( LAYER name | HORIZONTAL | VERTICAL | PRL length | EXCEPTABUTTED | EXCEPTCORNERTOUCH | LENGTH l | INTERSECTLAYERS name+ )* ; – at most one LAYER, and one of HORIZONTAL and VERTICAL
LEF58_WIDTHall rulesWIDTH w ( LAYER ( name | ANY ) | ZEROPRL | MAXWIDTH w | EXCEPTCORNERTOUCH | LENGTH l | CELLHEIGHT h | CHECKIMPLANTGROUP name | WITHINLAYER name+ )* ; – at most one LAYER
LEF58_COREEDGELENGTHall rulesCOREEDGELENGTH minLength ( MAXLENGTH l | EXCEPTADJACENTLENGTH ( length adjacentLength [EXACTADJACENTLENGTH] )+ | WITHINLAYER name+ | EXCEPTLAYER name+ )* ; – at most one MAXLENGTH
LEF58_CORNERSPACINGall rulesCORNERSPACING space ( ALIGNEDONLY | CHECKIMPLANTGROUPONLY )* ; – neither word twice
LEF58_MINENCLOSEDAREAall rulesMINENCLOSEDAREA area [WIDTH w] ;
LEF58_MAXSPACINGall rulesMAXSPACING space WIDTH w LENGTH l ;
LEF58_AREArule by ruleas for a routing layer
LEF58_MINSTEPwholeas for a routing layer

Macros, pins and the library

LEF58_CLASS (macro)

Read whole.

CLASS ( ENDCAP ( BOTTOMEDGE | TOPEDGE | RIGHTEDGE | LEFTEDGE | RIGHTBOTTOMEDGE
               | LEFTBOTTOMEDGE | RIGHTTOPEDGE | LEFTTOPEDGE | RIGHTBOTTOMCORNER
               | LEFTBOTTOMCORNER | RIGHTTOPCORNER | LEFTTOPCORNER | PRE | POST
               | TOPLEFT | TOPRIGHT | BOTTOMLEFT | BOTTOMRIGHT )
      | COVER [BUMP] | RING | BLOCK [BLACKBOX] [SOFT]
      | CORE [FEEDTHRU] [TIEHIGH] [TIELOW] [SPACER] [ANTENNACELL] [WELLTAP]
      | PAD [INPUT] [OUTPUT] [INOUT] [POWER] [SPACER] [AREAIO] ) ;

Other macro, pin and library properties

PropertyBelongs toReadingSyntax
LEF58_EDGETYPEmacrorule by ruleEDGETYPE ( RIGHT | LEFT | TOP | BOTTOM ) type [CELLROW n | HALFROW n | RANGE begin end] ;
LEF58_BACKSIDE_BRIDGEmacrowholeBACKSIDEBRIDGE ;
LEF58_MUSTJOINALLPORTSpin–any value that contains MUSTJOINALLPORTS
LEF58_METALWIDTHVIAMAPproperty definitionsrule by ruleMETALWIDTHVIAMAP [USEVIACUTCLASS] ( VIA layer ( belowLow belowHigh aboveLow aboveHigh | belowWidth aboveWidth ) via [PGVIA] )+ ;
LEF58_CELLEDGESPACINGTABLEproperty definitionsrule by ruleCELLEDGESPACINGTABLE [NODEFAULT] ( EDGETYPE type1 type2 [EXCEPTABUTTED] [EXCEPTNONFILLERINBETWEEN] [OPTIONAL] [SOFT] [EXACT] spacing )+ ;

The library values are those given with the definition: LIBRARY name STRING "value" ; in PROPERTYDEFINITIONS.

What OpenROAD's router checks

OpenROAD's detailed router has its own geometry checker, which gives some of these rules a working meaning. This section is what that checker does. It is not the Cadence definition, and it leaves out options that the parsers above accept. The rules are matched to properties by their names and parameters; the step that turns database rules into router constraints is not covered. A fixed shape is one that comes from the libraries and not from routing; most checks pass over a pair of fixed shapes.

End-of-line spacing

  • An end edge is an edge strictly shorter than the end-of-line width with an outside (convex) corner at both ends.
  • It is measured against an edge of another polygon that faces it. The search region reaches ahead of the end by the spacing and extends beyond both of its corners by WITHIN. Nets with their own minimum spacing are skipped, routed metal must take part, and nothing is reported if metal already fills the gap.
  • WRONGDIRSPACING replaces the spacing for the end of a wire that runs against the layer's preferred direction.
  • ENDPRLSPACING: for a gap of at least the ordinary end-of-line spacing but within this one, there is a violation only if the parallel run length is above 0 and at most the PRL value.
  • ENDTOEND applies when the facing edge is an end too. With EXTENSION both edges are widened by it; otherwise the first is widened by WITHIN. The edges must overlap along one axis, and the distance must be strictly smaller than the spacing.
  • MINLENGTH and MAXLENGTH require a side edge next to the end to be at least, or at most, that long. One side is enough unless TWOSIDES is given.
  • PARALLELEDGE requires an edge running the opposite way in a box beside a corner of the end: the parallel spacing sideways, from the end-of-line WITHIN ahead of the end to the parallel WITHIN behind it. One side is enough unless TWOEDGES is given.
  • ENCLOSECUT looks for cuts in the layer above, below or both, within the distance behind the end and closer than CUTSPACING to the facing edge. With ALLCUTS every such cut must be that close, and there must be one; otherwise any one will do.

End-of-line keep-out and extension spacing

  • EOLKEEPOUT builds a rectangle on the end edge: the side value beyond each corner, the forward value outwards and the backward value into the wire. Metal of another polygon overlapping it is a violation. With CORNERONLY only its corners inside the rectangle count. EXCEPTWITHIN low high removes the violation when the metal reaches into a side band from low to high beyond either corner.
  • EOLEXTENSIONSPACING: an end edge shorter than the widest entry is pushed outwards by the extension that its length selects, and so is the other edge if it is an end too. The straight-line distance must then be at least the spacing. PARALLELONLY limits the check to facing parallel edges.

Wrong-direction spacing

Both edges must run against the preferred direction, be at least the NONEOL width long when that is given, and have a parallel run length greater than the PRL value. They violate the rule when closer than the spacing. This check does not use LENGTH.

Minimum step, rectangles and area

  • MINSTEP in LEF58 form is checked in two shapes. NOBETWEENEOL width: two edges shorter than the step, separated by an end edge shorter than the width. MINADJACENTLENGTH: an edge shorter than the step whose previous or next edge is shorter than that length; with NOADJACENTEOL width a neighbouring end edge shorter than the width also counts; EXCEPTRECTANGLE passes over rectangles. Runs made only of fixed edges are skipped.
  • RECTONLY: a shape that is not a single rectangle is reported at each inside (concave) corner that is not made wholly of fixed metal.
  • LEF58_AREA is applied to shapes without fixed metal. For a rectangle, the first rule whose RECTWIDTH is at least the shorter side gives the area. Otherwise the rules are tried from the largest area down, those with EXCEPTRECTANGLE only for shapes that are not rectangles. A smaller area is a violation.

Cut spacing

  • Of the cut-layer SPACING forms, this part of the checker handles the second-layer, adjacent-cuts and parallel-overlap ones and warns that any other is skipped. CENTERTOCENTER measures between centres, otherwise the distance is from edge to edge.
  • PARALLELOVERLAP: applies to two cuts whose projections overlap. It is waived when a metal rectangle of either net on the layer above or below covers the whole region between them.
  • ADJACENTCUTS n: applies when the first cut has at least n other cuts of the rule's class closer than WITHIN; with NOPRL only cuts with no parallel run are counted. With TWOCUTS n it also applies when both cuts have at least n such neighbours.

Forbidden spacing

For FORBIDDENSPACING the checker takes a wire that passes the rule's width and run-length tests and, for TWOEDGES, has another shape within that distance on both sides. A parallel shape at a distance in the forbidden range is reported only when a third shape, touching neither of the two, also lies in the region between them.

Links

Reference