Limbo 3.5.4
Loading...
Searching...
No Matches
Limbo.Parsers.BookshelfParser

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 resize_bookshelf_shapes(int n)
{
cout << __func__ << " => " << n << endl;
}
{
cout << __func__ << " => " << n << endl;
}
{
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_terminal_NI(string& name, int w, int h)
{
cout << __func__ << " => " << name << ", " << w << ", " << h << endl;
}
virtual void add_bookshelf_node(string& name, int w, int h, bool is_cell)
{
cout << __func__ << " => " << name << ", " << w << ", " << h << ", " << is_cell << 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_net_weight(string const& name, double w)
{
cout << __func__ << " => " << name << ", " << w << endl;
}
virtual void set_bookshelf_shape(BookshelfParser::NodeShape const& shape)
{
shape.print(cout);
}
virtual void set_bookshelf_route_info(BookshelfParser::RouteInfo const& info)
{
info.print(cout);
}
virtual void add_bookshelf_niterminal_layer(string const&, string const&)
{
}
virtual void add_bookshelf_blockage_layers(string const&, std::vector<string> const&)
{
}
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;
}
Driver for Bookshelf parser.
Custom class that inheritates BookshelfParser::BookshelfDataBase with all the required callbacks defi...
virtual void add_bookshelf_net(BookshelfParser::Net const &net)
virtual void set_bookshelf_design(string &name)
virtual void resize_bookshelf_shapes(int n)
set number of shapes
BookshelfDataBase()
constructor
virtual void set_bookshelf_route_info(BookshelfParser::RouteInfo const &info)
set routing information
virtual void resize_bookshelf_pin(int n)
virtual void resize_bookshelf_node_terminals(int nn, int nt)
virtual void add_bookshelf_row(BookshelfParser::Row const &row)
virtual void add_bookshelf_niterminal_layer(string const &, string const &)
set NI terminal with layers
virtual void add_bookshelf_terminal(string &name, int w, int h)
virtual void set_bookshelf_net_weight(string const &name, double w)
set net weight
virtual void bookshelf_end()
end of bookshelf
virtual void set_bookshelf_node_position(string const &name, double x, double y, string const &orient, string const &status, bool plFlag)
virtual void add_bookshelf_blockage_layers(string const &, std::vector< string > const &)
set blockages with layers
virtual void resize_bookshelf_row(int n)
virtual void set_bookshelf_shape(BookshelfParser::NodeShape const &shape)
set node shapes
virtual void resize_bookshelf_niterminal_layers(int n)
set number of NI terminals with layers
virtual void resize_bookshelf_blockage_layers(int n)
set number of blockage nodes with layers
virtual void resize_bookshelf_net(int n)
virtual void add_bookshelf_terminal_NI(string &name, int w, int h)
virtual void add_bookshelf_node(string &name, int w, int h, bool is_cell)
Base class for bookshelf database. Only pure virtual functions are defined. User needs to inheritat...
bool read(BookshelfDataBase &db, const string &auxFile)
API for BookshelfParser. Read .aux file and parse all other files.
virtual void print(ostream &ss) const
virtual void print(ostream &ss) const
virtual void print(ostream &ss) const
virtual void print(ostream &ss) const
int main()
void test2(string const &filename)
test std::list
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_bison test_bison.cpp -I $LIMBO_DIR/include -L $LIMBO_DIR/lib -lbookshelfparser
./test_bison benchmarks/simple/acc64.aux

All Examples

References