17
17
#include < sstream>
18
18
#include < string>
19
19
#include < unordered_set>
20
- using namespace std ;
21
20
22
21
#include " atom_netlist.h"
23
22
#include " atom_netlist_utils.h"
@@ -43,13 +42,13 @@ using namespace std;
43
42
#include " read_route.h"
44
43
45
44
/* ************Functions local to this module*************/
46
- static void process_route (ifstream& fp, const char * filename, int & lineno);
47
- static void process_nodes (ifstream& fp, ClusterNetId inet, const char * filename, int & lineno);
48
- static void process_nets (ifstream& fp, ClusterNetId inet, string name, std::vector<std::string> input_tokens, const char * filename, int & lineno);
49
- static void process_global_blocks (ifstream& fp, ClusterNetId inet, const char * filename, int & lineno);
50
- static void format_coordinates (int & x, int & y, string coord, ClusterNetId net, const char * filename, const int lineno);
51
- static void format_pin_info (string& pb_name, string& port_name, int & pb_pin_num, string input);
52
- static string format_name (string name);
45
+ static void process_route (std:: ifstream& fp, const char * filename, int & lineno);
46
+ static void process_nodes (std:: ifstream& fp, ClusterNetId inet, const char * filename, int & lineno);
47
+ static void process_nets (std:: ifstream& fp, ClusterNetId inet, std:: string name, std::vector<std::string> input_tokens, const char * filename, int & lineno);
48
+ static void process_global_blocks (std:: ifstream& fp, ClusterNetId inet, const char * filename, int & lineno);
49
+ static void format_coordinates (int & x, int & y, std:: string coord, ClusterNetId net, const char * filename, const int lineno);
50
+ static void format_pin_info (std:: string& pb_name, std:: string& port_name, int & pb_pin_num, std:: string input);
51
+ static std:: string format_name (std:: string name);
53
52
54
53
/* ************Global Functions****************************/
55
54
bool read_route (const char * route_file, const t_router_opts& router_opts, bool verify_file_digests) {
@@ -61,9 +60,9 @@ bool read_route(const char* route_file, const t_router_opts& router_opts, bool v
61
60
/* Begin parsing the file */
62
61
VTR_LOG (" Begin loading FPGA routing file.\n " );
63
62
64
- string header_str;
63
+ std:: string header_str;
65
64
66
- ifstream fp;
65
+ std:: ifstream fp;
67
66
fp.open (route_file);
68
67
69
68
int lineno = 0 ;
@@ -73,7 +72,7 @@ bool read_route(const char* route_file, const t_router_opts& router_opts, bool v
73
72
" Cannot open %s routing file" , route_file);
74
73
}
75
74
76
- getline (fp, header_str);
75
+ std:: getline (fp, header_str);
77
76
++lineno;
78
77
79
78
std::vector<std::string> header = vtr::split (header_str);
@@ -94,7 +93,7 @@ bool read_route(const char* route_file, const t_router_opts& router_opts, bool v
94
93
init_route_structs (router_opts.bb_factor );
95
94
96
95
/* Check dimensions*/
97
- getline (fp, header_str);
96
+ std:: getline (fp, header_str);
98
97
++lineno;
99
98
header.clear ();
100
99
header = vtr::split (header_str);
@@ -127,11 +126,11 @@ bool read_route(const char* route_file, const t_router_opts& router_opts, bool v
127
126
return is_feasible;
128
127
}
129
128
130
- static void process_route (ifstream& fp, const char * filename, int & lineno) {
129
+ static void process_route (std:: ifstream& fp, const char * filename, int & lineno) {
131
130
/* Walks through every net and add the routing appropriately*/
132
- string input;
131
+ std:: string input;
133
132
std::vector<std::string> tokens;
134
- while (getline (fp, input)) {
133
+ while (std:: getline (fp, input)) {
135
134
++lineno;
136
135
tokens.clear ();
137
136
tokens = vtr::split (input);
@@ -148,7 +147,7 @@ static void process_route(ifstream& fp, const char* filename, int& lineno) {
148
147
tokens.clear ();
149
148
}
150
149
151
- static void process_nets (ifstream& fp, ClusterNetId inet, string name, std::vector<std::string> input_tokens, const char * filename, int & lineno) {
150
+ static void process_nets (std:: ifstream& fp, ClusterNetId inet, std:: string name, std::vector<std::string> input_tokens, const char * filename, int & lineno) {
152
151
/* Check if the net is global or not, and process appropriately */
153
152
auto & cluster_ctx = g_vpr_ctx.mutable_clustering ();
154
153
@@ -190,7 +189,7 @@ static void process_nets(ifstream& fp, ClusterNetId inet, string name, std::vect
190
189
return ;
191
190
}
192
191
193
- static void process_nodes (ifstream& fp, ClusterNetId inet, const char * filename, int & lineno) {
192
+ static void process_nodes (std:: ifstream& fp, ClusterNetId inet, const char * filename, int & lineno) {
194
193
/* Not a global net. Goes through every node and add it into trace.head*/
195
194
196
195
auto & cluster_ctx = g_vpr_ctx.mutable_clustering ();
@@ -201,14 +200,14 @@ static void process_nodes(ifstream& fp, ClusterNetId inet, const char* filename,
201
200
t_trace* tptr = route_ctx.trace [inet].head ;
202
201
203
202
/* remember the position of the last line in order to go back*/
204
- streampos oldpos = fp.tellg ();
203
+ std:: streampos oldpos = fp.tellg ();
205
204
int inode, x, y, x2, y2, ptc, switch_id, offset;
206
205
int node_count = 0 ;
207
- string input;
206
+ std:: string input;
208
207
std::vector<std::string> tokens;
209
208
210
209
/* Walk through every line that begins with Node:*/
211
- while (getline (fp, input)) {
210
+ while (std:: getline (fp, input)) {
212
211
++lineno;
213
212
214
213
tokens.clear ();
@@ -292,7 +291,7 @@ static void process_nodes(ifstream& fp, ClusterNetId inet, const char* filename,
292
291
t_pb_graph_pin* pb_pin = get_pb_graph_node_pin_from_block_pin (iblock, pin_num);
293
292
t_pb_type* pb_type = pb_pin->parent_node ->pb_type ;
294
293
295
- string pb_name, port_name;
294
+ std:: string pb_name, port_name;
296
295
int pb_pin_num;
297
296
298
297
format_pin_info (pb_name, port_name, pb_pin_num, tokens[6 + offset]);
@@ -334,18 +333,18 @@ static void process_nodes(ifstream& fp, ClusterNetId inet, const char* filename,
334
333
335
334
/* This function goes through all the blocks in a global net and verify it with the
336
335
* clustered netlist and the placement */
337
- static void process_global_blocks (ifstream& fp, ClusterNetId inet, const char * filename, int & lineno) {
336
+ static void process_global_blocks (std:: ifstream& fp, ClusterNetId inet, const char * filename, int & lineno) {
338
337
auto & cluster_ctx = g_vpr_ctx.mutable_clustering ();
339
338
auto & place_ctx = g_vpr_ctx.placement ();
340
339
341
- string block, bnum_str;
340
+ std:: string block, bnum_str;
342
341
int x, y;
343
342
std::vector<std::string> tokens;
344
343
int pin_counter = 0 ;
345
344
346
- streampos oldpos = fp.tellg ();
345
+ std:: streampos oldpos = fp.tellg ();
347
346
/* Walk through every block line*/
348
- while (getline (fp, block)) {
347
+ while (std:: getline (fp, block)) {
349
348
++lineno;
350
349
tokens.clear ();
351
350
tokens = vtr::split (block);
@@ -391,10 +390,10 @@ static void process_global_blocks(ifstream& fp, ClusterNetId inet, const char* f
391
390
}
392
391
}
393
392
394
- static void format_coordinates (int & x, int & y, string coord, ClusterNetId net, const char * filename, const int lineno) {
393
+ static void format_coordinates (int & x, int & y, std:: string coord, ClusterNetId net, const char * filename, const int lineno) {
395
394
/* Parse coordinates in the form of (x,y) into correct x and y values*/
396
395
coord = format_name (coord);
397
- stringstream coord_stream (coord);
396
+ std:: stringstream coord_stream (coord);
398
397
if (!(coord_stream >> x)) {
399
398
vpr_throw (VPR_ERROR_ROUTE, filename, lineno,
400
399
" Net %lu has coordinates that is not in the form (x,y)" , size_t (net));
@@ -406,12 +405,12 @@ static void format_coordinates(int& x, int& y, string coord, ClusterNetId net, c
406
405
}
407
406
}
408
407
409
- static void format_pin_info (string& pb_name, string& port_name, int & pb_pin_num, string input) {
408
+ static void format_pin_info (std:: string& pb_name, std:: string& port_name, int & pb_pin_num, std:: string input) {
410
409
/* Parse the pin info in the form of pb_name.port_name[pb_pin_num]
411
410
*into its appropriate variables*/
412
- stringstream pb_info (input);
413
- getline (pb_info, pb_name, ' .' );
414
- getline (pb_info, port_name, ' [' );
411
+ std:: stringstream pb_info (input);
412
+ std:: getline (pb_info, pb_name, ' .' );
413
+ std:: getline (pb_info, port_name, ' [' );
415
414
pb_info >> pb_pin_num;
416
415
if (!pb_info) {
417
416
VPR_FATAL_ERROR (VPR_ERROR_ROUTE,
@@ -421,7 +420,7 @@ static void format_pin_info(string& pb_name, string& port_name, int& pb_pin_num,
421
420
}
422
421
423
422
/* Return actual name by extracting it out of the form of (name)*/
424
- static string format_name (string name) {
423
+ static std:: string format_name (std:: string name) {
425
424
if (name.length () > 2 ) {
426
425
name.erase (name.begin ());
427
426
name.erase (name.end () - 1 );
0 commit comments