@@ -47,11 +47,15 @@ static void parse_switchpoint_order(const char* order, SwitchPointOrder& switchp
47
47
* @param node XML node containing inline wireconn attributes.
48
48
* @param loc_data Location data for error reporting.
49
49
* @param switches List of architecture switch definitions (used for switch overrides).
50
+ * @param can_skip_from_to Determines if the from or to attributes are optional or mandatory.
51
+ * <wireconn> tags for switch blocks require mandatory from/to attributes while those for scatter-gather
52
+ * patterns are optional.
50
53
* @return A `t_wireconn_inf` structure populated with parsed data.
51
54
*/
52
55
static t_wireconn_inf parse_wireconn_inline (pugi::xml_node node,
53
56
const pugiutil::loc_data& loc_data,
54
- const std::vector<t_arch_switch_inf>& switches);
57
+ const std::vector<t_arch_switch_inf>& switches,
58
+ bool can_skip_from_to);
55
59
56
60
/* *
57
61
* @brief Parses a multi-node `<wireconn>` definition with `<from>` and `<to>` children.
@@ -126,14 +130,15 @@ void read_sb_wireconns(const std::vector<t_arch_switch_inf>& switches,
126
130
127
131
t_wireconn_inf parse_wireconn (pugi::xml_node node,
128
132
const pugiutil::loc_data& loc_data,
129
- const std::vector<t_arch_switch_inf>& switches) {
133
+ const std::vector<t_arch_switch_inf>& switches,
134
+ bool can_skip_from_to) {
130
135
131
136
size_t num_children = count_children (node, " from" , loc_data, ReqOpt::OPTIONAL);
132
137
num_children += count_children (node, " to" , loc_data, ReqOpt::OPTIONAL);
133
138
134
139
t_wireconn_inf wireconn;
135
140
if (num_children == 0 ) {
136
- wireconn = parse_wireconn_inline (node, loc_data, switches);
141
+ wireconn = parse_wireconn_inline (node, loc_data, switches, can_skip_from_to );
137
142
} else {
138
143
VTR_ASSERT (num_children > 0 );
139
144
wireconn = parse_wireconn_multinode (node, loc_data, switches);
@@ -154,33 +159,40 @@ t_wireconn_inf parse_wireconn(pugi::xml_node node,
154
159
155
160
static t_wireconn_inf parse_wireconn_inline (pugi::xml_node node,
156
161
const pugiutil::loc_data& loc_data,
157
- const std::vector<t_arch_switch_inf>& switches) {
162
+ const std::vector<t_arch_switch_inf>& switches,
163
+ bool can_skip_from_to) {
158
164
159
165
// Parse an inline wireconn definition, using attributes
160
- expect_only_attributes (node, {" num_conns" , " from_type" , " to_type" , " from_switchpoint" , " to_switchpoint" , " from_order" , " to_order" , " switch_override" }, loc_data);
166
+ expect_only_attributes (node, {" num_conns" , " from_type" , " to_type" , " from_switchpoint" , " to_switchpoint" , " from_order" , " to_order" , " switch_override" , " side " }, loc_data);
161
167
162
168
t_wireconn_inf wc;
163
169
170
+ ReqOpt from_to_required = can_skip_from_to ? ReqOpt::OPTIONAL : ReqOpt::REQUIRED;
171
+
164
172
// get the connection style
165
173
const char * char_prop = get_attribute (node, " num_conns" , loc_data).value ();
166
174
parse_num_conns (char_prop, wc);
167
175
168
176
// get from type
169
- char_prop = get_attribute (node, " from_type" , loc_data).value ();
170
- parse_comma_separated_wire_types (char_prop, wc.from_switchpoint_set );
171
-
177
+ char_prop = get_attribute (node, " from_type" , loc_data, from_to_required).value ();
178
+ if (!can_skip_from_to) {
179
+ parse_comma_separated_wire_types (char_prop, wc.from_switchpoint_set );
180
+ }
172
181
// get to type
173
- char_prop = get_attribute (node, " to_type" , loc_data).value ();
174
- parse_comma_separated_wire_types (char_prop, wc.to_switchpoint_set );
175
-
182
+ char_prop = get_attribute (node, " to_type" , loc_data, from_to_required).value ();
183
+ if (!can_skip_from_to) {
184
+ parse_comma_separated_wire_types (char_prop, wc.to_switchpoint_set );
185
+ }
176
186
// get the source wire point
177
- char_prop = get_attribute (node, " from_switchpoint" , loc_data).value ();
178
- parse_comma_separated_wire_points (char_prop, wc.from_switchpoint_set );
179
-
187
+ char_prop = get_attribute (node, " from_switchpoint" , loc_data, from_to_required).value ();
188
+ if (!can_skip_from_to) {
189
+ parse_comma_separated_wire_points (char_prop, wc.from_switchpoint_set );
190
+ }
180
191
// get the destination wire point
181
- char_prop = get_attribute (node, " to_switchpoint" , loc_data).value ();
182
- parse_comma_separated_wire_points (char_prop, wc.to_switchpoint_set );
183
-
192
+ char_prop = get_attribute (node, " to_switchpoint" , loc_data, from_to_required).value ();
193
+ if (!can_skip_from_to) {
194
+ parse_comma_separated_wire_points (char_prop, wc.to_switchpoint_set );
195
+ }
184
196
char_prop = get_attribute (node, " from_order" , loc_data, ReqOpt::OPTIONAL).value ();
185
197
parse_switchpoint_order (char_prop, wc.from_switchpoint_order );
186
198
0 commit comments