Skip to content

Commit 1f929ea

Browse files
committed
[vpr][route][tileable] replace VTR_LOG to VTR_LOG_DEBUG & fix c-style code
1 parent f324567 commit 1f929ea

File tree

1 file changed

+63
-69
lines changed
  • vpr/src/route/rr_graph_generation/tileable_rr_graph

1 file changed

+63
-69
lines changed

vpr/src/route/rr_graph_generation/tileable_rr_graph/rr_gsb.cpp

Lines changed: 63 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
/* Headers from vtrutil library */
55
#include "vtr_log.h"
66
#include "vtr_assert.h"
7+
#include "vpr_error.h"
78

89
#include "tileable_rr_graph_utils.h"
910
#include "side_manager.h"
@@ -98,8 +99,7 @@ std::vector<enum e_side> RRGSB::get_cb_ipin_sides(const e_rr_type& cb_type) cons
9899
ipin_sides.push_back(LEFT);
99100
break;
100101
default:
101-
VTR_LOG("Invalid type of connection block!\n");
102-
exit(1);
102+
VPR_FATAL_ERROR(VPR_ERROR_ROUTE, "Invalid type of connection block!\n");
103103
}
104104

105105
return ipin_sides;
@@ -123,8 +123,7 @@ std::vector<enum e_side> RRGSB::get_cb_opin_sides(const e_rr_type& cb_type) cons
123123
opin_sides.push_back(LEFT);
124124
break;
125125
default:
126-
VTR_LOG("Invalid type of connection block!\n");
127-
exit(1);
126+
VPR_FATAL_ERROR(VPR_ERROR_ROUTE, "Invalid type of connection block!\n");
128127
}
129128

130129
return opin_sides;
@@ -381,8 +380,7 @@ int RRGSB::get_node_index(const RRGraphView& rr_graph,
381380
}
382381
break;
383382
default:
384-
VTR_LOG("Invalid cur_rr_node type! Should be [CHANX|CHANY|IPIN|OPIN]\n");
385-
exit(1);
383+
VPR_FATAL_ERROR(VPR_ERROR_ROUTE, "Invalid cur_rr_node type! Should be [CHANX|CHANY|IPIN|OPIN]\n");
386384
}
387385

388386
VTR_ASSERT((0 == cnt) || (1 == cnt));
@@ -675,8 +673,7 @@ vtr::Point<size_t> RRGSB::get_cb_coordinate(const e_rr_type& cb_type) const {
675673
case e_rr_type::CHANY:
676674
return coordinate_;
677675
default:
678-
VTR_LOG("Invalid type of connection block!\n");
679-
exit(1);
676+
VPR_FATAL_ERROR(VPR_ERROR_ROUTE, "Invalid type of connection block!\n");
680677
}
681678
}
682679

@@ -688,8 +685,7 @@ e_side RRGSB::get_cb_chan_side(const e_rr_type& cb_type) const {
688685
case e_rr_type::CHANY:
689686
return BOTTOM;
690687
default:
691-
VTR_LOG("Invalid type of connection block!\n");
692-
exit(1);
688+
VPR_FATAL_ERROR(VPR_ERROR_ROUTE, "Invalid type of connection block!\n");
693689
}
694690
}
695691

@@ -705,8 +701,7 @@ e_side RRGSB::get_cb_chan_side(const e_side& ipin_side) const {
705701
case LEFT:
706702
return BOTTOM;
707703
default:
708-
VTR_LOG("Invalid type of ipin_side!\n");
709-
exit(1);
704+
VPR_FATAL_ERROR(VPR_ERROR_ROUTE, "Invalid type of ipin_side!\n");
710705
}
711706
}
712707

@@ -735,8 +730,7 @@ vtr::Point<size_t> RRGSB::get_side_block_coordinate(const e_side& side) const {
735730
/* 4. Channel X [x][y] inputs */
736731
break;
737732
default:
738-
VTR_LOG(" Invalid side!\n");
739-
exit(1);
733+
VPR_FATAL_ERROR(VPR_ERROR_ROUTE, " Invalid side!\n");
740734
}
741735

