Skip to content

Commit 1a97732

Browse files
vpr: Replace describe_pb_graph_pin with t_pb_graph_pin::to_string()
1 parent a2d8d43 commit 1a97732

File tree

3 files changed

+7
-17
lines changed

3 files changed

+7
-17
lines changed

libs/libarchfpga/src/physical_types.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ std::string t_pb_graph_node::hierarchical_type_name() const {
194194
* t_pb_graph_pin
195195
*/
196196

197-
std::string t_pb_graph_pin::to_string() const {
197+
std::string t_pb_graph_pin::to_string(const bool full_description) const {
198198
std::string parent_name = this->parent_node->pb_type->name;
199199
std::string parent_index = std::to_string(this->parent_node->placement_index);
200200
std::string port_name = this->port->name;
@@ -203,6 +203,8 @@ std::string t_pb_graph_pin::to_string() const {
203203
std::string pin_string = parent_name + "[" + parent_index + "]";
204204
pin_string += "." + port_name + "[" + pin_index + "]";
205205

206+
if (!full_description) return pin_string;
207+
206208
// Traverse upward through the pb_type hierarchy, constructing
207209
// name that represents the whole hierarchy to reach this pin.
208210
auto parent_parent_node = this->parent_node->parent_pb_graph_node;

libs/libarchfpga/src/physical_types.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1043,7 +1043,8 @@ class t_pb_graph_pin {
10431043
// and the entire sequence of pb_types in the hierarchy from the block
10441044
// of this pin back to the cluster-level (top-level) pb_type in the
10451045
// following format: clb[0]/lab[0]/fle[3]/ble6[0]/lut6[0].in[0]
1046-
std::string to_string() const;
1046+
// if full_description is set to false it will only return lut6[0].in[0]
1047+
std::string to_string(const bool full_description=true) const;
10471048
};
10481049

10491050
/** Describes a pb graph edge

vpr/src/pack/cluster_router.cpp

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ static std::string describe_lb_type_rr_node(int inode,
114114

115115
static std::vector<int> find_congested_rr_nodes(const std::vector<t_lb_type_rr_node>& lb_type_graph,
116116
const t_lb_rr_node_stats* lb_rr_node_stats);
117-
static std::string describe_pb_graph_pin(const t_pb_graph_pin* pb_graph_pin);
118117
static std::vector<int> find_incoming_rr_nodes(int dst_node, const t_lb_router_data* router_data);
119118
static std::string describe_congested_rr_nodes(const std::vector<int>& congested_rr_nodes,
120119
const t_lb_router_data* router_data);
@@ -1373,7 +1372,7 @@ static std::string describe_lb_type_rr_node(int inode,
13731372
const t_pb_graph_pin* pb_graph_pin = rr_node.pb_graph_pin;
13741373

13751374
if (pb_graph_pin) {
1376-
description += "'" + describe_pb_graph_pin(pb_graph_pin) + "'";
1375+
description += "'" + pb_graph_pin->to_string(false) + "'";
13771376
} else if (inode == get_lb_type_rr_graph_ext_source_index(lb_type)) {
13781377
VTR_ASSERT(rr_node.type == LB_SOURCE);
13791378
description = "cluster-external source (LB_SOURCE)";
@@ -1390,7 +1389,7 @@ static std::string describe_lb_type_rr_node(int inode,
13901389
std::vector<int> pin_rrs = find_incoming_rr_nodes(inode, router_data);
13911390
for (int pin_rr_idx : pin_rrs) {
13921391
const t_pb_graph_pin* pin_pb_gpin = (*router_data->lb_type_graph)[pin_rr_idx].pb_graph_pin;
1393-
pin_descriptions.push_back(describe_pb_graph_pin(pin_pb_gpin));
1392+
pin_descriptions.push_back(pin_pb_gpin->to_string());
13941393
}
13951394

13961395
description += vtr::join(pin_descriptions, ", ");
@@ -1426,18 +1425,6 @@ static std::vector<int> find_incoming_rr_nodes(int dst_node, const t_lb_router_d
14261425
return incoming_rr_nodes;
14271426
}
14281427

1429-
// TODO: move this function to be a member function of class pb_graph_pin
1430-
static std::string describe_pb_graph_pin(const t_pb_graph_pin* pb_graph_pin) {
1431-
VTR_ASSERT(pb_graph_pin);
1432-
std::string description;
1433-
description += pb_graph_pin->parent_node->pb_type->name;
1434-
description += "[" + std::to_string(pb_graph_pin->parent_node->placement_index) + "]";
1435-
description += '.';
1436-
description += pb_graph_pin->port->name;
1437-
description += "[" + std::to_string(pb_graph_pin->pin_number) + "]";
1438-
return description;
1439-
}
1440-
14411428
static std::string describe_congested_rr_nodes(const std::vector<int>& congested_rr_nodes,
14421429
const t_lb_router_data* router_data) {
14431430
std::string description;

0 commit comments

Comments
 (0)