use strong id for nets to be routed in LbRouter
This commit is contained in:
parent
2f1bcdd27d
commit
2b37fcb296
|
@ -140,7 +140,7 @@ bool LbRouter::try_route(const LbRRGraph& lb_rr_graph,
|
||||||
unsigned int inet;
|
unsigned int inet;
|
||||||
/* Iterate across all nets internal to logic block */
|
/* Iterate across all nets internal to logic block */
|
||||||
for (inet = 0; inet < lb_nets_.size() && !is_impossible; inet++) {
|
for (inet = 0; inet < lb_nets_.size() && !is_impossible; inet++) {
|
||||||
int idx = inet;
|
NetId idx = NetId(inet);
|
||||||
if (is_skip_route_net(lb_rr_graph, lb_nets_[idx].rt_tree)) {
|
if (is_skip_route_net(lb_rr_graph, lb_nets_[idx].rt_tree)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -202,7 +202,7 @@ bool LbRouter::try_route(const LbRRGraph& lb_rr_graph,
|
||||||
} else {
|
} else {
|
||||||
--inet;
|
--inet;
|
||||||
VTR_LOGV(verbosity < 3, "Net '%s' is impossible to route within proposed %s cluster\n",
|
VTR_LOGV(verbosity < 3, "Net '%s' is impossible to route within proposed %s cluster\n",
|
||||||
atom_nlist.net_name(lb_nets_[inet].atom_net_id).c_str(), lb_type_->name);
|
atom_nlist.net_name(lb_nets_[NetId(inet)].atom_net_id).c_str(), lb_type_->name);
|
||||||
is_routed_ = false;
|
is_routed_ = false;
|
||||||
}
|
}
|
||||||
pres_con_fac_ *= params_.pres_fac_mult;
|
pres_con_fac_ *= params_.pres_fac_mult;
|
||||||
|
@ -225,8 +225,8 @@ void LbRouter::fix_duplicate_equivalent_pins(const AtomContext& atom_ctx,
|
||||||
for (size_t ilb_net = 0; ilb_net < lb_nets_.size(); ++ilb_net) {
|
for (size_t ilb_net = 0; ilb_net < lb_nets_.size(); ++ilb_net) {
|
||||||
//Collect all the sink terminals indicies which target a particular node
|
//Collect all the sink terminals indicies which target a particular node
|
||||||
std::map<LbRRNodeId, std::vector<int>> duplicate_terminals;
|
std::map<LbRRNodeId, std::vector<int>> duplicate_terminals;
|
||||||
for (size_t iterm = 1; iterm < lb_nets_[ilb_net].terminals.size(); ++iterm) {
|
for (size_t iterm = 1; iterm < lb_nets_[NetId(ilb_net)].terminals.size(); ++iterm) {
|
||||||
LbRRNodeId node = lb_nets_[ilb_net].terminals[iterm];
|
LbRRNodeId node = lb_nets_[NetId(ilb_net)].terminals[iterm];
|
||||||
|
|
||||||
duplicate_terminals[node].push_back(iterm);
|
duplicate_terminals[node].push_back(iterm);
|
||||||
}
|
}
|
||||||
|
@ -238,8 +238,8 @@ void LbRouter::fix_duplicate_equivalent_pins(const AtomContext& atom_ctx,
|
||||||
for (size_t idup_term = 0; idup_term < kv.second.size(); ++idup_term) {
|
for (size_t idup_term = 0; idup_term < kv.second.size(); ++idup_term) {
|
||||||
int iterm = kv.second[idup_term]; //The index in terminals which is duplicated
|
int iterm = kv.second[idup_term]; //The index in terminals which is duplicated
|
||||||
|
|
||||||
VTR_ASSERT(lb_nets_[ilb_net].atom_pins.size() == lb_nets_[ilb_net].terminals.size());
|
VTR_ASSERT(lb_nets_[NetId(ilb_net)].atom_pins.size() == lb_nets_[NetId(ilb_net)].terminals.size());
|
||||||
AtomPinId atom_pin = lb_nets_[ilb_net].atom_pins[iterm];
|
AtomPinId atom_pin = lb_nets_[NetId(ilb_net)].atom_pins[iterm];
|
||||||
VTR_ASSERT(atom_pin);
|
VTR_ASSERT(atom_pin);
|
||||||
|
|
||||||
const t_pb_graph_pin* pb_graph_pin = find_pb_graph_pin(atom_ctx.nlist, atom_ctx.lookup, atom_pin);
|
const t_pb_graph_pin* pb_graph_pin = find_pb_graph_pin(atom_ctx.nlist, atom_ctx.lookup, atom_pin);
|
||||||
|
@ -255,16 +255,16 @@ void LbRouter::fix_duplicate_equivalent_pins(const AtomContext& atom_ctx,
|
||||||
"Found duplicate nets connected to logically equivalent pins. "
|
"Found duplicate nets connected to logically equivalent pins. "
|
||||||
"Remapping intra lb net %d (atom net %zu '%s') from common sink "
|
"Remapping intra lb net %d (atom net %zu '%s') from common sink "
|
||||||
"pb_route %d to fixed pin pb_route %d\n",
|
"pb_route %d to fixed pin pb_route %d\n",
|
||||||
ilb_net, size_t(lb_nets_[ilb_net].atom_net_id), atom_ctx.nlist.net_name(lb_nets_[ilb_net].atom_net_id).c_str(),
|
ilb_net, size_t(lb_nets_[NetId(ilb_net)].atom_net_id), atom_ctx.nlist.net_name(lb_nets_[NetId(ilb_net)].atom_net_id).c_str(),
|
||||||
kv.first, size_t(pin_index));
|
kv.first, size_t(pin_index));
|
||||||
|
|
||||||
VTR_ASSERT(1 == lb_rr_graph.node_out_edges(pin_index, &(pb_graph_pin->parent_node->pb_type->modes[0])).size());
|
VTR_ASSERT(1 == lb_rr_graph.node_out_edges(pin_index, &(pb_graph_pin->parent_node->pb_type->modes[0])).size());
|
||||||
LbRRNodeId sink_index = lb_rr_graph.edge_sink_node(lb_rr_graph.node_out_edges(pin_index, &(pb_graph_pin->parent_node->pb_type->modes[0]))[0]);
|
LbRRNodeId sink_index = lb_rr_graph.edge_sink_node(lb_rr_graph.node_out_edges(pin_index, &(pb_graph_pin->parent_node->pb_type->modes[0]))[0]);
|
||||||
VTR_ASSERT(LB_SINK == lb_rr_graph.node_type(sink_index));
|
VTR_ASSERT(LB_SINK == lb_rr_graph.node_type(sink_index));
|
||||||
VTR_ASSERT_MSG(sink_index == lb_nets_[ilb_net].terminals[iterm], "Remapped pin must be connected to original sink");
|
VTR_ASSERT_MSG(sink_index == lb_nets_[NetId(ilb_net)].terminals[iterm], "Remapped pin must be connected to original sink");
|
||||||
|
|
||||||
//Change the target
|
//Change the target
|
||||||
lb_nets_[ilb_net].terminals[iterm] = pin_index;
|
lb_nets_[NetId(ilb_net)].terminals[iterm] = pin_index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -343,7 +343,7 @@ void LbRouter::commit_remove_rt(const LbRRGraph& lb_rr_graph,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
incr = -1;
|
incr = -1;
|
||||||
explored_node_tb_[inode].inet = OPEN;
|
explored_node_tb_[inode].inet = NetId::INVALID();
|
||||||
}
|
}
|
||||||
|
|
||||||
routing_status_[inode].occ += incr;
|
routing_status_[inode].occ += incr;
|
||||||
|
@ -397,7 +397,7 @@ bool LbRouter::is_skip_route_net(const LbRRGraph& lb_rr_graph,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LbRouter::add_to_rt(t_trace* rt, const LbRRNodeId& node_index, const int& irt_net) {
|
bool LbRouter::add_to_rt(t_trace* rt, const LbRRNodeId& node_index, const NetId& irt_net) {
|
||||||
std::vector<LbRRNodeId> trace_forward;
|
std::vector<LbRRNodeId> trace_forward;
|
||||||
t_trace* link_node;
|
t_trace* link_node;
|
||||||
t_trace curr_node;
|
t_trace curr_node;
|
||||||
|
@ -430,7 +430,7 @@ bool LbRouter::add_to_rt(t_trace* rt, const LbRRNodeId& node_index, const int& i
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LbRouter::add_source_to_rt(const int& inet) {
|
void LbRouter::add_source_to_rt(const NetId& inet) {
|
||||||
/* TODO: Validate net id */
|
/* TODO: Validate net id */
|
||||||
VTR_ASSERT(nullptr == lb_nets_[inet].rt_tree);
|
VTR_ASSERT(nullptr == lb_nets_[inet].rt_tree);
|
||||||
lb_nets_[inet].rt_tree = new t_trace;
|
lb_nets_[inet].rt_tree = new t_trace;
|
||||||
|
@ -439,7 +439,7 @@ void LbRouter::add_source_to_rt(const int& inet) {
|
||||||
|
|
||||||
void LbRouter::expand_rt_rec(t_trace* rt,
|
void LbRouter::expand_rt_rec(t_trace* rt,
|
||||||
const LbRRNodeId& prev_index,
|
const LbRRNodeId& prev_index,
|
||||||
const int& irt_net,
|
const NetId& irt_net,
|
||||||
const int& explore_id_index) {
|
const int& explore_id_index) {
|
||||||
t_expansion_node enode;
|
t_expansion_node enode;
|
||||||
|
|
||||||
|
@ -459,8 +459,8 @@ void LbRouter::expand_rt_rec(t_trace* rt,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LbRouter::expand_rt(const int& inet,
|
void LbRouter::expand_rt(const NetId& inet,
|
||||||
const int& irt_net) {
|
const NetId& irt_net) {
|
||||||
VTR_ASSERT(pq_.empty());
|
VTR_ASSERT(pq_.empty());
|
||||||
|
|
||||||
expand_rt_rec(lb_nets_[inet].rt_tree, LbRRNodeId::INVALID(), irt_net, explore_id_index_);
|
expand_rt_rec(lb_nets_[inet].rt_tree, LbRRNodeId::INVALID(), irt_net, explore_id_index_);
|
||||||
|
@ -651,7 +651,7 @@ void LbRouter::reset_explored_node_tb() {
|
||||||
for (t_explored_node_stats& explored_node : explored_node_tb_) {
|
for (t_explored_node_stats& explored_node : explored_node_tb_) {
|
||||||
explored_node.prev_index = LbRRNodeId::INVALID();
|
explored_node.prev_index = LbRRNodeId::INVALID();
|
||||||
explored_node.explored_id = OPEN;
|
explored_node.explored_id = OPEN;
|
||||||
explored_node.inet = OPEN;
|
explored_node.inet = NetId::INVALID();
|
||||||
explored_node.enqueue_id = OPEN;
|
explored_node.enqueue_id = OPEN;
|
||||||
explored_node.enqueue_cost = 0;
|
explored_node.enqueue_cost = 0;
|
||||||
}
|
}
|
||||||
|
@ -659,8 +659,8 @@ void LbRouter::reset_explored_node_tb() {
|
||||||
|
|
||||||
void LbRouter::reset_net_rt() {
|
void LbRouter::reset_net_rt() {
|
||||||
for (unsigned int inet = 0; inet < lb_nets_.size(); inet++) {
|
for (unsigned int inet = 0; inet < lb_nets_.size(); inet++) {
|
||||||
free_net_rt(lb_nets_[inet].rt_tree);
|
free_net_rt(lb_nets_[NetId(inet)].rt_tree);
|
||||||
lb_nets_[inet].rt_tree = nullptr;
|
lb_nets_[NetId(inet)].rt_tree = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -674,7 +674,7 @@ void LbRouter::reset_routing_status() {
|
||||||
void LbRouter::clear_nets() {
|
void LbRouter::clear_nets() {
|
||||||
reset_net_rt();
|
reset_net_rt();
|
||||||
for (unsigned int i = 0; i < lb_nets_.size(); i++) {
|
for (unsigned int i = 0; i < lb_nets_.size(); i++) {
|
||||||
lb_nets_[i].terminals.clear();
|
lb_nets_[NetId(i)].terminals.clear();
|
||||||
}
|
}
|
||||||
lb_nets_.clear();
|
lb_nets_.clear();
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "vtr_vector.h"
|
#include "vtr_vector.h"
|
||||||
|
#include "vtr_strong_id.h"
|
||||||
|
|
||||||
#include "physical_types.h"
|
#include "physical_types.h"
|
||||||
#include "vpr_context.h"
|
#include "vpr_context.h"
|
||||||
|
@ -23,6 +24,9 @@
|
||||||
namespace openfpga {
|
namespace openfpga {
|
||||||
|
|
||||||
class LbRouter {
|
class LbRouter {
|
||||||
|
public: /* Strong ids */
|
||||||
|
struct net_id_tag;
|
||||||
|
typedef vtr::StrongId<net_id_tag> NetId;
|
||||||
public: /* Intra-Logic Block Routing Data Structures (by instance) */
|
public: /* Intra-Logic Block Routing Data Structures (by instance) */
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* A routing traceback data structure, provides a logic cluster_ctx.blocks
|
* A routing traceback data structure, provides a logic cluster_ctx.blocks
|
||||||
|
@ -123,7 +127,7 @@ class LbRouter {
|
||||||
struct t_explored_node_stats {
|
struct t_explored_node_stats {
|
||||||
LbRRNodeId prev_index; /* Prevous node that drives this one */
|
LbRRNodeId prev_index; /* Prevous node that drives this one */
|
||||||
int explored_id; /* ID used to determine if this node has been explored */
|
int explored_id; /* ID used to determine if this node has been explored */
|
||||||
int inet; /* net index of route tree */
|
NetId inet; /* net index of route tree */
|
||||||
int enqueue_id; /* ID used ot determine if this node has been pushed on exploration priority queue */
|
int enqueue_id; /* ID used ot determine if this node has been pushed on exploration priority queue */
|
||||||
float enqueue_cost; /* cost of node pused on exploration priority queue */
|
float enqueue_cost; /* cost of node pused on exploration priority queue */
|
||||||
|
|
||||||
|
@ -131,7 +135,7 @@ class LbRouter {
|
||||||
prev_index = LbRRNodeId::INVALID();
|
prev_index = LbRRNodeId::INVALID();
|
||||||
explored_id = OPEN;
|
explored_id = OPEN;
|
||||||
enqueue_id = OPEN;
|
enqueue_id = OPEN;
|
||||||
inet = OPEN;
|
inet = NetId::INVALID();
|
||||||
enqueue_cost = 0;
|
enqueue_cost = 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -237,14 +241,14 @@ class LbRouter {
|
||||||
const e_commit_remove& op,
|
const e_commit_remove& op,
|
||||||
std::unordered_map<const t_pb_graph_node*, const t_mode*>& mode_map);
|
std::unordered_map<const t_pb_graph_node*, const t_mode*>& mode_map);
|
||||||
bool is_skip_route_net(const LbRRGraph& lb_rr_graph, t_trace* rt);
|
bool is_skip_route_net(const LbRRGraph& lb_rr_graph, t_trace* rt);
|
||||||
bool add_to_rt(t_trace* rt, const LbRRNodeId& node_index, const int& irt_net);
|
bool add_to_rt(t_trace* rt, const LbRRNodeId& node_index, const NetId& irt_net);
|
||||||
void add_source_to_rt(const int& inet);
|
void add_source_to_rt(const NetId& inet);
|
||||||
void expand_rt_rec(t_trace* rt,
|
void expand_rt_rec(t_trace* rt,
|
||||||
const LbRRNodeId& prev_index,
|
const LbRRNodeId& prev_index,
|
||||||
const int& irt_net,
|
const NetId& irt_net,
|
||||||
const int& explore_id_index);
|
const int& explore_id_index);
|
||||||
void expand_rt(const int& inet,
|
void expand_rt(const NetId& inet,
|
||||||
const int& irt_net);
|
const NetId& irt_net);
|
||||||
void expand_edges(const LbRRGraph& lb_rr_graph,
|
void expand_edges(const LbRRGraph& lb_rr_graph,
|
||||||
t_mode* mode,
|
t_mode* mode,
|
||||||
const LbRRNodeId& cur_inode,
|
const LbRRNodeId& cur_inode,
|
||||||
|
@ -282,12 +286,7 @@ class LbRouter {
|
||||||
|
|
||||||
private : /* Stores all data needed by intra-logic cluster_ctx.blocks router */
|
private : /* Stores all data needed by intra-logic cluster_ctx.blocks router */
|
||||||
/* Logical Netlist Info */
|
/* Logical Netlist Info */
|
||||||
std::vector<t_net> lb_nets_; /* Pointer to vector of intra logic cluster_ctx.blocks nets and their connections */
|
vtr::vector<NetId, t_net> lb_nets_; /* Pointer to vector of intra logic cluster_ctx.blocks nets and their connections */
|
||||||
|
|
||||||
/* Saved nets */
|
|
||||||
std::vector<t_net> saved_lb_nets_; /* Save vector of intra logic cluster_ctx.blocks nets and their connections */
|
|
||||||
|
|
||||||
std::map<AtomBlockId, bool> atoms_added_; /* map that records which atoms are added to cluster router */
|
|
||||||
|
|
||||||
/* Logical-to-physical mapping info */
|
/* Logical-to-physical mapping info */
|
||||||
vtr::vector<LbRRNodeId, t_routing_status> routing_status_; /* [0..lb_type_graph->size()-1] Stats for each logic cluster_ctx.blocks rr node instance */
|
vtr::vector<LbRRNodeId, t_routing_status> routing_status_; /* [0..lb_type_graph->size()-1] Stats for each logic cluster_ctx.blocks rr node instance */
|
||||||
|
|
Loading…
Reference in New Issue