#

## lef

LEF-format input and output

### Usage:

> lef option

> > where option may be one of the following:
> > read [filename]
> >   Read a LEF file named filename[.lef]
> > read [filename] -import
> >   Read a LEF file. Import standard cells from `.mag` files
> > read [filename] -annotate
> >   Read a LEF file. Use any macros defined in the LEF file to annotate existing layouts, and ignore all other macros.
> > write [cell] [-tech] [-hide [distance]] [-toplayer] [-pinonly [distance]] [-nomaster]
> >   Write LEF for the current or indicated cell.
> >   Option -tech writes the technology information (layer mapping and rules) to the same file as the cell macro.
> >   Option -hide generates an abstract view that has all interior detail removed, leaving only pins and obstruction layers covering the entire cell with cut-out areas for the pins. Option -hide may take an additional value argument distance which will hide the central part of a cell starting a distance distance from the edge. The distance value is in units of lambda by default, but like other distance measurements changes with respect to the snap command setting, and can take a suffix such as "um" to specify a physical distance relative to the current CIF/GDS output scale.
> >   Option -toplayer outputs pin geometry only for the topmost layer belonging to the pin; all connected layers underneath will be output as obstructions.
> >   Option -pinonly will mark only areas that are port labels as pins, while marking the rest of each related net as an obstruction. Value distance, if given, will extend any pin beyond the marked port label along the length of the same net, to the specified distance into the interior of the cell.
> >   Option -nomaster will prevent the generation of output geometry on layers defined as MASTERSLICE.
> > writeall [-tech] [-hide [distance]] [-notop] [-toplayer] [-nomaster]
> >   Write all cells including the top-level cell. This might be appropriate if the top-level cell is a compendium of standard cells.
> >   With option -notop: Write all subcells of the top-level cell, but not the top-level cell itself. This is appropriate for generating a LEF library from a layout, for which the layout itself would be written to a DEF file.
> >   Options -hide, -tech, and -toplayer are the same as for the lef write command.
> > nocheck [netname ...]|[none]|[*]
> >   Do not check for antenna diffusion and gate area on the nets with the names given as option netname. Any number of net names may be given as arguments. Typically, power and ground nets should not need these checks. If the nets are attached to port labels that have been flagged with the use "power" or "ground", then these nets will be skipped automatically. If not, then this command option provides an alternative way to avoid running the checks, which can cause a huge performance hit when generating a LEF view of a large layout. The single argument "*" will cause all net checks to be skipped, and no antenna information will appear in the LEF file output. The single argument "none" removes the list of net names for which antenna checks should be skipped.
> > datestamp [value|default]
> >   Force all cell definitions generated from LEF macros to have the datestamp (timestamp) of value. This can be used to ensure that the timestamps of abstract views match the timestamps of the equivalent full views, so that switching between abstract and full views does not cause timestamp mismatch handling. The string default cancels any fixed timestamps.
> > help
> >   Print help information

### Summary:

> The lef command writes LEF-format files, which are files containing technology information and information about the content of standard cells. It is used in conjunction with the def command to read databases of routed digital standard-cell layouts. The `.lef` file shares some information with the technology file in magic. At a minimum, to read `.lef` files from third-party sources, the technology file should have a lef section that maps magic layers to layer names that are found in the `.lef` and `.def` files. Without this information, magic will attempt to make an educated guess about the routing layers, which normally will be named in an obvious manner such as "metal1", "metal2", etc. The technology file section may be necessary to handle more complicated input such as obstruction layers. Most other aspects of a technology will be contained within the `.lef` file. When writing `.lef` files, magic will use internal layer names for the routing layers if no other information is present in the lef section of the technology file.

> Because the lef format allows standard cells to be minimally defined (for purposes of protecting intellectual property), often the `.lef` file contains no actual layout information for the standard cells. magic provides a command option "-import". When specified, for each macro cell in the input `.lef` file, magic will look for a `.mag` file of the same name. If found, it will be loaded and used in preference to the definition in the `lef` file.

> Magic uses the port mechanism for labels to determine what are the standard cells in a design. All cells containing port labels will be considered standard cells when writing a `.lef` file. Ports retain various bits of information used by the LEF/DEF definition, including the port use and direction. See the port documentation for more information.

> Macro cell properties common to the LEF/DEF definition but that have no corresponding database interpretation in magic are retained using the cell property method in magic. There are specific property names associated with the LEF format. These are as follows:

> LEFclass
>   Corresponds to the value of CLASS for a macro cell in the LEF format.
> LEFsymmetry
>   Corresponds to the value of SYMMETRY for a macro cell in the LEF format.
> LEFsite
>   Corresponds to the value of SITE for a macro cell in the LEF format.
> LEFproperties
>   Corresponds to the value of PROPERTY for a macro cell in the LEF format. LEF properties should be specified in a single cell property, in key:value pairs and space-separated. Like all properties containing spaces, the entire property string should be enclosed in quotes. When writing output, each of the space-separated entries will be output on its own PROPERTY line in the LEF file.
> Normally, when importing a LEF/DEF layout into magic, one will first execute a lef read command followed by a def read command. Likewise, when writing a layout, one will first execute a lef writeall -notop command followed by a def write command.

> If a LEF file of macro definitions is read when the same cells as named in the macros already exist in the magic database, then the LEF file macros will be used to annotate the existing layout. This includes setting pin properties (see above), extending the area of labels to cover an entire port, and setting a bounding box on the cell corresponding to the LEF origin and size.

> Note that lef write -hide will generate only the minimum amount of obstruction bounding any non-pin geometry inside a layout. To enforce a larger obstruction area, the property "OBS_BBOX" can be created in the cell, a string with four values for the lower left and upper right corners of the bounding box, in magic internal database units.

### Implementation Notes:

> lef is implemented as a built-in command in magic. Only the critical portion of the LEF syntax has been implemented. In particular, simulation-specific properties of the technology and of macro cells are not implemented.

### See Also:

> def
> port
> property
> snap

Return to command index

Last updated: June 28, 2021 at 12:28pm