###
LEF 5.8 C/C++ Programming Interface (Open Licensing Program)

# 1

# Introduction

This chapter contains the following sections:

| Overview

| LEF Reader Working Modes

| Comparison Utility

| Compressed LEF Files

| Orientation Codes

## Overview

This manual describes the application programming interface (API) routines for the following Cadence® Library Exchange Format (LEF) components:

| LEF reader

| LEF writer

Cadence Design Systems, Inc. uses these routines internally with many tools that read and write LEF. The API supports LEF version 5.8, but also reads earlier versions of LEF.

You can use the API routines documented in this manual with tools that write these older versions, as long as none of the tools in an interdependent flow introduce newer constructs.

Note: The writer portion of the API does not always optimize the LEF output.

## LEF Reader Working Modes

The LEF reader can work in two modes - compatibility mode and session-based mode.

| Compatibility mode (session-less mode) - This mode is compatible with the old parser behavior. You can call the parser initialization once with lefrInit(), adjust parsing settings and initialize the parser callbacks any time. The properties once defined in PROPERTYDEFINITIONS sections will be also defined in all subsequent file reads.

| Session-based mode - This mode introduces the concept of the parsing session. In this mode, the order of calling parsing configuration and processing API is strict:

a.
Parser initialization: Call lefrInitSession() instead of lefrInit() to start a new parsing session and close any old parsing session, if opened.

b.
Parser configuration: Call multiple callback setters and parsing parameters setting functions.

c.
Data processing: - Do one or multiple parsing of LEF files with the lefrRead() function.

d.
Cleaning of the parsing configuration: Call the lefrClear() function (optional). The call releases all parsing session data and closes the parsing session. If this is skipped, the data cleaning and the session closing is done by the next lefrInitSession() call.

> In the session-based mode, the properties once defined in PROPERTYDEFINITIONS remain active in all the LEF file parsing cycles in the session and the properties definition data is cleaned when the parsing session ends.

> The session-based mode does not require you to call callbacks and property unsetter functions. All callbacks and properties are set to default by the next lefrInitSession() call.

> The session-based mode allows you to avoid the lasting PROPERTYDEFINITIONS data effect when not required as you can just configure your application to parse one file per session.

By default, the LEF parser works in the compatibility mode. To activate the session-based mode, you must use lefrInitSession() instead of lefrInit().

Note: Currently, the compatibility mode can be used in all old applications where the code has not been adjusted. The lef2oa translator has already been adjusted to use the session-based parsing mode.

## Comparison Utility

The LEF file comparison utility, lefdefdiff, helps you verify that your usage of the API is consistent and complete. This utility reads two LEF files, generally an initial file and the resulting file from reading in an application, then writes out a LEF file. The comparison utility reads and writes the data so that the UNIX diff utility can be used to compare the files.

Because the LEF file comparison utility works incrementally (writing out as it operates), the size of files it can process has no limitations. However, large files can have performance restrictions. In general, this utility is intended only to verify the use of the API; that is, the utility is not a component of a production design flow.

## Compressed LEF Files

The LEF reader can parse compressed LEF files. To do so, you must link the liblef.a and liblefzlib.a libraries.

A zlib compression library is also required in order to read compressed LEF files. The zlib source code is free software that can be downloaded from www.gnu.com.

For information on compressed file routines, see "LEF Compressed File Routines."

## Orientation Codes

Orientation codes are used throughout the LEF reader routines. The orientation codes are the same for all routines.

A number from 0 to 7, corresponding to the compass direction orientations, represents the orientation of a site or component. The following figure shows the combination of mirroring and rotation that is used for each of the eight possible orientations.

.

orient 0 = N | orient 4 = FN
orient 1 = W | orient 5 = FW
orient 2 = S | orient 6 = FS
orient 3 = E | orient 7 = FE

Note: The location given is the lower left corner of the resulting site or component after the mirroring and rotation are applied. It is not the location of the origin of the child cell.

Return to top of page

For support, see Cadence Online Support service.
Copyright © 2016, Cadence Design Systems, Inc.
All rights reserved.