742736
return ret;
@@ -752,35 +746,35 @@ vtr::Point<size_t> RRGSB::get_grid_coordinate() const {
752746
/* get a copy from a source */
753747
void RRGSB::set(const RRGSB& src) {
754748
/* Copy coordinate */
755-
this->set_coordinate(src.get_sb_coordinate().x(), src.get_sb_coordinate().y());
749+
set_coordinate(src.get_sb_coordinate().x(), src.get_sb_coordinate().y());
756750

757751
/* Initialize sides */
758-
this->init_num_sides(src.get_num_sides());
752+
init_num_sides(src.get_num_sides());
759753

760754
/* Copy vectors */
761755
for (size_t side = 0; side < src.get_num_sides(); ++side) {
762756
SideManager side_manager(side);
763757
/* Copy chan_nodes */
764758
/* skip if there is no channel width */
765759
if (0 < src.get_chan_width(side_manager.get_side())) {
766-
this->chan_node_[side_manager.get_side()].set(src.chan_node_[side_manager.get_side()]);
760+
chan_node_[side_manager.get_side()].set(src.chan_node_[side_manager.get_side()]);
767761
/* Copy chan_node_direction_*/
768-
this->chan_node_direction_[side_manager.get_side()].clear();
762+
chan_node_direction_[side_manager.get_side()].clear();
769763
for (size_t inode = 0; inode < src.get_chan_width(side_manager.get_side()); ++inode) {
770-
this->chan_node_direction_[side_manager.get_side()].push_back(src.get_chan_node_direction(side_manager.get_side(), inode));
764+
chan_node_direction_[side_manager.get_side()].push_back(src.get_chan_node_direction(side_manager.get_side(), inode));
771765
}
772766
}
773767

774768
/* Copy opin_node and opin_node_grid_side_ */
775-
this->opin_node_[side_manager.get_side()].clear();
769+
opin_node_[side_manager.get_side()].clear();
776770
for (size_t inode = 0; inode < src.get_num_opin_nodes(side_manager.get_side()); ++inode) {
777-
this->opin_node_[side_manager.get_side()].push_back(src.get_opin_node(side_manager.get_side(), inode));
771+
opin_node_[side_manager.get_side()].push_back(src.get_opin_node(side_manager.get_side(), inode));
778772
}
779773

780774
/* Copy ipin_node and ipin_node_grid_side_ */
781-
this->ipin_node_[side_manager.get_side()].clear();
775+
ipin_node_[side_manager.get_side()].clear();
782776
for (size_t inode = 0; inode < src.get_num_ipin_nodes(side_manager.get_side()); ++inode) {
783-
this->ipin_node_[side_manager.get_side()].push_back(src.get_ipin_node(side_manager.get_side(), inode));
777+
ipin_node_[side_manager.get_side()].push_back(src.get_ipin_node(side_manager.get_side(), inode));
784778
}
785779
}
786780
}
@@ -863,22 +857,22 @@ void RRGSB::sort_chan_node_in_edges(const RRGraphView& rr_graph,
863857

864858
/* Must have valid side and index */
865859
if (NUM_2D_SIDES == side) {
866-
VTR_LOG("GSB[%lu][%lu]:\n", get_x(), get_y());
867-
VTR_LOG("----------------------------------\n");
868-
VTR_LOG("SRC node:\n");
869-
VTR_LOG("Node info: %s\n", rr_graph.node_coordinate_to_string(src_node).c_str());
870-
VTR_LOG("Node ptc: %d\n", rr_graph.node_ptc_num(src_node));
871-
VTR_LOG("Fan-out nodes:\n");
860+
VTR_LOG_DEBUG("GSB[%lu][%lu]:\n", get_x(), get_y());
861+
VTR_LOG_DEBUG("----------------------------------\n");
862+
VTR_LOG_DEBUG("SRC node:\n");
863+
VTR_LOG_DEBUG("Node info: %s\n", rr_graph.node_coordinate_to_string(src_node).c_str());
864+
VTR_LOG_DEBUG("Node ptc: %d\n", rr_graph.node_ptc_num(src_node));
865+
VTR_LOG_DEBUG("Fan-out nodes:\n");
872866
for (const auto& temp_edge : rr_graph.edge_range(src_node)) {
873-
VTR_LOG("\t%s\n", rr_graph.node_coordinate_to_string(rr_graph.edge_sink_node(temp_edge)).c_str());
867+
VTR_LOG_DEBUG("\t%s\n", rr_graph.node_coordinate_to_string(rr_graph.edge_sink_node(temp_edge)).c_str());
874868
}
875-
VTR_LOG("\n----------------------------------\n");
876-
VTR_LOG("Channel node:\n");
877-
VTR_LOG("Node info: %s\n", rr_graph.node_coordinate_to_string(chan_node).c_str());
878-
VTR_LOG("Node ptc: %d\n", rr_graph.node_ptc_num(chan_node));
879-
VTR_LOG("Fan-in nodes:\n");
869+
VTR_LOG_DEBUG("\n----------------------------------\n");
870+
VTR_LOG_DEBUG("Channel node:\n");
871+
VTR_LOG_DEBUG("Node info: %s\n", rr_graph.node_coordinate_to_string(chan_node).c_str());
872+
VTR_LOG_DEBUG("Node ptc: %d\n", rr_graph.node_ptc_num(chan_node));
873+
VTR_LOG_DEBUG("Fan-in nodes:\n");
880874
for (const auto& temp_edge : rr_graph.node_in_edges(chan_node)) {
881-
VTR_LOG("\t%s\n", rr_graph.node_coordinate_to_string(rr_graph.edge_src_node(temp_edge)).c_str());
875+
VTR_LOG_DEBUG("\t%s\n", rr_graph.node_coordinate_to_string(rr_graph.edge_src_node(temp_edge)).c_str());
882876
}
883877
}
884878

@@ -979,22 +973,22 @@ void RRGSB::sort_ipin_node_in_edges(const RRGraphView& rr_graph,
979973

980974
/* Must have valid side and index */
981975
if (OPEN == index) {
982-
VTR_LOG("GSB[%lu][%lu]:\n", get_x(), get_y());
983-
VTR_LOG("----------------------------------\n");
984-
VTR_LOG("SRC node:\n");
985-
VTR_LOG("Node info: %s\n", rr_graph.node_coordinate_to_string(src_node).c_str());
986-
VTR_LOG("Node ptc: %d\n", rr_graph.node_ptc_num(src_node));
987-
VTR_LOG("Fan-out nodes:\n");
976+
VTR_LOG_DEBUG("GSB[%lu][%lu]:\n", get_x(), get_y());
977+
VTR_LOG_DEBUG("----------------------------------\n");
978+
VTR_LOG_DEBUG("SRC node:\n");
979+
VTR_LOG_DEBUG("Node info: %s\n", rr_graph.node_coordinate_to_string(src_node).c_str());
980+
VTR_LOG_DEBUG("Node ptc: %d\n", rr_graph.node_ptc_num(src_node));
981+
VTR_LOG_DEBUG("Fan-out nodes:\n");
988982
for (const auto& temp_edge : rr_graph.edge_range(src_node)) {
989-
VTR_LOG("\t%s\n", rr_graph.node_coordinate_to_string(rr_graph.edge_sink_node(temp_edge)).c_str());
983+
VTR_LOG_DEBUG("\t%s\n", rr_graph.node_coordinate_to_string(rr_graph.edge_sink_node(temp_edge)).c_str());
990984
}
991-
VTR_LOG("\n----------------------------------\n");
992-
VTR_LOG("IPIN node:\n");
993-
VTR_LOG("Node info: %s\n", rr_graph.node_coordinate_to_string(ipin_node).c_str());
994-
VTR_LOG("Node ptc: %d\n", rr_graph.node_ptc_num(ipin_node));
995-
VTR_LOG("Fan-in nodes:\n");
985+
VTR_LOG_DEBUG("\n----------------------------------\n");
986+
VTR_LOG_DEBUG("IPIN node:\n");
987+
VTR_LOG_DEBUG("Node info: %s\n", rr_graph.node_coordinate_to_string(ipin_node).c_str());
988+
VTR_LOG_DEBUG("Node ptc: %d\n", rr_graph.node_ptc_num(ipin_node));
989+
VTR_LOG_DEBUG("Fan-in nodes:\n");
996990
for (const auto& temp_edge : rr_graph.node_in_edges(ipin_node)) {
997-
VTR_LOG("\t%s\n", rr_graph.node_coordinate_to_string(rr_graph.edge_src_node(temp_edge)).c_str());
991+
VTR_LOG_DEBUG("\t%s\n", rr_graph.node_coordinate_to_string(rr_graph.edge_src_node(temp_edge)).c_str());
998992
}
999993
}
1000994

@@ -1020,22 +1014,22 @@ void RRGSB::sort_ipin_node_in_edges(const RRGraphView& rr_graph,
10201014
VTR_ASSERT((-1 != cb_opin_index) && (NUM_2D_SIDES != cb_opin_side));
10211015
/* Must have valid side and index */
10221016
if (OPEN == cb_opin_index || NUM_2D_SIDES == cb_opin_side) {
1023-
VTR_LOG("GSB[%lu][%lu]:\n", get_x(), get_y());
1024-
VTR_LOG("----------------------------------\n");
1025-
VTR_LOG("SRC node:\n");
1026-
VTR_LOG("Node info: %s\n", rr_graph.node_coordinate_to_string(src_node).c_str());
1027-
VTR_LOG("Node ptc: %d\n", rr_graph.node_ptc_num(src_node));
1028-
VTR_LOG("Fan-out nodes:\n");
1017+
VTR_LOG_DEBUG("GSB[%lu][%lu]:\n", get_x(), get_y());
1018+
VTR_LOG_DEBUG("----------------------------------\n");
1019+
VTR_LOG_DEBUG("SRC node:\n");
1020+
VTR_LOG_DEBUG("Node info: %s\n", rr_graph.node_coordinate_to_string(src_node).c_str());
1021+
VTR_LOG_DEBUG("Node ptc: %d\n", rr_graph.node_ptc_num(src_node));
1022+
VTR_LOG_DEBUG("Fan-out nodes:\n");
10291023
for (const auto& temp_edge : rr_graph.edge_range(src_node)) {
1030-
VTR_LOG("\t%s\n", rr_graph.node_coordinate_to_string(rr_graph.edge_sink_node(temp_edge)).c_str());
1024+
VTR_LOG_DEBUG("\t%s\n", rr_graph.node_coordinate_to_string(rr_graph.edge_sink_node(temp_edge)).c_str());
10311025
}
1032-
VTR_LOG("\n----------------------------------\n");
1033-
VTR_LOG("IPIN node:\n");
1034-
VTR_LOG("Node info: %s\n", rr_graph.node_coordinate_to_string(ipin_node).c_str());
1035-
VTR_LOG("Node ptc: %d\n", rr_graph.node_ptc_num(ipin_node));
1036-
VTR_LOG("Fan-in nodes:\n");
1026+
VTR_LOG_DEBUG("\n----------------------------------\n");
1027+
VTR_LOG_DEBUG("IPIN node:\n");
1028+
VTR_LOG_DEBUG("Node info: %s\n", rr_graph.node_coordinate_to_string(ipin_node).c_str());
1029+
VTR_LOG_DEBUG("Node ptc: %d\n", rr_graph.node_ptc_num(ipin_node));
1030+
VTR_LOG_DEBUG("Fan-in nodes:\n");
10371031
for (const auto& temp_edge : rr_graph.node_in_edges(ipin_node)) {
1038-
VTR_LOG("\t%s\n", rr_graph.node_coordinate_to_string(rr_graph.edge_src_node(temp_edge)).c_str());
1032+
VTR_LOG_DEBUG("\t%s\n", rr_graph.node_coordinate_to_string(rr_graph.edge_src_node(temp_edge)).c_str());
10391033
}
10401034
}
10411035
from_opin_edge_map[size_t(cb_opin_side)][cb_opin_index] = edge;
@@ -1095,14 +1089,14 @@ void RRGSB::build_cb_opin_nodes(const RRGraphView& rr_graph) {
10951089
get_node_side_and_index(rr_graph, cand_node, IN_PORT, cb_opin_side,
10961090
cb_opin_index);
10971091
if ((-1 == cb_opin_index) || (NUM_2D_SIDES == cb_opin_side)) {
1098-
VTR_LOG("GSB[%lu][%lu]:\n", get_x(), get_y());
1099-
VTR_LOG("----------------------------------\n");
1100-
VTR_LOG("SRC node:\n");
1101-
VTR_LOG("Node info: %s\n", rr_graph.node_coordinate_to_string(cand_node).c_str());
1102-
VTR_LOG("Node ptc: %d\n", rr_graph.node_ptc_num(cand_node));
1103-
VTR_LOG("Fan-out nodes:\n");
1092+
VTR_LOG_DEBUG("GSB[%lu][%lu]:\n", get_x(), get_y());
1093+
VTR_LOG_DEBUG("----------------------------------\n");
1094+
VTR_LOG_DEBUG("SRC node:\n");
1095+
VTR_LOG_DEBUG("Node info: %s\n", rr_graph.node_coordinate_to_string(cand_node).c_str());
1096+
VTR_LOG_DEBUG("Node ptc: %d\n", rr_graph.node_ptc_num(cand_node));
1097+
VTR_LOG_DEBUG("Fan-out nodes:\n");
11041098
for (const auto& temp_edge : rr_graph.edge_range(cand_node)) {
1105-
VTR_LOG("\t%s\n", rr_graph.node_coordinate_to_string(rr_graph.edge_sink_node(temp_edge)).c_str());
1099+
VTR_LOG_DEBUG("\t%s\n", rr_graph.node_coordinate_to_string(rr_graph.edge_sink_node(temp_edge)).c_str());
11061100
}
11071101
}
11081102
VTR_ASSERT((-1 != cb_opin_index) && (NUM_2D_SIDES != cb_opin_side));

0 commit comments

Comments
 (0)