Introduction
LEF together with DEF is a common file format in VLSI physical design. Generally LEF/DEF formats are quit complicated due to the complex cases in chip design. This parser is adjusted from the open source LEF parser released by Cadence Design Systems with C++ wrappers. The original parsers lie in the Thirdparty package. Users have to follow the LICENSE agreement from the original release. It is tested under various academic benchmarks for VLSI placement.
Examples
Flex/Bison Parser
See documented version: test/parsers/lef/test_adapt.cpp
#include <iostream>
#include <fstream>
#include <string>
using std::cout;
using std::endl;
using std::string;
{
public:
{
cout << "constructing LefDataBase" << endl;
}
{
cout << "lef version = " << v << endl;
}
{
cout << "lef version = " << v << endl;
}
{
cout << "lef dividechar = " << v << endl;
}
{
v.print(stdout);
}
{
cout << "lef manufacturing = " << v << endl;
}
{
v.print(stdout);
}
{
cout << "lef clearancemeasure = " << v << endl;
}
{
cout << "lef busbitchars = " << v << endl;
}
{
v.print(stdout);
}
{
v.print(stdout);
}
{
v.print(stdout);
}
{
v.print(stdout);
}
{
v.print(stdout);
}
{
cout << __func__ << " => " << v << endl;
}
{
v.print(stdout);
}
{
v.print(stdout);
}
{
v.print(stdout);
}
{
v.print(stdout);
}
{
v.print(stdout);
}
};
void test1(std::string
const& filename)
{
cout << "////////////// test1 ////////////////" << endl;
cout << "read successfully" << endl;
else cout << "read failed" << endl;
}
int main(
int argc,
char** argv)
{
if (argc > 1)
{
for (int i = 1; i < argc; ++i)
}
else
cout << "at least 1 argument is required" << endl;
return 0;
}
Custom class that inheritates LefParser::LefDataBase with all the required callbacks defined....
virtual void lef_pin_cbk(lefiPin const &v)
pin callback, describe pins in a standard cell
virtual void lef_spacing_cbk(LefParser::lefiSpacing const &v)
spacing callback
virtual void lef_dividerchar_cbk(string const &v)
set divider characters
virtual void lef_version_cbk(string const &v)
set LEF version
virtual void lef_site_cbk(LefParser::lefiSite const &v)
site callback
virtual void lef_layer_cbk(LefParser::lefiLayer const &v)
add layer
virtual void lef_units_cbk(LefParser::lefiUnits const &v)
set unit
virtual void lef_obstruction_cbk(LefParser::lefiObstruction const &v)
obstruction callback
virtual void lef_busbitchars_cbk(string const &v)
set bus bit characters
LefParser::LefDataBase base_type
base type
virtual void lef_prop_cbk(LefParser::lefiProp const &v)
property callback
virtual void lef_macro_cbk(LefParser::lefiMacro const &v)
macro callback, describe standard cell type
virtual void lef_clearancemeasure_cbk(string const &v)
set clearance measure
virtual void lef_viarule_cbk(LefParser::lefiViaRule const &v)
add via rule
virtual void lef_useminspacing_cbk(lefiUseMinSpacing const &v)
set use min space
virtual void lef_maxstackvia_cbk(LefParser::lefiMaxStackVia const &v)
noise margin callback
virtual void lef_macrobegin_cbk(std::string const &v)
macro begin callback, describe standard cell type
virtual void lef_via_cbk(LefParser::lefiVia const &v)
add via
virtual void lef_manufacturing_cbk(double v)
set manufacturing entry
Base class for lef database. Only pure virtual functions are defined. User needs to inheritate this...
bool read(LefDataBase &db, const string &lefFile)
API for LefParser. Read LEF file and initialize database by calling user-defined callback functions.
void test1()
test function API
Compiling and running commands (assuming LIMBO_DIR is exported as the environment variable to the path where limbo library is installed)
g++ -o test_adapt test_adapt.cpp -I $LIMBO_DIR/include -L $LIMBO_DIR/lib -llefparseradapt
./test_adapt benchmarks/cells.lef
All Examples
References
LICENSE
Copyright 2012 - 2016, Cadence Design Systems
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http:
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.