Skip to content

Commit 028e604

Browse files
[Scatter-Gather] Fix issue parsing the wireconn tag
1 parent baaac60 commit 028e604

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

libs/libarchfpga/src/parse_switchblocks.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -177,26 +177,26 @@ static t_wireconn_inf parse_wireconn_inline(pugi::xml_node node,
177177
parse_num_conns(char_prop, wc);
178178

179179
// get from type
180-
char_prop = get_attribute(node, "from_type", loc_data, from_to_required).value();
181-
if (!can_skip_from_or_to) {
180+
char_prop = get_attribute(node, "from_type", loc_data, from_to_required).as_string();
181+
if (*char_prop) { // if from_to_required is ReqOpt::REQUIRED, char_prop is definitely not null. Otherwise, it's optional and should be null checked.
182182
parse_comma_separated_wire_types(char_prop, wc.from_switchpoint_set);
183183
}
184184

185185
// get to type
186-
char_prop = get_attribute(node, "to_type", loc_data, from_to_required).value();
187-
if (!can_skip_from_or_to) {
186+
char_prop = get_attribute(node, "to_type", loc_data, from_to_required).as_string();
187+
if (*char_prop) {
188188
parse_comma_separated_wire_types(char_prop, wc.to_switchpoint_set);
189189
}
190190

191191
// get the source wire point
192-
char_prop = get_attribute(node, "from_switchpoint", loc_data, from_to_required).value();
193-
if (!can_skip_from_or_to) {
192+
char_prop = get_attribute(node, "from_switchpoint", loc_data, from_to_required).as_string();
193+
if (*char_prop) {
194194
parse_comma_separated_wire_points(char_prop, wc.from_switchpoint_set);
195195
}
196196

197197
// get the destination wire point
198-
char_prop = get_attribute(node, "to_switchpoint", loc_data, from_to_required).value();
199-
if (!can_skip_from_or_to) {
198+
char_prop = get_attribute(node, "to_switchpoint", loc_data, from_to_required).as_string();
199+
if (*char_prop) {
200200
parse_comma_separated_wire_points(char_prop, wc.to_switchpoint_set);
201201
}
202202

libs/libarchfpga/src/read_xml_arch_file_sg.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,10 @@ void process_sg_tag(pugi::xml_node sg_list_tag,
125125
// Parse scatter pattern
126126
pugi::xml_node scatter_node = pugiutil::get_single_child(sg_tag, "scatter", loc_data);
127127
t_wireconn_inf scatter_wireconn = parse_wireconn(pugiutil::get_single_child(scatter_node, "wireconn", loc_data), loc_data, switches, true);
128-
if (!gather_wireconn.from_switchpoint_set.empty()) {
128+
if (!scatter_wireconn.from_switchpoint_set.empty()) {
129129
archfpga_throw(loc_data.filename_c_str(), loc_data.line(sg_tag), "Scatter wireconn specification should not set any 'from' switchpoints");
130130
}
131-
if (gather_wireconn.to_switchpoint_set.empty()) {
131+
if (scatter_wireconn.to_switchpoint_set.empty()) {
132132
archfpga_throw(loc_data.filename_c_str(), loc_data.line(sg_tag), "Scatter wireconn specification does not include any switchpoints.");
133133
}
134134
sg.scatter_pattern = scatter_wireconn;

0 commit comments

Comments
 (0)