Introduction
DEF, the Design Exchange Format, describes the physical state of one chip design as text: the die outline, placement rows and routing tracks, the placed cells (components), the pins, the nets and their routed wires, and constraints on them. Place-and-route tools read and write it. It goes with LEF, the library format that defines the layers, sites, vias and cells which a DEF file names. LEF/DEF comes from Cadence, which released its version 5.8 reader and writer as open source under the Apache 2.0 licence. This page follows the grammar of that reader.
The extension .def is also used by unrelated formats, among them Windows module-definition files.
Text rules
- Tokens are separated by spaces, tabs or line breaks. Brackets and semicolons need white space round them, as in
( 0 0 ) ;. - A token beginning
#starts a comment that runs to the end of the line. - A string in double quotes may contain spaces and may run over lines;
\makes the next character literal. - Characters are 7-bit ASCII.
&ALIAS name =…&ENDALIASdefines a text substitution that a later token invokes.- Statements end with
;. Most sections open with a keyword and a count (NETS 120 ;), hold items that each begin with-and end with;, and close withENDand the keyword. Options within an item begin with+.
VERSION 5.8 ;
DIVIDERCHAR "/" ;
BUSBITCHARS "[]" ;
DESIGN top ;
UNITS DISTANCE MICRONS 1000 ;
DIEAREA ( 0 0 ) ( 100000 100000 ) ;
COMPONENTS 1 ;
- u1 NAND2 + PLACED ( 2000 2800 ) N ;
END COMPONENTS
NETS 1 ;
- n1 ( u1 Y ) ( PIN out )
+ ROUTED metal1 ( 2100 3000 ) ( 9000 * ) via12 ;
END NETS
END DESIGNFile structure and header
A file is VERSION, then optionally NAMESCASESENSITIVE, then any number of statements and sections, then END DESIGN. In versions 5.6 and earlier NAMESCASESENSITIVE, BUSBITCHARS and DIVIDERCHAR are required; DESIGN is expected in every version. Lengths and coordinates are integers in database units.
| Statement | Meaning |
|---|---|
VERSION 5.8 ; | language version |
NAMESCASESENSITIVE ON ; or OFF ; | case of names; for versions before 5.6 |
DIVIDERCHAR "/" ; | separator in hierarchical names |
BUSBITCHARS "[]" ; | characters round a bus bit number |
DESIGN name ; | design name |
TECHNOLOGY name ; | technology name |
ARRAY name ;, FLOORPLAN name ; | array and floorplan names |
HISTORY text ; | free text up to the semicolon |
UNITS DISTANCE MICRONS n ; | n database units make one micrometre |
DIEAREA ( x y ) ( x y ) … ; | die outline: two points give a rectangle, more give a polygon |
Points and orientations
A point is ( x y ). A * in place of a number repeats that coordinate from the previous point. Orientations are one of eight words; KLayout applies them as follows.
| Word | Transform | Word | Transform |
|---|---|---|---|
N | none | FN | mirror in the vertical axis |
W | rotate 90° anticlockwise | FW | mirror in the 45° line |
S | rotate 180° | FS | mirror in the horizontal axis |
E | rotate 270° anticlockwise | FE | mirror in the 135° line |
For a placed component the point is the lower left corner of the cell's outline after the orientation has been applied.
Property definitions
PROPERTYDEFINITIONS
OBJECT name INTEGER [RANGE min max] [value] ;
OBJECT name REAL [RANGE min max] [value] ;
OBJECT name STRING ["value"] ;
OBJECT name NAMEMAPSTRING value ;
END PROPERTYDEFINITIONSOBJECT is DESIGN, NET, SNET, REGION, GROUP, COMPONENT, ROW, COMPONENTPIN or NONDEFAULTRULE (the last from 5.6). Items elsewhere in the file give values with + PROPERTY name value …, where a value is a number, a quoted string or a word.
Rows, tracks and grids
ROW name site x y orient [DO nx BY ny [STEP dx dy]] [+ PROPERTY …] ;
TRACKS {X | Y} start DO count STEP space [MASK n [SAMEMASK]] [LAYER layer …] ;
GCELLGRID {X | Y} start DO count STEP space ;
CANPLACE site x y orient DO nx BY ny STEP dx dy ;
CANNOTOCCUPY site x y orient DO nx BY ny STEP dx dy ;
DEFAULTCAP count
MINPINS n WIRECAP capacitance ; …
END DEFAULTCAPA row repeats a LEF site from a starting point. TRACKS lists routing tracks at fixed X or Y positions on the named layers. GCELLGRID gives the lines of the global routing grid.
Vias and styles
VIAS count ;
- name
{+ RECT layer [+ MASK n] pt pt | + POLYGON layer [+ MASK n] pt pt pt …} …
[+ PATTERNNAME pattern] ;
- name + VIARULE rule + CUTSIZE x y + LAYERS bottom cut top
+ CUTSPACING x y + ENCLOSURE bottomX bottomY topX topY
[+ ROWCOL rows columns] [+ ORIGIN x y]
[+ OFFSET bottomX bottomY topX topY] [+ PATTERN pattern] ;
END VIAS
STYLES count ;
- STYLE number pt pt pt … ;
END STYLESA via is either a fixed set of shapes or is generated from a LEF via rule. A style is a polygon that wiring may refer to by number in place of the usual square wire end.
Non-default rules and regions
NONDEFAULTRULES count ;
- name [+ HARDSPACING]
{+ LAYER layer WIDTH w [DIAGWIDTH w] [SPACING s] [WIREEXT e]} …
[+ VIA via] … [+ VIARULE rule] … [+ MINCUTS cutlayer n] … [+ PROPERTY …] ;
END NONDEFAULTRULES
REGIONS count ;
- name pt pt [pt pt …] [+ TYPE {FENCE | GUIDE}] [+ PROPERTY …] ;
END REGIONSEach pair of points in a region is a rectangle.
Components
COMPONENTMASKSHIFT layer … ;
COMPONENTS count ;
- name model [net … | *]
[+ EEQMASTER model]
[+ GENERATE generator [pattern]]
[+ SOURCE {NETLIST | DIST | USER | TIMING}]
[+ {FIXED | COVER | PLACED} pt orient | + UNPLACED [pt orient]]
[+ MASKSHIFT digits]
[+ HALO [SOFT] left bottom right top]
[+ ROUTEHALO distance minLayer maxLayer]
[+ WEIGHT n]
[+ REGION {name | pt pt …}]
[+ FOREIGN name pt orient]
[+ PROPERTY …] ;
END COMPONENTSmodel names a LEF macro. FIXED, COVER and PLACED all give the cell a location. OpenDB, the OpenROAD database, reads FIXED as a state that a placer cannot move, COVER as a cover element that cannot be moved, and PLACED as placed but not fixed. HALO (5.6) gives a margin on the left, bottom, right and top of the cell, and SOFT is available from 5.7. OpenROAD treats the margin as a keep-out area: its global placer puts no cell inside any halo, while its clock tree synthesis may use a soft one. The component's own FOREIGN option is obsolete from 5.6.
Pins
PINS count ;
- pinName + NET netName
[+ SPECIAL] [+ DIRECTION word] [+ USE use]
[+ NETEXPR "expression"]
[+ SUPPLYSENSITIVITY pin] [+ GROUNDSENSITIVITY pin]
[+ PORT]
[+ LAYER layer [MASK n] [SPACING s | DESIGNRULEWIDTH w] pt pt] …
[+ POLYGON layer [MASK n] [SPACING s | DESIGNRULEWIDTH w] pt pt pt …] …
[+ VIA via [MASK n] ( x y )] …
[+ {FIXED | PLACED | COVER} pt orient]
[antenna values] ;
END PINSuse is SIGNAL, POWER, GROUND, CLOCK, TIEOFF, ANALOG, SCAN or RESET. Pin shapes are given relative to the pin's placement point and are turned by its orientation. PORT (5.7) starts a group of shapes with its own placement, so that one pin may have several ports.
Antenna values are + ANTENNAPINPARTIALMETALAREA, + ANTENNAPINPARTIALMETALSIDEAREA, + ANTENNAPINGATEAREA, + ANTENNAPINDIFFAREA and + ANTENNAPINPARTIALCUTAREA, each value [LAYER layer]; + ANTENNAPINMAXAREACAR, + ANTENNAPINMAXSIDEAREACAR and + ANTENNAPINMAXCUTCAR, each value LAYER layer; and + ANTENNAMODEL {OXIDE1 | OXIDE2 | OXIDE3 | OXIDE4}.
PINPROPERTIES count ;
- {component | PIN} pin + PROPERTY name value … ;
END PINPROPERTIESBlockages, fills and slots
BLOCKAGES count ;
- LAYER layer [+ SPACING s | + DESIGNRULEWIDTH w] [+ COMPONENT name]
[+ SLOTS] [+ FILLS] [+ PUSHDOWN] [+ EXCEPTPGNET] [+ MASK n]
{RECT pt pt | POLYGON pt pt pt …} … ;
- PLACEMENT [+ COMPONENT name] [+ PUSHDOWN] [+ SOFT] [+ PARTIAL percent]
RECT pt pt … ;
END BLOCKAGES
FILLS count ;
- LAYER layer [+ MASK n] [+ OPC] {RECT pt pt | POLYGON pt pt pt …} … ;
- VIA via [+ MASK n] [+ OPC] pt … ;
END FILLS
SLOTS count ;
- LAYER layer {RECT pt pt | POLYGON pt pt pt …} … ;
END SLOTSNets
NETS count ;
- {netName | MUSTJOIN ( component pin )}
[( component pin [+ SYNTHESIZED] ) | ( PIN pin ) | ( * pin )] …
[+ {ROUTED | FIXED | COVER | NOSHIELD} path [NEW path] …]
[+ SHIELDNET net] …
[+ SUBNET name [( component pin [+ SYNTHESIZED] )] …
{{ROUTED | FIXED | COVER | NOSHIELD} path [NEW path] … | NONDEFAULTRULE rule} …]
[+ VPIN name [LAYER layer] pt pt [{PLACED | FIXED | COVER} pt orient]]
[+ SOURCE {NETLIST | DIST | USER | TIMING | TEST}]
[+ USE use] [+ PATTERN {BALANCED | STEINER | TRUNK | WIREDLOGIC}]
[+ NONDEFAULTRULE rule] [+ STYLE n] [+ ORIGINAL net] [+ FIXEDBUMP]
[+ FREQUENCY f] [+ WEIGHT n] [+ XTALK n] [+ ESTCAP c]
[+ PROPERTY …] ;
END NETSRouting paths
path = layer [TAPER | TAPERRULE rule] [STYLE n] ( x y [extension] ) item …
item = ( x y [extension] )
| [MASK digits] via [orient] [DO nx BY ny STEP dx dy]
| [MASK digits] RECT ( dx1 dy1 dx2 dy2 )
| VIRTUAL ( x y )
| MASK digits ( x y [extension] )- Consecutive points are joined by wire on the current layer. A via changes to its other layer at the current point.
extensionis how far the wire runs past that point. Where it is left out at the ends of a regular net's path, KLayout uses half the wire width.RECTadds a rectangle given as offsets from the current point.VIRTUALmoves to a point without drawing wire.- A mask number before a via has three digits: top layer, cut layer, bottom layer.
- The wire width of a regular net is not in the path; it comes from the layer's default or from the non-default rule.
TAPERandTAPERRULEchange the rule for one path.
Special nets
Special nets carry wiring with explicit widths, such as power and ground.
SPECIALNETS count ;
- name [( component pin [+ SYNTHESIZED] ) | ( PIN pin ) | ( * pin )] …
[+ {ROUTED | FIXED | COVER} spath [NEW spath] …]
[+ SHIELD net spath [NEW spath] …]
[+ SHAPE shape] [+ MASK n]
[+ POLYGON layer pt pt pt …] [+ RECT layer pt pt]
[+ VIA via [orient] pt …]
[+ WIDTH layer w] [+ VOLTAGE v] [+ SPACING layer s [RANGE min max]]
[+ SOURCE {NETLIST | DIST | USER | TIMING}] [+ USE use]
[+ PATTERN pattern] [+ ORIGINAL net] [+ FIXEDBUMP]
[+ FREQUENCY f] [+ WEIGHT n] [+ ESTCAP c] [+ STYLE n]
[+ PROPERTY …] ;
END SPECIALNETS
spath = layer width [+ SHAPE shape] [+ STYLE n] ( x y [extension] ) item …shape is RING, PADRING, BLOCKRING, STRIPE, FOLLOWPIN, IOWIRE, COREWIRE, BLOCKWIRE, BLOCKAGEWIRE, FILLWIRE, FILLWIREOPC or DRCFILL. The items of an spath are those of a regular path. Without an explicit extension KLayout ends a special wire flush at its last point.
Groups and scan chains
GROUPS count ;
- name [component …]
[+ SOFT [MAXHALFPERIMETER v] [MAXX v] [MAXY v]]
[+ REGION {name | pt pt}] [+ PROPERTY …] ;
END GROUPS
SCANCHAINS count ;
- name
+ START {component | PIN} [pin]
[+ COMMONSCANPINS [( IN pin )] [( OUT pin )]]
[+ FLOATING {component [( IN pin )] [( OUT pin )] [( BITS n )]} …]
[+ ORDERED {component [( IN pin )] [( OUT pin )] [( BITS n )]} …] …
[+ PARTITION name [MAXBITS n]]
+ STOP {component | PIN} [pin] ;
END SCANCHAINSConstraint and timing sections
CONSTRAINTS count ; (ASSERTIONS has the same form)
- operand [+ RISEMIN t] [+ RISEMAX t] [+ FALLMIN t] [+ FALLMAX t] ;
- WIREDLOGIC net [+] MAXDIST d ;
END CONSTRAINTS
operand = NET net | PATH comp pin comp pin | SUM ( operand , operand … )
| DIFF ( operand , operand … )
IOTIMINGS count ;
- ( component pin )
[+ {RISE | FALL} VARIABLE min max] [+ {RISE | FALL} SLEWRATE min max]
[+ CAPACITANCE c]
[+ DRIVECELL cell [[FROMPIN pin] TOPIN pin [PARALLEL n]]] ;
END IOTIMINGS
TIMINGDISABLES count ;
- FROMPIN comp pin TOPIN comp pin ;
- THRUPIN comp pin ;
- MACRO model {FROMPIN pin TOPIN pin | THRUPIN pin} ;
- REENTRANTPATHS ;
END TIMINGDISABLES
PARTITIONS count ;
- name [TURNOFF [SETUPRISE | SETUPFALL] [HOLDRISE | HOLDFALL]]
[+ {FROMCLOCKPIN | TOCLOCKPIN} comp pin {RISE | FALL} [MIN a b] [MAX a b] PINS pin …]
[+ {FROMCOMPPIN | TOCOMPPIN} comp pin {RISEMIN a b | RISEMAX a b | FALLMIN a b | FALLMAX a b} …]
[+ {FROMIOPIN | TOIOPIN} pin {RISEMIN a | RISEMAX a | FALLMIN a | FALLMAX a} …] ;
END PARTITIONS
FLOORPLANCONSTRAINTS count ;
- name {HORIZONTAL | VERTICAL} {ALIGN | MAX n | MIN n | EQUAL n}
[+ {BOTTOMLEFT | TOPRIGHT} {( ROWS row ) | ( COMPONENTS component )} …] … ;
END FLOORPLANCONSTRAINTSExtensions
BEGINEXT "tag" … ENDEXT holds private data, which a reader passes on or skips. It may stand as a section of its own or, written + BEGINEXT, inside an item.
Reading the file
- There is no signature. A DEF file normally starts, after comments, with
VERSIONand has aDESIGN name ;statement and a closingEND DESIGN. - Names of layers, sites, vias, rules and macros refer to the LEF files read first; geometry of cells is not in the DEF file.
- Sections may appear in any order in the reader's grammar.
Not described
The explorer has no DEF viewer, so a dropped file shows as text.
Known, not yet covered
- Reference: the meaning of many options, which the Cadence LEF/DEF Language Reference defines and the grammar alone does not: the constraint, I/O timing, partition, timing-disable, floorplan-constraint and scan chain sections, the net options such as pattern, crosstalk and virtual pins, and the antenna values. That manual was not used here.
- Reference: limits that apply by version, and the required order of sections and of options.
- Viewer: no layout view.
Links
Software
Developers
- OpenDB – archived chip database that includes the Cadence LEF/DEF reader and writer (C++)
Reference
- def.y – grammar of the DEF 5.8 reader, Cadence, Apache 2.0 licence
- KLayout LEF/DEF reader – how orientations, units and wiring are turned into geometry
- OpenDB dbTypes.h – the placement states into which OpenDB reads DEF components (C++, BSD 3-clause)
- OpenROAD pull request 9837 – how OpenROAD tools treat hard and soft component halos
- Si2 – the industry body through which LEF and DEF have been distributed