File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,25 @@ class MetadataStorage {
28
28
data_.push_back (std::make_tuple (lookup_key, meta_key, meta_value));
29
29
}
30
30
31
+ // Use the given mapping function to change the keys
32
+ void remap_keys (std::function<LookupKey(LookupKey)> key_map) {
33
+ if (map_.empty ()) {
34
+ for (auto & entry : data_) {
35
+ std::get<0 >(entry) = key_map (std::get<0 >(entry));
36
+ }
37
+ } else {
38
+ VTR_ASSERT (data_.empty ());
39
+ for (auto & dict : map_) {
40
+ for (auto & entry : dict.second ) {
41
+ for (auto & value : entry.second ) {
42
+ data_.push_back (std::make_tuple (key_map (dict.first ), entry.first , value.as_string ()));
43
+ }
44
+ }
45
+ }
46
+ build_map ();
47
+ }
48
+ }
49
+
31
50
typename vtr::flat_map<LookupKey, t_metadata_dict>::const_iterator find (const LookupKey& lookup_key) const {
32
51
check_for_map ();
33
52
Original file line number Diff line number Diff line change @@ -169,4 +169,11 @@ void reorder_rr_graph_nodes(const t_router_opts& router_opts) {
169
169
}
170
170
}
171
171
}
172
+
173
+ device_ctx.rr_node_metadata .remap_keys ([&](int node) { return size_t (dest_order[RRNodeId (node)]); });
174
+ device_ctx.rr_edge_metadata .remap_keys ([&](std::tuple<int , int , short > edge) {
175
+ return std::make_tuple (size_t (dest_order[RRNodeId (std::get<0 >(edge))]),
176
+ size_t (dest_order[RRNodeId (std::get<1 >(edge))]),
177
+ std::get<2 >(edge));
178
+ });
172
179
}
You can’t perform that action at this time.
0 commit comments