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

Table of Contents

Introduction

Bookshelf format is widely used in VLSI physical design such as placement and routing. It is originally developed by UCSD. The Bookshelf parser can read .aux file and extract all other files. Then it parses the rest files and invokes user-defined callback functions.

Examples

Flex/Bison Parser

See documented version: test/parsers/bookshelf/test_bison.cpp

#include <iostream>
#include <fstream>
using std::cout;
using std::cin;
using std::endl;
using std::string;
{
public:
{
cout << "BookshelfDataBase::" << __func__ << endl;
}
virtual void resize_bookshelf_node_terminals(int nn, int nt)
{
cout << __func__ << " => " << nn << ", " << nt << endl;
}
virtual void resize_bookshelf_net(int n)
{
cout << __func__ << " => " << n << endl;
}
virtual void resize_bookshelf_pin(int n)
{
cout << __func__ << " => " << n << endl;
}
virtual void resize_bookshelf_row(int n)
{
cout << __func__ << " => " << n << endl;
}
virtual void add_bookshelf_terminal(string& name, int w, int h)
{
cout << __func__ << " => " << name << ", " << w << ", " << h << endl;
}
virtual void add_bookshelf_node(string& name, int w, int h)
{
cout << __func__ << " => " << name << ", " << w << ", " << h << endl;
}
virtual void add_bookshelf_net(BookshelfParser::Net const& net)
{
net.print(cout);
}
virtual void add_bookshelf_row(BookshelfParser::Row const& row)
{
row.print(cout);
}
virtual void set_bookshelf_node_position(string const& name, double x, double y, string const& orient, string const& status, bool plFlag)
{
cout << __func__ << " => " << name << ", " << x << ", " << y << ", " << orient << ", " << status << ", plFlag = " << plFlag << endl;
}
virtual void set_bookshelf_design(string& name)
{
cout << __func__ << " => " << name << endl;
}
virtual void bookshelf_end()
{
cout << __func__ << endl;
}
};
void test1(string const& filename)
{
cout << "////////////// test1 ////////////////" << endl;
BookshelfParser::read(db, filename);
}
void test2(string const& filename)
{
cout << "////////////// test2 ////////////////" << endl;
//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_bison test_bison.cpp -I $LIMBO_DIR/include -L $LIMBO_DIR/lib -lbookshelfparser
2 ./test_bison benchmarks/simple/acc64.aux

All Examples

References