@@ -41,16 +41,16 @@ using vtr::t_formula_data;
41
41
/* ---- Functions for Parsing Switchblocks from Architecture ----*/
42
42
43
43
// Load an XML wireconn specification into a t_wireconn_inf
44
- t_wireconn_inf parse_wireconn (pugi::xml_node node, const pugiutil::loc_data& loc_data, const t_arch_switch_inf* switches, int num_switches );
44
+ static t_wireconn_inf parse_wireconn (pugi::xml_node node, const pugiutil::loc_data& loc_data, const std::vector< t_arch_switch_inf>& switches);
45
45
46
46
// Process the desired order of a wireconn
47
47
static void parse_switchpoint_order (const char * order, SwitchPointOrder& switchpoint_order);
48
48
49
49
// Process a wireconn defined in the inline style (using attributes)
50
- void parse_wireconn_inline (pugi::xml_node node, const pugiutil::loc_data& loc_data, t_wireconn_inf& wc, const t_arch_switch_inf* switches, int num_switches );
50
+ static void parse_wireconn_inline (pugi::xml_node node, const pugiutil::loc_data& loc_data, t_wireconn_inf& wc, const std::vector< t_arch_switch_inf>& switches);
51
51
52
52
// Process a wireconn defined in the multinode style (more advanced specification)
53
- void parse_wireconn_multinode (pugi::xml_node node, const pugiutil::loc_data& loc_data, t_wireconn_inf& wc, const t_arch_switch_inf* switches, int num_switches );
53
+ static void parse_wireconn_multinode (pugi::xml_node node, const pugiutil::loc_data& loc_data, t_wireconn_inf& wc, const std::vector< t_arch_switch_inf>& switches);
54
54
55
55
// Process a <from> or <to> sub-node of a multinode wireconn
56
56
t_wire_switchpoints parse_wireconn_from_to_node (pugi::xml_node node, const pugiutil::loc_data& loc_data);
@@ -69,7 +69,7 @@ static void parse_num_conns(std::string num_conns, t_wireconn_inf& wireconn);
69
69
static void set_switch_func_type (SB_Side_Connection& conn, const char * func_type);
70
70
71
71
/* parse switch_override in wireconn */
72
- static void parse_switch_override (const char * switch_override, t_wireconn_inf& wireconn, const t_arch_switch_inf* switches, int num_switches );
72
+ static void parse_switch_override (const char * switch_override, t_wireconn_inf& wireconn, const std::vector< t_arch_switch_inf>& switches);
73
73
74
74
/* checks for correctness of a unidir switchblock. */
75
75
static void check_unidir_switchblock (const t_switchblock_inf* sb);
@@ -85,7 +85,7 @@ static void check_wireconn(const t_arch* arch, const t_wireconn_inf& wireconn);
85
85
/* ---- Functions for Parsing Switchblocks from Architecture ----*/
86
86
87
87
/* Reads-in the wire connections specified for the switchblock in the xml arch file */
88
- void read_sb_wireconns (const t_arch_switch_inf* switches, int num_switches , pugi::xml_node Node, t_switchblock_inf* sb, const pugiutil::loc_data& loc_data) {
88
+ void read_sb_wireconns (const std::vector< t_arch_switch_inf>& switches, pugi::xml_node Node, t_switchblock_inf* sb, const pugiutil::loc_data& loc_data) {
89
89
/* Make sure that Node is a switchblock */
90
90
check_node (Node, " switchblock" , loc_data);
91
91
@@ -100,31 +100,29 @@ void read_sb_wireconns(const t_arch_switch_inf* switches, int num_switches, pugi
100
100
SubElem = get_first_child (Node, " wireconn" , loc_data);
101
101
}
102
102
for (int i = 0 ; i < num_wireconns; i++) {
103
- t_wireconn_inf wc = parse_wireconn (SubElem, loc_data, switches, num_switches ); // need to pass in switch info for switch override
103
+ t_wireconn_inf wc = parse_wireconn (SubElem, loc_data, switches); // need to pass in switch info for switch override
104
104
sb->wireconns .push_back (wc);
105
105
SubElem = SubElem.next_sibling (SubElem.name ());
106
106
}
107
-
108
- return ;
109
107
}
110
108
111
- t_wireconn_inf parse_wireconn (pugi::xml_node node, const pugiutil::loc_data& loc_data, const t_arch_switch_inf* switches, int num_switches ) {
109
+ static t_wireconn_inf parse_wireconn (pugi::xml_node node, const pugiutil::loc_data& loc_data, const std::vector< t_arch_switch_inf>& switches) {
112
110
t_wireconn_inf wc;
113
111
114
112
size_t num_children = count_children (node, " from" , loc_data, ReqOpt::OPTIONAL);
115
113
num_children += count_children (node, " to" , loc_data, ReqOpt::OPTIONAL);
116
114
117
115
if (num_children == 0 ) {
118
- parse_wireconn_inline (node, loc_data, wc, switches, num_switches );
116
+ parse_wireconn_inline (node, loc_data, wc, switches);
119
117
} else {
120
118
VTR_ASSERT (num_children > 0 );
121
- parse_wireconn_multinode (node, loc_data, wc, switches, num_switches );
119
+ parse_wireconn_multinode (node, loc_data, wc, switches);
122
120
}
123
121
124
122
return wc;
125
123
}
126
124
127
- void parse_wireconn_inline (pugi::xml_node node, const pugiutil::loc_data& loc_data, t_wireconn_inf& wc, const t_arch_switch_inf* switches, int num_switches ) {
125
+ static void parse_wireconn_inline (pugi::xml_node node, const pugiutil::loc_data& loc_data, t_wireconn_inf& wc, const std::vector< t_arch_switch_inf>& switches) {
128
126
// Parse an inline wireconn definition, using attributes
129
127
expect_only_attributes (node, {" num_conns" , " from_type" , " to_type" , " from_switchpoint" , " to_switchpoint" , " from_order" , " to_order" , " switch_override" }, loc_data);
130
128
@@ -156,10 +154,10 @@ void parse_wireconn_inline(pugi::xml_node node, const pugiutil::loc_data& loc_da
156
154
157
155
// parse switch overrides if they exist:
158
156
char_prop = get_attribute (node, " switch_override" , loc_data, ReqOpt::OPTIONAL).value ();
159
- parse_switch_override (char_prop, wc, switches, num_switches );
157
+ parse_switch_override (char_prop, wc, switches);
160
158
}
161
159
162
- void parse_wireconn_multinode (pugi::xml_node node, const pugiutil::loc_data& loc_data, t_wireconn_inf& wc, const t_arch_switch_inf* switches, int num_switches ) {
160
+ void parse_wireconn_multinode (pugi::xml_node node, const pugiutil::loc_data& loc_data, t_wireconn_inf& wc, const std::vector< t_arch_switch_inf>& switches) {
163
161
expect_only_children (node, {" from" , " to" }, loc_data);
164
162
165
163
/* get the connection style */
@@ -173,7 +171,7 @@ void parse_wireconn_multinode(pugi::xml_node node, const pugiutil::loc_data& loc
173
171
parse_switchpoint_order (char_prop, wc.to_switchpoint_order );
174
172
175
173
char_prop = get_attribute (node, " switch_override" , loc_data, ReqOpt::OPTIONAL).value ();
176
- parse_switch_override (char_prop, wc, switches, num_switches );
174
+ parse_switch_override (char_prop, wc, switches);
177
175
178
176
size_t num_from_children = count_children (node, " from" , loc_data);
179
177
size_t num_to_children = count_children (node, " to" , loc_data);
@@ -378,19 +376,17 @@ void read_sb_switchfuncs(pugi::xml_node Node, t_switchblock_inf* sb, const pugiu
378
376
/* get the next switchblock function */
379
377
SubElem = SubElem.next_sibling (SubElem.name ());
380
378
}
381
-
382
- return ;
383
379
}
384
380
385
- static void parse_switch_override (const char * switch_override, t_wireconn_inf& wireconn, const t_arch_switch_inf* switches, int num_switches ) {
381
+ static void parse_switch_override (const char * switch_override, t_wireconn_inf& wireconn, const std::vector< t_arch_switch_inf>& switches) {
386
382
// sentinel value to use default driving switch for the receiving wire type
387
383
if (switch_override == std::string (" " )) {
388
384
wireconn.switch_override_indx = DEFAULT_SWITCH; // Default
389
385
return ;
390
386
}
391
387
392
388
// iterate through the valid switch names in the arch looking for the requested switch_override
393
- for (int i = 0 ; i < num_switches ; i++) {
389
+ for (int i = 0 ; i < ( int )switches. size () ; i++) {
394
390
if (0 == strcmp (switch_override, switches[i].name .c_str ())) {
395
391
wireconn.switch_override_indx = i;
396
392
return ;
0 commit comments