File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,26 @@ class MetadataStorage {
2828 data_.push_back (std::make_tuple (lookup_key, meta_key, meta_value));
2929 }
3030
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+ map_.clear ();
47+ build_map ();
48+ }
49+ }
50+
3151 typename vtr::flat_map<LookupKey, t_metadata_dict>::const_iterator find (const LookupKey& lookup_key) const {
3252 check_for_map ();
3353
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) {
169169 }
170170 }
171171 }
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+ });
172179}
You can’t perform that action at this time.
0 commit comments