Skip to content

Commit 4be2dee

Browse files
committed
Merge branch 'master+wip' into equivalent-tiles
2 parents 1a45227 + 9911b28 commit 4be2dee

File tree

4 files changed

+24
-17
lines changed

4 files changed

+24
-17
lines changed

utils/fasm/src/fasm.cpp

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "atom_netlist_utils.h"
2323
#include "netlist_writer.h"
2424
#include "vpr_utils.h"
25+
#include "route_tree_timing.h"
2526

2627
#include "fasm_utils.h"
2728

@@ -560,28 +561,30 @@ void FasmWriterVisitor::visit_atom_impl(const t_pb* atom) {
560561
check_for_param(atom);
561562
}
562563

563-
void FasmWriterVisitor::walk_routing() {
564-
auto& route_ctx = g_vpr_ctx.routing();
565-
566-
for(const auto &trace : route_ctx.trace) {
567-
const t_trace *head = trace.head;
568-
while(head != nullptr) {
569-
const t_trace *next = head->next;
570-
571-
if(next != nullptr) {
572-
const auto next_inode = next->index;
573-
auto *meta = vpr::rr_edge_metadata(head->index, next_inode, head->iswitch, "fasm_features");
574-
if(meta != nullptr) {
564+
void FasmWriterVisitor::walk_route_tree(const t_rt_node *root) {
565+
for (t_linked_rt_edge* edge = root->u.child_list; edge != nullptr; edge = edge->next) {
566+
auto *meta = vpr::rr_edge_metadata(root->inode, edge->child->inode, edge->iswitch, "fasm_features");
567+
if(meta != nullptr) {
575568
current_blk_has_prefix_ = false;
576569
output_fasm_features(meta->as_string());
577-
}
578570
}
579571

580-
head = next;
581-
}
572+
walk_route_tree(edge->child);
573+
}
574+
}
575+
576+
void FasmWriterVisitor::walk_routing() {
577+
auto& route_ctx = g_vpr_ctx.mutable_routing();
578+
579+
for(const auto &trace : route_ctx.trace) {
580+
t_trace *head = trace.head;
581+
t_rt_node* root = traceback_to_route_tree(head);
582+
walk_route_tree(root);
583+
free_route_tree(root);
582584
}
583585
}
584586

587+
585588
void FasmWriterVisitor::finish_impl() {
586589
auto& device_ctx = g_vpr_ctx.device();
587590
for(int itype = 0; itype < device_ctx.num_block_types; itype++) {

utils/fasm/src/fasm.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "netlist_writer.h"
2323
#include "lut.h"
2424
#include "parameters.h"
25+
#include "route_tree_type.h"
2526

2627
namespace fasm {
2728

@@ -71,6 +72,7 @@ class FasmWriterVisitor : public NetlistVisitor {
7172
void check_for_lut(const t_pb* atom);
7273
void output_fasm_mux(std::string fasm_mux, t_interconnect *interconnect, t_pb_graph_pin *mux_input_pin);
7374
void walk_routing();
75+
void walk_route_tree(const t_rt_node *root);
7476
std::string build_clb_prefix(const t_pb *pb, const t_pb_graph_node* pb_graph_node) const;
7577
const LutOutputDefinition* find_lut(const t_pb_graph_node* pb_graph_node);
7678
void check_for_param(const t_pb *atom);

vpr/src/route/route_tree_timing.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ bool verify_route_tree_recurr(t_rt_node* node, std::set<int>& seen_nodes);
6262

6363
t_rt_node* prune_route_tree_recurr(t_rt_node* node, CBRR& connections_inf, bool congested);
6464

65-
t_rt_node* traceback_to_route_tree(t_trace* head);
6665
static t_trace* traceback_to_route_tree_branch(t_trace* trace, std::map<int,t_rt_node*>& rr_node_to_rt);
6766

6867
static std::pair<t_trace*,t_trace*> traceback_from_route_tree_recurr(t_trace* head, t_trace* tail, const t_rt_node* node);
@@ -631,7 +630,9 @@ void free_route_tree(t_rt_node * rt_node) {
631630
rt_edge = next_edge;
632631
}
633632

634-
rr_node_to_rt_node[rt_node->inode] = nullptr;
633+
if(!rr_node_to_rt_node.empty()) {
634+
rr_node_to_rt_node.at(rt_node->inode) = nullptr;
635+
}
635636
free_rt_node(rt_node);
636637
}
637638

vpr/src/route/route_tree_timing.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ void print_route_tree(const t_rt_node* rt_root);
4343
void print_route_tree_inf(const t_rt_node* rt_root);
4444
void print_route_tree_congestion(const t_rt_node* rt_root);
4545

46+
t_rt_node* traceback_to_route_tree(t_trace* head);
4647
t_rt_node* traceback_to_route_tree(ClusterNetId inet);
4748
t_trace* traceback_from_route_tree(ClusterNetId inet, const t_rt_node* root, int num_remaining_sinks);
4849

0 commit comments

Comments
 (0)