@@ -770,7 +770,9 @@ struct RR_Graph_Builder {
770
770
for (intermediate_node* root : roots) {
771
771
if (root == last)
772
772
continue ;
773
+ VTR_ASSERT (redirect_.find (std::make_tuple (node_id, last->loc )) != redirect_.end ());
773
774
auto key1 = redirect_[std::make_tuple (node_id, last->loc )];
775
+ VTR_ASSERT (redirect_.find (std::make_tuple (node_id, root->loc )) != redirect_.end ());
774
776
auto key2 = redirect_[std::make_tuple (node_id, root->loc )];
775
777
776
778
shorts_.emplace_back (std::get<0 >(key1), std::get<1 >(key1), std::get<2 >(key1),
@@ -1074,6 +1076,7 @@ struct RR_Graph_Builder {
1074
1076
bool input;
1075
1077
int node_id;
1076
1078
std::tie (input, std::ignore, node_id) = pin_vec[j];
1079
+ VTR_ASSERT (redirect_.find (std::make_tuple (node_id, loc)) != redirect_.end ());
1077
1080
auto chan_key = redirect_[std::make_tuple (node_id, loc)];
1078
1081
e_rr_type pin = input ? e_rr_type::SINK : e_rr_type::SOURCE;
1079
1082
e_rr_type mux = input ? e_rr_type::IPIN : e_rr_type::OPIN;
@@ -1116,6 +1119,14 @@ struct RR_Graph_Builder {
1116
1119
}
1117
1120
}
1118
1121
1122
+ char * int_to_string (char * buff, int value) {
1123
+ if (value < 10 ) {
1124
+ return &(*buff = ' 0' + value) + 1 ;
1125
+ } else {
1126
+ return &(*int_to_string (buff, value / 10 ) = ' 0' + value % 10 ) + 1 ;
1127
+ }
1128
+ }
1129
+
1119
1130
void pack_pips () {
1120
1131
for (auto & i : pips_) {
1121
1132
int node1, node2;
@@ -1128,7 +1139,9 @@ struct RR_Graph_Builder {
1128
1139
bool forward;
1129
1140
std::tie (name, wire0, wire1, forward) = metadata;
1130
1141
location loc = tile_to_loc_[tile_id];
1142
+ VTR_ASSERT (redirect_.find (std::make_tuple (node1, loc)) != redirect_.end ());
1131
1143
auto key1 = redirect_[std::make_tuple (node1, loc)];
1144
+ VTR_ASSERT (redirect_.find (std::make_tuple (node2, loc)) != redirect_.end ());
1132
1145
auto key2 = redirect_[std::make_tuple (node2, loc)];
1133
1146
1134
1147
VTR_ASSERT (loc_type_idx_to_rr_idx_.find (key1) != loc_type_idx_to_rr_idx_.end ());
@@ -1139,14 +1152,19 @@ struct RR_Graph_Builder {
1139
1152
sink = loc_type_idx_to_rr_idx_[key2];
1140
1153
device_ctx_.rr_graph_builder .emplace_back_edge (RRNodeId (src), RRNodeId (sink), sw_id);
1141
1154
1142
- vtr::interned_string name_ (empty_);
1143
- vtr::interned_string value_ (empty_);
1144
-
1145
1155
char metadata_[100 ];
1146
- sprintf (metadata_, " %d,%d,%d,%d" , name, wire0, wire1, forward ? 1 : 0 );
1156
+ char * temp = int_to_string (metadata_, name);
1157
+ *temp++ = ' ,' ;
1158
+ temp = int_to_string (temp, wire0);
1159
+ *temp++ = ' ,' ;
1160
+ temp = int_to_string (temp, wire1);
1161
+ *temp++ = ' ,' ;
1162
+ temp = int_to_string (temp, forward ? 1 : 0 );
1163
+ *temp++ = 0 ;
1164
+
1165
+ vtr::interned_string name_ (device_ctx_.arch ->strings .intern_string (vtr::string_view (" FPGAInterchange" )));
1166
+ vtr::interned_string value_ (device_ctx_.arch ->strings .intern_string (vtr::string_view (metadata_)));
1147
1167
1148
- name_ = device_ctx_.arch ->strings .intern_string (vtr::string_view (" FPGAInterchange" ));
1149
- value_ = device_ctx_.arch ->strings .intern_string (vtr::string_view (metadata_));
1150
1168
vpr::add_rr_edge_metadata (src, sink, sw_id, name_, value_);
1151
1169
}
1152
1170
}
0 commit comments