Limbo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
BookshelfDriver.h
Go to the documentation of this file.
1 
8 #ifndef BOOKSHELFPARSER_DRIVER_H
9 #define BOOKSHELFPARSER_DRIVER_H
10 
11 #include "BookshelfDataBase.h"
12 
16 namespace BookshelfParser {
17 
18 using std::cout;
19 using std::endl;
20 using std::cerr;
21 using std::string;
22 using std::vector;
23 using std::pair;
24 using std::make_pair;
25 using std::ostringstream;
26 
36 class Driver
37 {
38 public:
42 
45 
48 
50  string streamname;
51 
57  bool parse_stream(std::istream& in,
58  const string& sname = "stream input");
59 
65  bool parse_string(const string& input,
66  const string& sname = "string stream");
67 
73  bool parse_file(const string& filename);
74 
75  // To demonstrate pure handling of parse errors, instead of
76  // simply dumping them on the standard error output, we will pass
77  // them to the driver using the following two member functions.
78 
81  void error(const class location& l, const string& m);
82 
85  void error(const string& m);
86 
89  class Scanner* lexer;
90 
94 
97  void setPlFlag(bool flag);
98  // .nodes file
100  void numNodeTerminalsCbk(int, int);
102  void terminalEntryCbk(string&, int, int);
104  void nodeEntryCbk(string&, int, int, string&);
106  void nodeEntryCbk(string&, int, int);
107  // .nets file
109  void numNetCbk(int);
111  void numPinCbk(int);
113  void netPinEntryCbk(string&, char, double, double, double, double, string&);
115  void netPinEntryCbk(string&, char, double, double, double=0.0, double=0.0);
117  void netNameAndDegreeCbk(string&, int);
119  void netEntryCbk();
120  // .pl file
122  void plNodeEntryCbk(string&, double, double, string&, string&);
124  void plNodeEntryCbk(string&, double, double, string&);
125  // .scl file
127  void sclNumRows(int);
129  void sclCoreRowStart(string const&);
131  void sclCoreRowCoordinate(int);
133  void sclCoreRowHeight(int);
135  void sclCoreRowSitewidth(int);
137  void sclCoreRowSitespacing(int);
139  void sclCoreRowSiteorient(int);
141  void sclCoreRowSitesymmetry(int);
143  void sclCoreRowSubRowOrigin(int);
145  void sclCoreRowNumSites(int);
147  void sclCoreRowEnd();
148  // .wts file
149  // .aux file
151  void auxCbk(string&, vector<string>&);
152 
155  vector<string> const& bookshelfFiles() const {return m_vBookshelfFiles;}
156 protected:
159  vector<string> m_vBookshelfFiles;
160  bool m_plFlag;
161 };
162 
167 bool read(BookshelfDataBase& db, const string& auxFile);
171 bool readPl(BookshelfDataBase& db, const string& plFile);
172 
173 } // namespace example
174 
175 #endif // EXAMPLE_DRIVER_H
void netEntryCbk()
from .nets file, net entry
void error(const class location &l, const string &m)
bool trace_scanning
enable debug output in the flex scanner
bool parse_file(const string &filename)
bool trace_parsing
enable debug output in the bison parser
bool readPl(BookshelfDataBase &db, const string &plFile)
Read .pl file only, the callback only provide positions and orientation.
vector< string > m_vBookshelfFiles
store bookshelf files except .aux
void sclCoreRowCoordinate(int)
from .scl file, core row coordinate
void numPinCbk(int)
from .nets file, number of pins
Base class for bookshelf database. Only pure virtual functions are defined. User needs to inheritate ...
namespace for BookshelfParser
void auxCbk(string &, vector< string > &)
from .aux file, other bookshelf files
void sclCoreRowSiteorient(int)
from .scl file, site orientation
string streamname
stream name (file or input stream) used for error messages.
net to describe interconnection of netlist
void sclCoreRowSitewidth(int)
from .scl file, site width
void plNodeEntryCbk(string &, double, double, string &, string &)
from .pl file, node entry in placement
void sclCoreRowSitesymmetry(int)
from .scl file, site symmetry
vector< string > const & bookshelfFiles() const
void sclCoreRowEnd()
from .scl file, end of core row
Row m_row
temporary storage of row
void netPinEntryCbk(string &, char, double, double, double, double, string &)
from .nets file, entry of net and pin
void sclCoreRowStart(string const &)
from .scl file, core row start
void terminalEntryCbk(string &, int, int)
from .nodes file, terminal entry
Driver(BookshelfDataBase &db)
BookshelfDataBase & m_db
bool parse_string(const string &input, const string &sname="string stream")
bool read(BookshelfDataBase &db, const string &auxFile)
API for BookshelfParser. Read .aux file and parse all other files.
void netNameAndDegreeCbk(string &, int)
from .nets file, net name and degree
void sclCoreRowSubRowOrigin(int)
from .scl file, subrow origin
void sclNumRows(int)
from .scl file, number of rows
Net m_net
temporary storage of net
bool parse_stream(std::istream &in, const string &sname="stream input")
void sclCoreRowNumSites(int)
from .scl file, number of sites
void sclCoreRowSitespacing(int)
from .scl file, site spacing
void setPlFlag(bool flag)
control m_plFlag
void numNetCbk(int)
from .nets file, number of nets
void sclCoreRowHeight(int)
from .scl file, core row height
bool m_plFlag
if true, indicate that only reads .pl file, this will result in different callbacks in the database ...
void nodeEntryCbk(string &, int, int, string &)
from .nodes file, node entry
Database for Bookshelf parser.
void numNodeTerminalsCbk(int, int)
from .nodes file, number of node and terminals