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

Table of Contents

Introduction

DEF together with LEF 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. The parser does not contain full API of the original LEF/DEF parsers, but it is tested under various academic benchmarks for VLSI placement.

Examples

Flex/Bison Parser

See documented version: test/parsers/def/test_adapt.cpp

#include <iostream>
#include <fstream>
using std::cout;
using std::cin;
using std::endl;
using std::string;
{
public:
{
cout << "DefDataBase::" << __func__ << endl;
}
virtual void set_def_dividerchar(string const& token)
{
cout << __func__ << " => " << token << endl;
}
virtual void set_def_busbitchars(string const& token)
{
cout << __func__ << " => " << token << endl;
}
virtual void set_def_version(string const& token)
{
cout << __func__ << " => " << token << endl;
}
virtual void set_def_design(string const& token)
{
cout << __func__ << " => " << token << endl;
}
virtual void set_def_unit(int token)
{
cout << __func__ << " => " << token << endl;
}
virtual void set_def_diearea(int t1, int t2, int t3, int t4)
{
cout << __func__ << " => " << t1 << "," << t2 << "," << t3 << "," << t4 << endl;
}
virtual void add_def_row(DefParser::Row const&)
{
cout << __func__ << endl;
}
virtual void add_def_component(DefParser::Component const& c)
{
cout << __func__ << ": " << c.comp_name << ": status = " << c.status << endl;
}
virtual void resize_def_component(int token)
{
cout << __func__ << " => " << token << endl;
}
virtual void add_def_pin(DefParser::Pin const& p)
{
cout << __func__ << ": " << p.pin_name << endl;
}
virtual void resize_def_pin(int token)
{
cout << __func__ << " => " << token << endl;
}
virtual void add_def_net(DefParser::Net const& n)
{
cout << __func__ << ": " << n.net_name << ": weight " << n.net_weight << endl;
}
virtual void resize_def_net(int token)
{
cout << __func__ << " => " << token << endl;
}
virtual void resize_def_blockage(int n)
{
cout << __func__ << " => " << n << endl;
}
virtual void add_def_placement_blockage(std::vector<std::vector<int> > const& vBbox)
{
cout << __func__ << " => ";
for (std::vector<std::vector<int> >::const_iterator it = vBbox.begin(); it != vBbox.end(); ++it)
cout << "(" << (*it)[0] << ", " << (*it)[1] << ", " << (*it)[2] << ", " << (*it)[3] << ") ";
cout << endl;
}
virtual void end_def_design()
{
cout << __func__ << endl;
}
};
void test1(string const& filename)
{
cout << "////////////// test1 ////////////////" << endl;
DefParser::read(db, filename);
}
void test2(string const& filename)
{
cout << "////////////// test2 ////////////////" << endl;
DefParser::Driver driver (db);
//driver.trace_scanning = true;
//driver.trace_parsing = true;
driver.parse_file(filename);
}
int main(int argc, char** argv)
{
if (argc > 1)
{
test1(argv[1]);
test2(argv[1]);
}
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 -ldefparseradapt
2 ./test_adapt benchmarks/simple.def

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.