@@ -41,16 +41,16 @@ using vtr::t_formula_data;
4141/* ---- Functions for Parsing Switchblocks from Architecture ----*/
4242
4343// 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);
4545
4646// Process the desired order of a wireconn
4747static void parse_switchpoint_order (const char * order, SwitchPointOrder& switchpoint_order);
4848
4949// 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);
5151
5252// 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);
5454
5555// Process a <from> or <to> sub-node of a multinode wireconn
5656t_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);
6969static void set_switch_func_type (SB_Side_Connection& conn, const char * func_type);
7070
7171/* 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);
7373
7474/* checks for correctness of a unidir switchblock. */
7575static 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);
8585/* ---- Functions for Parsing Switchblocks from Architecture ----*/
8686
8787/* 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) {
8989 /* Make sure that Node is a switchblock */
9090 check_node (Node, " switchblock" , loc_data);
9191
@@ -100,31 +100,29 @@ void read_sb_wireconns(const t_arch_switch_inf* switches, int num_switches, pugi
100100 SubElem = get_first_child (Node, " wireconn" , loc_data);
101101 }
102102 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
104104 sb->wireconns .push_back (wc);
105105 SubElem = SubElem.next_sibling (SubElem.name ());
106106 }
107-
108- return ;
109107}
110108
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) {
112110 t_wireconn_inf wc;
113111
114112 size_t num_children = count_children (node, " from" , loc_data, ReqOpt::OPTIONAL);
115113 num_children += count_children (node, " to" , loc_data, ReqOpt::OPTIONAL);
116114
117115 if (num_children == 0 ) {
118- parse_wireconn_inline (node, loc_data, wc, switches, num_switches );
116+ parse_wireconn_inline (node, loc_data, wc, switches);
119117 } else {
120118 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);
122120 }
123121
124122 return wc;
125123}
126124
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) {
128126 // Parse an inline wireconn definition, using attributes
129127 expect_only_attributes (node, {" num_conns" , " from_type" , " to_type" , " from_switchpoint" , " to_switchpoint" , " from_order" , " to_order" , " switch_override" }, loc_data);
130128
@@ -156,10 +154,10 @@ void parse_wireconn_inline(pugi::xml_node node, const pugiutil::loc_data& loc_da
156154
157155 // parse switch overrides if they exist:
158156 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);
160158}
161159
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) {
163161 expect_only_children (node, {" from" , " to" }, loc_data);
164162
165163 /* get the connection style */
@@ -173,7 +171,7 @@ void parse_wireconn_multinode(pugi::xml_node node, const pugiutil::loc_data& loc
173171 parse_switchpoint_order (char_prop, wc.to_switchpoint_order );
174172
175173 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);
177175
178176 size_t num_from_children = count_children (node, " from" , loc_data);
179177 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
378376 /* get the next switchblock function */
379377 SubElem = SubElem.next_sibling (SubElem.name ());
380378 }
381-
382- return ;
383379}
384380
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) {
386382 // sentinel value to use default driving switch for the receiving wire type
387383 if (switch_override == std::string (" " )) {
388384 wireconn.switch_override_indx = DEFAULT_SWITCH; // Default
389385 return ;
390386 }
391387
392388 // 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++) {
394390 if (0 == strcmp (switch_override, switches[i].name .c_str ())) {
395391 wireconn.switch_override_indx = i;
396392 return ;
0 commit comments