[core] refactor codes
This commit is contained in:
parent
7892c2340c
commit
e75fd57af2
|
@ -79,31 +79,15 @@ static int build_clock_tree_net_map(
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
* Route a clock tree on an existing routing resource graph
|
* Route a selected clock spine in a staight line
|
||||||
* The strategy is to route spine one by one
|
|
||||||
* - route the spine from the starting point to the ending point
|
* - route the spine from the starting point to the ending point
|
||||||
* - route the spine-to-spine switching points
|
|
||||||
* - route the spine-to-IPIN connections (only for the last level)
|
|
||||||
*******************************************************************/
|
*******************************************************************/
|
||||||
static int route_clock_tree_rr_graph(
|
static int route_straight_spines(
|
||||||
VprRoutingAnnotation& vpr_routing_annotation, const RRGraphView& rr_graph,
|
VprRoutingAnnotation& vpr_routing_annotation, const RRGraphView& rr_graph,
|
||||||
const RRClockSpatialLookup& clk_rr_lookup,
|
const RRClockSpatialLookup& clk_rr_lookup,
|
||||||
const vtr::vector<RRNodeId, ClusterNetId>& rr_node_gnets,
|
|
||||||
const std::map<ClockTreePinId, ClusterNetId>& tree2clk_pin_map,
|
|
||||||
const ClockNetwork& clk_ntwk, const ClockTreeId& clk_tree,
|
const ClockNetwork& clk_ntwk, const ClockTreeId& clk_tree,
|
||||||
const bool& disable_unused_trees,
|
const ClockSpineId& ispine, const ClockTreePinId& ipin,
|
||||||
const bool& verbose) {
|
const bool& verbose) {
|
||||||
for (auto ispine : clk_ntwk.spines(clk_tree)) {
|
|
||||||
VTR_LOGV(verbose, "Routing spine '%s'...\n",
|
|
||||||
clk_ntwk.spine_name(ispine).c_str());
|
|
||||||
for (auto ipin : clk_ntwk.pins(clk_tree)) {
|
|
||||||
/* Do not route unused clock spines */
|
|
||||||
if (disable_unused_trees && tree2clk_pin_map.find(ipin) == tree2clk_pin_map.end()) {
|
|
||||||
VTR_LOGV(verbose, "Skip routing backbone of unused spine '%s'...\n",
|
|
||||||
clk_ntwk.spine_name(ispine).c_str());
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
/* Route the spine from starting point to ending point */
|
|
||||||
std::vector<vtr::Point<int>> spine_coords =
|
std::vector<vtr::Point<int>> spine_coords =
|
||||||
clk_ntwk.spine_coordinates(ispine);
|
clk_ntwk.spine_coordinates(ispine);
|
||||||
VTR_LOGV(verbose, "Routing backbone of spine '%s'...\n",
|
VTR_LOGV(verbose, "Routing backbone of spine '%s'...\n",
|
||||||
|
@ -126,7 +110,22 @@ static int route_clock_tree_rr_graph(
|
||||||
vpr_routing_annotation.set_rr_node_prev_node(rr_graph, des_node,
|
vpr_routing_annotation.set_rr_node_prev_node(rr_graph, des_node,
|
||||||
src_node);
|
src_node);
|
||||||
}
|
}
|
||||||
/* Route the spine-to-spine switching points */
|
return CMD_EXEC_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/********************************************************************
|
||||||
|
* Route a switching points between spines
|
||||||
|
* - connect between two routing tracks (left or right turns)
|
||||||
|
* - connect internal driver to routing track
|
||||||
|
*******************************************************************/
|
||||||
|
static int route_spine_switch_points(
|
||||||
|
VprRoutingAnnotation& vpr_routing_annotation, const RRGraphView& rr_graph,
|
||||||
|
const RRClockSpatialLookup& clk_rr_lookup,
|
||||||
|
const vtr::vector<RRNodeId, ClusterNetId>& rr_node_gnets,
|
||||||
|
const std::map<ClockTreePinId, ClusterNetId>& tree2clk_pin_map,
|
||||||
|
const ClockNetwork& clk_ntwk, const ClockTreeId& clk_tree,
|
||||||
|
const ClockSpineId& ispine, const ClockTreePinId& ipin,
|
||||||
|
const bool& verbose) {
|
||||||
VTR_LOGV(verbose, "Routing switch points of spine '%s'...\n",
|
VTR_LOGV(verbose, "Routing switch points of spine '%s'...\n",
|
||||||
clk_ntwk.spine_name(ispine).c_str());
|
clk_ntwk.spine_name(ispine).c_str());
|
||||||
for (ClockSwitchPointId switch_point_id :
|
for (ClockSwitchPointId switch_point_id :
|
||||||
|
@ -199,6 +198,24 @@ static int route_clock_tree_rr_graph(
|
||||||
tree2clk_pin_map.at(ipin));
|
tree2clk_pin_map.at(ipin));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return CMD_EXEC_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/********************************************************************
|
||||||
|
* Route a spine to its tap points
|
||||||
|
* - Only connect to tap points which are mapped by a global net
|
||||||
|
*******************************************************************/
|
||||||
|
static int route_spine_taps(
|
||||||
|
VprRoutingAnnotation& vpr_routing_annotation, const RRGraphView& rr_graph,
|
||||||
|
const RRClockSpatialLookup& clk_rr_lookup,
|
||||||
|
const vtr::vector<RRNodeId, ClusterNetId>& rr_node_gnets,
|
||||||
|
const std::map<ClockTreePinId, ClusterNetId>& tree2clk_pin_map,
|
||||||
|
const ClockNetwork& clk_ntwk, const ClockTreeId& clk_tree,
|
||||||
|
const ClockSpineId& ispine, const ClockTreePinId& ipin,
|
||||||
|
const bool& verbose) {
|
||||||
|
std::vector<vtr::Point<int>> spine_coords =
|
||||||
|
clk_ntwk.spine_coordinates(ispine);
|
||||||
/* Route the spine-to-IPIN connections (only for the last level) */
|
/* Route the spine-to-IPIN connections (only for the last level) */
|
||||||
if (clk_ntwk.is_last_level(ispine)) {
|
if (clk_ntwk.is_last_level(ispine)) {
|
||||||
VTR_LOGV(verbose, "Routing clock taps of spine '%s'...\n",
|
VTR_LOGV(verbose, "Routing clock taps of spine '%s'...\n",
|
||||||
|
@ -252,6 +269,49 @@ static int route_clock_tree_rr_graph(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return CMD_EXEC_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/********************************************************************
|
||||||
|
* Route a clock tree on an existing routing resource graph
|
||||||
|
* The strategy is to route spine one by one
|
||||||
|
* - route the spine from the starting point to the ending point
|
||||||
|
* - route the spine-to-spine switching points
|
||||||
|
* - route the spine-to-IPIN connections (only for the last level)
|
||||||
|
*******************************************************************/
|
||||||
|
static int route_clock_tree_rr_graph(
|
||||||
|
VprRoutingAnnotation& vpr_routing_annotation, const RRGraphView& rr_graph,
|
||||||
|
const RRClockSpatialLookup& clk_rr_lookup,
|
||||||
|
const vtr::vector<RRNodeId, ClusterNetId>& rr_node_gnets,
|
||||||
|
const std::map<ClockTreePinId, ClusterNetId>& tree2clk_pin_map,
|
||||||
|
const ClockNetwork& clk_ntwk, const ClockTreeId& clk_tree,
|
||||||
|
const bool& disable_unused_trees,
|
||||||
|
const bool& verbose) {
|
||||||
|
for (auto ispine : clk_ntwk.spines(clk_tree)) {
|
||||||
|
VTR_LOGV(verbose, "Routing spine '%s'...\n",
|
||||||
|
clk_ntwk.spine_name(ispine).c_str());
|
||||||
|
for (auto ipin : clk_ntwk.pins(clk_tree)) {
|
||||||
|
/* Do not route unused clock spines */
|
||||||
|
if (disable_unused_trees && tree2clk_pin_map.find(ipin) == tree2clk_pin_map.end()) {
|
||||||
|
VTR_LOGV(verbose, "Skip routing backbone of unused spine '%s'...\n",
|
||||||
|
clk_ntwk.spine_name(ispine).c_str());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
/* Route the spine from starting point to ending point */
|
||||||
|
std::vector<vtr::Point<int>> spine_coords =
|
||||||
|
clk_ntwk.spine_coordinates(ispine);
|
||||||
|
if (CMD_EXEC_SUCCESS != route_straight_spines(vpr_routing_annotation, rr_graph, clk_rr_lookup, clk_ntwk, clk_tree, ispine, ipin, verbose)) {
|
||||||
|
return CMD_EXEC_FATAL_ERROR;
|
||||||
|
}
|
||||||
|
/* Route the opin/spine-to-spine switching points */
|
||||||
|
if (CMD_EXEC_SUCCESS != route_spine_switch_points(vpr_routing_annotation, rr_graph, clk_rr_lookup, rr_node_gnets, tree2clk_pin_map, clk_ntwk, clk_tree, ispine, ipin, verbose)) {
|
||||||
|
return CMD_EXEC_FATAL_ERROR;
|
||||||
|
}
|
||||||
|
/* Route the spine-to-IPIN connections (only for the last level) */
|
||||||
|
if (CMD_EXEC_SUCCESS != route_spine_taps(vpr_routing_annotation, rr_graph, clk_rr_lookup, rr_node_gnets, tree2clk_pin_map, clk_ntwk, clk_tree, ispine, ipin, verbose)) {
|
||||||
|
return CMD_EXEC_FATAL_ERROR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return CMD_EXEC_SUCCESS;
|
return CMD_EXEC_SUCCESS;
|
||||||
|
|
Loading…
Reference in New Issue