@@ -136,7 +136,7 @@ static std::string handle_fasm_prefix(const t_metadata_dict *meta,
136
136
return fasm_prefix.at (pb_graph_node->placement_index ) + " ." ;
137
137
}
138
138
139
- std::string FasmWriterVisitor::build_clb_prefix (const t_pb *pb, const t_pb_graph_node* pb_graph_node) const {
139
+ std::string FasmWriterVisitor::build_clb_prefix (const t_pb *pb, const t_pb_graph_node* pb_graph_node, bool * is_parent_pb_null ) const {
140
140
std::string clb_prefix = " " ;
141
141
142
142
const t_pb *pb_for_graph_node = nullptr ;
@@ -146,22 +146,24 @@ std::string FasmWriterVisitor::build_clb_prefix(const t_pb *pb, const t_pb_graph
146
146
if (root_clb_ != pb_graph_node && pb_graph_node->parent_pb_graph_node != root_clb_) {
147
147
VTR_ASSERT (pb_graph_node->parent_pb_graph_node != nullptr );
148
148
if (pb != nullptr ) {
149
- while (pb_for_graph_node == nullptr ) {
150
- pb_for_graph_node = pb->find_pb (pb_graph_node);
151
- if (pb_for_graph_node == nullptr ) {
152
- if (pb->parent_pb == nullptr ) {
153
- break ;
154
- }
155
- pb = pb->parent_pb ;
156
- }
157
- }
149
+ while (pb_for_graph_node == nullptr ) {
150
+ pb_for_graph_node = pb->find_pb (pb_graph_node);
158
151
159
- if (pb_for_graph_node != nullptr ) {
160
- mode_index = pb_for_graph_node->mode ;
152
+ if (pb_for_graph_node == nullptr ) {
153
+ if (pb->parent_pb == nullptr ) {
154
+ *is_parent_pb_null = true ;
155
+ break ;
156
+ }
157
+ pb = pb->parent_pb ;
161
158
}
159
+ }
160
+
161
+ if (pb_for_graph_node != nullptr ) {
162
+ mode_index = pb_for_graph_node->mode ;
163
+ }
162
164
}
163
165
164
- clb_prefix = build_clb_prefix (pb, pb_graph_node->parent_pb_graph_node );
166
+ clb_prefix = build_clb_prefix (pb, pb_graph_node->parent_pb_graph_node , is_parent_pb_null );
165
167
}
166
168
167
169
const auto *pb_type = pb_graph_node->pb_type ;
@@ -172,9 +174,9 @@ std::string FasmWriterVisitor::build_clb_prefix(const t_pb *pb, const t_pb_graph
172
174
VTR_ASSERT (mode_index < pb_type->num_modes );
173
175
174
176
clb_prefix += handle_fasm_prefix (&pb_type->modes [mode_index].meta ,
175
- pb_graph_node, pb_type);
177
+ pb_graph_node, pb_type);
176
178
} else {
177
- VTR_ASSERT (mode_index == 0 );
179
+ VTR_ASSERT (mode_index == 0 );
178
180
}
179
181
180
182
return clb_prefix;
@@ -220,7 +222,13 @@ void FasmWriterVisitor::visit_all_impl(const t_pb_routes &pb_routes, const t_pb*
220
222
221
223
const t_pb_graph_node *pb_graph_node = pb->pb_graph_node ;
222
224
223
- clb_prefix_ = build_clb_prefix (pb, pb_graph_node);
225
+ // Check if this PB is `open` and has to be skipped
226
+ bool is_parent_pb_null = false ;
227
+ std::string clb_prefix = build_clb_prefix (pb, pb_graph_node, &is_parent_pb_null);
228
+ if (is_parent_pb_null == true ) {
229
+ return ;
230
+ }
231
+ clb_prefix_ = clb_prefix;
224
232
225
233
t_pb_type *pb_type = pb_graph_node->pb_type ;
226
234
auto *mode = &pb_type->modes [pb->mode ];
@@ -233,7 +241,7 @@ void FasmWriterVisitor::visit_all_impl(const t_pb_routes &pb_routes, const t_pb*
233
241
if (mode != nullptr && std::string (mode->name ) == " wire" ) {
234
242
auto io_pin = is_node_used (pb_routes, pb_graph_node);
235
243
if (io_pin != nullptr ) {
236
- const auto & route = pb_routes.at (io_pin->pin_count_in_cluster );
244
+ const auto & route = pb_routes.at (io_pin->pin_count_in_cluster );
237
245
const int num_inputs = *route.pb_graph_pin ->parent_node ->num_input_pins ;
238
246
const auto *lut_definition = find_lut (route.pb_graph_pin ->parent_node );
239
247
VTR_ASSERT (lut_definition->num_inputs == num_inputs);
0 commit comments