From 088198c8610b676f91e370a0c59ddae2c4bc2f7a Mon Sep 17 00:00:00 2001 From: tangxifan Date: Fri, 13 Nov 2020 10:56:00 -0700 Subject: [PATCH 1/2] [Tool] enhance error checking in fabric key parser --- openfpga/src/fabric/build_top_module.cpp | 1 + openfpga/src/fabric/build_top_module_memory.cpp | 16 ++++++++++++++++ openfpga/src/fabric/build_top_module_memory.h | 2 ++ 3 files changed, 19 insertions(+) diff --git a/openfpga/src/fabric/build_top_module.cpp b/openfpga/src/fabric/build_top_module.cpp index 80d6e768c..5d2d87aaa 100644 --- a/openfpga/src/fabric/build_top_module.cpp +++ b/openfpga/src/fabric/build_top_module.cpp @@ -381,6 +381,7 @@ int build_top_module(ModuleManager& module_manager, } status = load_top_module_memory_modules_from_fabric_key(module_manager, top_module, + circuit_lib, config_protocol, fabric_key); if (CMD_EXEC_FATAL_ERROR == status) { return status; diff --git a/openfpga/src/fabric/build_top_module_memory.cpp b/openfpga/src/fabric/build_top_module_memory.cpp index 91275b3bd..422a73ff2 100644 --- a/openfpga/src/fabric/build_top_module_memory.cpp +++ b/openfpga/src/fabric/build_top_module_memory.cpp @@ -523,6 +523,8 @@ void shuffle_top_module_configurable_children(ModuleManager& module_manager, ********************************************************************/ int load_top_module_memory_modules_from_fabric_key(ModuleManager& module_manager, const ModuleId& top_module, + const CircuitLibrary& circuit_lib, + const ConfigProtocol& config_protocol, const FabricKey& fabric_key) { /* Ensure a clean start */ module_manager.clear_configurable_children(top_module); @@ -574,6 +576,20 @@ int load_top_module_memory_modules_from_fabric_key(ModuleManager& module_manager return CMD_EXEC_FATAL_ERROR; } + /* If the the child has not configuration bits, error out */ + if (0 == find_module_num_config_bits(module_manager, instance_info.first, + circuit_lib, config_protocol.memory_model(), + config_protocol.type())) { + if (!fabric_key.key_alias(key).empty()) { + VTR_LOG_ERROR("Invalid key alias '%s' which has zero configuration bits!\n", + fabric_key.key_alias(key).c_str()); + } else { + VTR_LOG_ERROR("Invalid key name '%s' which has zero configuration bits!\n", + fabric_key.key_name(key).c_str()); + } + return CMD_EXEC_FATAL_ERROR; + } + /* Now we can add the child to configurable children of the top module */ module_manager.add_configurable_child(top_module, instance_info.first, diff --git a/openfpga/src/fabric/build_top_module_memory.h b/openfpga/src/fabric/build_top_module_memory.h index 7e93ca85a..e1d495fd4 100644 --- a/openfpga/src/fabric/build_top_module_memory.h +++ b/openfpga/src/fabric/build_top_module_memory.h @@ -44,6 +44,8 @@ void shuffle_top_module_configurable_children(ModuleManager& module_manager, int load_top_module_memory_modules_from_fabric_key(ModuleManager& module_manager, const ModuleId& top_module, + const CircuitLibrary& circuit_lib, + const ConfigProtocol& config_protocol, const FabricKey& fabric_key); vtr::vector find_top_module_regional_num_config_bit(const ModuleManager& module_manager, From 3f91b8433e9b46e04bf4f62a599106417f78422c Mon Sep 17 00:00:00 2001 From: tangxifan Date: Fri, 13 Nov 2020 15:00:25 -0700 Subject: [PATCH 2/2] [Tool] Change the i/o numbering to the clockwise sequence --- openfpga/src/utils/openfpga_device_grid_utils.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openfpga/src/utils/openfpga_device_grid_utils.cpp b/openfpga/src/utils/openfpga_device_grid_utils.cpp index ee3d5b60c..938e39db0 100644 --- a/openfpga/src/utils/openfpga_device_grid_utils.cpp +++ b/openfpga/src/utils/openfpga_device_grid_utils.cpp @@ -43,12 +43,12 @@ std::map>> generate_perimeter_grid_coordi } /* RIGHT side */ - for (size_t iy = 1; iy < grids.height() - 1; ++iy) { + for (size_t iy = grids.height() - 2; iy > 0; --iy) { io_coordinates[RIGHT].push_back(vtr::Point(grids.width() - 1, iy)); } /* BOTTOM side*/ - for (size_t ix = 1; ix < grids.width() - 1; ++ix) { + for (size_t ix = grids.width() - 2; ix > 0; --ix) { io_coordinates[BOTTOM].push_back(vtr::Point(ix, 0)); }