[core] now resize rr_node for clock graph is working
This commit is contained in:
parent
81e9187aac
commit
de1e300ec7
|
@ -179,6 +179,22 @@ std::string ClockNetwork::tree_name(const ClockTreeId& tree_id) const {
|
|||
return tree_names_[tree_id];
|
||||
}
|
||||
|
||||
size_t ClockNetwork::max_tree_width() const {
|
||||
size_t max_size = 0;
|
||||
for (auto itree : trees()) {
|
||||
max_size = std::max(tree_width(itree), max_size);
|
||||
}
|
||||
return max_size;
|
||||
}
|
||||
|
||||
size_t ClockNetwork::max_tree_depth() const {
|
||||
size_t max_size = 0;
|
||||
for (auto itree : trees()) {
|
||||
max_size = std::max(tree_depth(itree), max_size);
|
||||
}
|
||||
return max_size;
|
||||
}
|
||||
|
||||
size_t ClockNetwork::tree_width(const ClockTreeId& tree_id) const {
|
||||
VTR_ASSERT(valid_tree_id(tree_id));
|
||||
return tree_widths_[tree_id];
|
||||
|
@ -663,7 +679,6 @@ bool ClockNetwork::update_tree_depth(const ClockTreeId& tree_id) {
|
|||
}
|
||||
|
||||
bool ClockNetwork::update_spine_attributes(const ClockTreeId& tree_id) {
|
||||
size_t depth = 0;
|
||||
for (ClockSpineId spine_id : spines(tree_id)) {
|
||||
spine_track_types_[spine_id] = spine_track_type(spine_id);
|
||||
spine_directions_[spine_id] = spine_direction(spine_id);
|
||||
|
|
|
@ -78,6 +78,8 @@ class ClockNetwork {
|
|||
std::string tree_name(const ClockTreeId& tree_id) const;
|
||||
size_t tree_width(const ClockTreeId& tree_id) const;
|
||||
size_t tree_depth(const ClockTreeId& tree_id) const;
|
||||
size_t max_tree_width() const;
|
||||
size_t max_tree_depth() const;
|
||||
std::vector<ClockSpineId> tree_top_spines(const ClockTreeId& tree_id) const;
|
||||
std::string spine_name(const ClockSpineId& spine_id) const;
|
||||
vtr::Point<int> spine_start_point(const ClockSpineId& spine_id) const;
|
||||
|
|
|
@ -84,6 +84,27 @@ void RRClockSpatialLookup::add_node(RRNodeId node, int x, int y,
|
|||
rr_node_indices_[dir][x][y][size_t(tree)][size_t(lvl)][size_t(pin)] = node;
|
||||
}
|
||||
|
||||
void RRClockSpatialLookup::reserve_nodes(int x, int y,
|
||||
int tree,
|
||||
int lvl,
|
||||
int pin) {
|
||||
for (Direction dir : {Direction::INC, Direction::DEC}) {
|
||||
resize_nodes(x, y, dir);
|
||||
for (int ix = 0; ix < x; ++ix) {
|
||||
for (int iy = 0; iy < y; ++iy) {
|
||||
rr_node_indices_[size_t(dir)][ix][iy].resize(tree);
|
||||
for (int itree = 0; itree < tree; ++itree) {
|
||||
rr_node_indices_[size_t(dir)][ix][iy][itree].resize(lvl);
|
||||
for (int ilvl = 0; ilvl < lvl; ++ilvl) {
|
||||
rr_node_indices_[size_t(dir)][ix][iy][itree][ilvl].resize(pin);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void RRClockSpatialLookup::resize_nodes(int x, int y,
|
||||
const Direction& direction) {
|
||||
/* Expand the fast look-up if the new node is out-of-range
|
||||
|
|
|
@ -85,6 +85,15 @@ class RRClockSpatialLookup {
|
|||
const ClockLevelId& clk_lvl, const ClockTreePinId& clk_pin,
|
||||
const Direction& direction);
|
||||
|
||||
/**
|
||||
* @brief Allocate memory for the lookup with maximum sizes on each dimension
|
||||
* .. note:: Must run before any other API!
|
||||
*/
|
||||
void reserve_nodes(int x, int y,
|
||||
int tree,
|
||||
int lvl,
|
||||
int pin);
|
||||
|
||||
/** @brief Clear all the data inside */
|
||||
void clear();
|
||||
|
||||
|
|
|
@ -150,6 +150,9 @@ static void add_rr_graph_clock_nodes(RRGraphBuilder& rr_graph_builder,
|
|||
const bool& through_channel,
|
||||
const ClockNetwork& clk_ntwk,
|
||||
const bool& verbose) {
|
||||
/* Pre-allocate memory: Must do otherwise data will be messed up! */
|
||||
clk_rr_lookup.reserve_nodes(grids.width(), grids.height(), clk_ntwk.num_trees(), clk_ntwk.max_tree_depth(), clk_ntwk.max_tree_width());
|
||||
|
||||
/* Add X-direction clock nodes */
|
||||
for (size_t iy = 0; iy < grids.height() - 1; ++iy) {
|
||||
for (size_t ix = 1; ix < grids.width() - 1; ++ix) {
|
||||
|
|
Loading…
Reference in New Issue