[core] fixed a bug where clock network size cannot impact global port on top module

This commit is contained in:
tangxifan 2024-06-29 17:35:47 -07:00
parent 5dd0549aed
commit 1fd974d544
3 changed files with 23 additions and 9 deletions

View File

@ -96,6 +96,12 @@ size_t TileAnnotation::global_port_default_value(
return global_port_default_values_[global_port_id];
}
bool TileAnnotation::global_port_thru_dedicated_network(
const TileGlobalPortId& global_port_id) const {
return !global_port_clock_arch_tree_name(global_port_id).empty();
}
std::string TileAnnotation::global_port_clock_arch_tree_name(
const TileGlobalPortId& global_port_id) const {
VTR_ASSERT(valid_global_port_id(global_port_id));

View File

@ -54,6 +54,8 @@ class TileAnnotation {
bool global_port_is_clock(const TileGlobalPortId& global_port_id) const;
bool global_port_is_set(const TileGlobalPortId& global_port_id) const;
bool global_port_is_reset(const TileGlobalPortId& global_port_id) const;
bool global_port_thru_dedicated_network(
const TileGlobalPortId& global_port_id) const;
std::string global_port_clock_arch_tree_name(
const TileGlobalPortId& global_port_id) const;
size_t global_port_default_value(

View File

@ -1242,11 +1242,11 @@ static int build_top_module_global_net_from_clock_arch_tree(
if (clk_ntwk.tree_width(clk_tree) !=
module_manager.module_port(top_module, top_module_port).get_width()) {
VTR_LOG(
"Clock tree '%s' does not have the same width '%lu' as the port '%'s of "
"Clock tree '%s' does not have the same width '%lu' as the port '%s' of "
"FPGA top module",
clk_tree_name.c_str(), clk_ntwk.tree_width(clk_tree),
module_manager.module_port(top_module, top_module_port)
.get_name()
.to_verilog_string()
.c_str());
return CMD_EXEC_FATAL_ERROR;
}
@ -1323,12 +1323,19 @@ int add_top_module_global_ports_from_grid_modules(
BasicPort global_port_to_add;
global_port_to_add.set_name(
tile_annotation.global_port_name(tile_global_port));
/* Dedicated network has their own sizes of port */
if (tile_annotation.global_port_thru_dedicated_network(tile_global_port)) {
std::string clk_tree_name = tile_annotation.global_port_clock_arch_tree_name(tile_global_port);
ClockTreeId clk_tree = clk_ntwk.find_tree(clk_tree_name);
global_port_to_add.set_width(clk_ntwk.tree_width(clk_tree));
} else {
size_t max_port_size = 0;
for (const BasicPort& tile_port :
tile_annotation.global_port_tile_ports(tile_global_port)) {
max_port_size = std::max(tile_port.get_width(), max_port_size);
}
global_port_to_add.set_width(max_port_size);
}
global_ports_to_add.push_back(global_port_to_add);
}
}
@ -1352,8 +1359,7 @@ int add_top_module_global_ports_from_grid_modules(
* - If the net will be directly wired to tiles, the net will drive an input
* of a tile
*/
if (!tile_annotation.global_port_clock_arch_tree_name(tile_global_port)
.empty()) {
if (tile_annotation.global_port_thru_dedicated_network(tile_global_port)) {
status = build_top_module_global_net_from_clock_arch_tree(
module_manager, top_module, top_module_port, rr_graph, device_rr_gsb,
cb_instance_ids, clk_ntwk,