Limbo 3.5.4
Loading...
Searching...
No Matches
test_bison.cpp
Go to the documentation of this file.
1
7
8#include <iostream>
9#include <fstream>
10
12
13using std::cout;
14using std::cin;
15using std::endl;
16using std::string;
17
21{
22 public:
25 {
26 cout << "BookshelfDataBase::" << __func__ << endl;
27 }
28
31 virtual void resize_bookshelf_node_terminals(int nn, int nt)
32 {
33 cout << __func__ << " => " << nn << ", " << nt << endl;
34 }
35
36 virtual void resize_bookshelf_net(int n)
37 {
38 cout << __func__ << " => " << n << endl;
39 }
40
41 virtual void resize_bookshelf_pin(int n)
42 {
43 cout << __func__ << " => " << n << endl;
44 }
45
46 virtual void resize_bookshelf_row(int n)
47 {
48 cout << __func__ << " => " << n << endl;
49 }
50
51 virtual void resize_bookshelf_shapes(int n)
52 {
53 cout << __func__ << " => " << n << endl;
54 }
55
57 {
58 cout << __func__ << " => " << n << endl;
59 }
60
62 {
63 cout << __func__ << " => " << n << endl;
64 }
65
68 virtual void add_bookshelf_terminal(string& name, int w, int h)
69 {
70 cout << __func__ << " => " << name << ", " << w << ", " << h << endl;
71 }
72
75 virtual void add_bookshelf_terminal_NI(string& name, int w, int h)
76 {
77 cout << __func__ << " => " << name << ", " << w << ", " << h << endl;
78 }
79
83 virtual void add_bookshelf_node(string& name, int w, int h, bool is_cell)
84 {
85 cout << __func__ << " => " << name << ", " << w << ", " << h << ", " << is_cell << endl;
86 }
87
88 virtual void add_bookshelf_net(BookshelfParser::Net const& net)
89 {
90 net.print(cout);
91 }
92
93 virtual void add_bookshelf_row(BookshelfParser::Row const& row)
94 {
95 row.print(cout);
96 }
97
102 virtual void set_bookshelf_node_position(string const& name, double x, double y, string const& orient, string const& status, bool plFlag)
103 {
104 cout << __func__ << " => " << name << ", " << x << ", " << y << ", " << orient << ", " << status << ", plFlag = " << plFlag << endl;
105 }
106 virtual void set_bookshelf_net_weight(string const& name, double w)
107 {
108 cout << __func__ << " => " << name << ", " << w << endl;
109 }
110
112 {
113 shape.print(cout);
114 }
115
117 {
118 info.print(cout);
119 }
120
121 virtual void add_bookshelf_niterminal_layer(string const&, string const&)
122 {
123 }
124
125 virtual void add_bookshelf_blockage_layers(string const&, std::vector<string> const&)
126 {
127 }
128
129 virtual void set_bookshelf_design(string& name)
130 {
131 cout << __func__ << " => " << name << endl;
132 }
133
134 virtual void bookshelf_end()
135 {
136 cout << __func__ << endl;
137 }
138};
139
141void test1(string const& filename)
142{
143 cout << "////////////// test1 ////////////////" << endl;
145 BookshelfParser::read(db, filename);
146}
147
149void test2(string const& filename)
150{
151 cout << "////////////// test2 ////////////////" << endl;
153 BookshelfParser::Driver driver (db);
154 //driver.trace_scanning = true;
155 //driver.trace_parsing = true;
156
157 driver.parse_file(filename);
158}
159
164int main(int argc, char** argv)
165{
166
167 if (argc > 1)
168 {
169 test1(argv[1]);
170 test2(argv[1]);
171 }
172 else
173 cout << "at least 1 argument is required" << endl;
174
175 return 0;
176}
Driver for Bookshelf parser.
void test2(string const &filename)
test 2: use class wrapper BookshelfParser::Driver
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 parse_file(const string &filename)
bool read(BookshelfDataBase &db, const string &auxFile)
API for BookshelfParser. Read .aux file and parse all other files.
net to describe interconnection of netlist
virtual void print(ostream &ss) const
node shape to describe the shapes of node
virtual void print(ostream &ss) const
information for routing to describe .route refer to DAC 2012 contest http://archive....
virtual void print(ostream &ss) const
virtual void print(ostream &ss) const
int main()
void test1()
test function API