Limbo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Limbo.Parsers.LefParser

Table of Contents

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:
LefDataBase() : base_type()
{
cout << "constructing LefDataBase" << endl;
}
virtual void lef_version_cbk(string const& v)
{
cout << "lef version = " << v << endl;
}
virtual void lef_version_cbk(double v)
{
cout << "lef version = " << v << endl;
}
virtual void lef_dividerchar_cbk(string const& v)
{
cout << "lef dividechar = " << v << endl;
}
virtual void lef_units_cbk(LefParser::lefiUnits const& v)
{
v.print(stdout);
}
virtual void lef_manufacturing_cbk(double v)
{
cout << "lef manufacturing = " << v << endl;
}
virtual void lef_busbitchars_cbk(string const& v)
{
cout << "lef busbitchars = " << v << endl;
}
virtual void lef_layer_cbk(LefParser::lefiLayer const& v)
{
v.print(stdout);
}
virtual void lef_via_cbk(LefParser::lefiVia const& v)
{
v.print(stdout);
}
virtual void lef_viarule_cbk(LefParser::lefiViaRule const& v)
{
v.print(stdout);
}
virtual void lef_spacing_cbk(LefParser::lefiSpacing const& v)
{
v.print(stdout);
}
virtual void lef_site_cbk(LefParser::lefiSite const& v)
{
v.print(stdout);
}
virtual void lef_macrobegin_cbk(std::string const& v)
{
cout << __func__ << " => " << v << endl;
}
virtual void lef_macro_cbk(LefParser::lefiMacro const& v)
{
v.print(stdout);
}
virtual void lef_prop_cbk(LefParser::lefiProp const& v)
{
v.print(stdout);
}
virtual void lef_maxstackvia_cbk(LefParser::lefiMaxStackVia const& v)
{
v.print(stdout);
}
virtual void lef_obstruction_cbk(LefParser::lefiObstruction const& v)
{
v.print(stdout);
}
virtual void lef_pin_cbk(lefiPin const& v)
{
v.print(stdout);
}
};
void test1(std::string const& filename)
{
cout << "////////////// test1 ////////////////" << endl;
if (LefParser::read(db, filename))
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)
test1(argv[i]);
}
else
cout << "at least 1 argument is required" << endl;
return 0;
}

Compiling and running commands (assuming LIMBO_DIR is exported as the environment variable to the path where limbo library is installed)

1 g++ -o test_adapt test_adapt.cpp -I $LIMBO_DIR/include -L $LIMBO_DIR/lib -llefparseradapt
2 ./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://www.apache.org/licenses/LICENSE-2.0
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.