From c58035dbd46637b66a9d3562eb8d17a352a0a3f8 Mon Sep 17 00:00:00 2001 From: tangxifan Date: Fri, 14 Jul 2023 11:01:04 -0700 Subject: [PATCH] [core] start developing option --group_tile for build_fabric --- .../src/base/openfpga_build_fabric_template.h | 19 +++++++++++++++++++ .../base/openfpga_setup_command_template.h | 5 +++++ 2 files changed, 24 insertions(+) diff --git a/openfpga/src/base/openfpga_build_fabric_template.h b/openfpga/src/base/openfpga_build_fabric_template.h index 2e5578c01..dae619276 100644 --- a/openfpga/src/base/openfpga_build_fabric_template.h +++ b/openfpga/src/base/openfpga_build_fabric_template.h @@ -17,6 +17,7 @@ #include "globals.h" #include "openfpga_naming.h" #include "read_xml_fabric_key.h" +#include "read_xml_tile_config.h" #include "read_xml_io_name_map.h" #include "vtr_log.h" #include "vtr_time.h" @@ -98,6 +99,7 @@ int build_fabric_template(T& openfpga_ctx, const Command& cmd, cmd.option("generate_random_fabric_key"); CommandOptionId opt_write_fabric_key = cmd.option("write_fabric_key"); CommandOptionId opt_load_fabric_key = cmd.option("load_fabric_key"); + CommandOptionId opt_group_tile = cmd.option("group_tile"); CommandOptionId opt_verbose = cmd.option("verbose"); if (true == cmd_context.option_enable(cmd, opt_compress_routing)) { @@ -125,6 +127,23 @@ int build_fabric_template(T& openfpga_ctx, const Command& cmd, VTR_LOG("\n"); + /* Build tile-level information: + * - This feature only supports when compress routing is enabled + * - Read the tile organization configuration file + * - Build tile info + */ + TileConfig tile_config; + if (cmd_context.option_enable(cmd, opt_group_tile)) { + if (!cmd_context.option_enable(cmd, opt_compress_routing)) { + VTR_LOG_ERROR("Group tile is applicable only when compress routing is enabled!\n"); + return CMD_EXEC_FATAL_ERROR; + } + curr_status = read_xml_tile_config(cmd_context.option_value(cmd, opt_group_file).c_str(), tile_config); + if (CMD_EXEC_SUCCESS != curr_status) { + return CMD_EXEC_FATAL_ERROR; + } + } + curr_status = build_device_module_graph( openfpga_ctx.mutable_module_graph(), openfpga_ctx.mutable_decoder_lib(), openfpga_ctx.mutable_blwl_shift_register_banks(), diff --git a/openfpga/src/base/openfpga_setup_command_template.h b/openfpga/src/base/openfpga_setup_command_template.h index 403372c4e..9267531ad 100644 --- a/openfpga/src/base/openfpga_setup_command_template.h +++ b/openfpga/src/base/openfpga_setup_command_template.h @@ -405,6 +405,11 @@ ShellCommandId add_build_fabric_command_template( "write_fabric_key", false, "output current fabric key to a file"); shell_cmd.set_option_require_value(opt_write_fkey, openfpga::OPT_STRING); + /* Add an option '--group_tile' */ + CommandOptionId opt_group_tile = shell_cmd.add_option( + "group_tile", false, "group programmable blocks and routing blocks into tiles. This helps to reduce the number of blocks at top-level"); + shell_cmd.set_option_require_value(opt_group_tile, openfpga::OPT_STRING); + /* Add an option '--generate_random_fabric_key' */ shell_cmd.add_option("generate_random_fabric_key", false, "Create a random fabric key which will shuffle the "