[OpenFPGA Tool] Bug fix in the XML parser for fabric regions

This commit is contained in:
tangxifan 2020-09-27 20:54:58 -06:00
parent 491433fae2
commit 052b8b71c7
2 changed files with 9 additions and 1 deletions

View File

@ -129,7 +129,7 @@ FabricKey read_xml_fabric_key(const char* key_fname) {
if (xml_region.name() != std::string("region")) { if (xml_region.name() != std::string("region")) {
bad_tag(xml_region, loc_data, xml_root, {"region"}); bad_tag(xml_region, loc_data, xml_root, {"region"});
} }
num_keys += std::distance(xml_root.children().begin(), xml_root.children().end()); num_keys += std::distance(xml_region.children().begin(), xml_region.children().end());
} }
fabric_key.reserve_keys(num_keys); fabric_key.reserve_keys(num_keys);

View File

@ -65,6 +65,11 @@ int write_fabric_key_to_xml_file(const ModuleManager& module_manager,
num_keys -= 1; num_keys -= 1;
} }
/* FIXME: create a region for the keys. Later down the road, we will create multiple regions */
fabric_key.reserve_regions(1);
FabricRegionId region = fabric_key.create_region();
fabric_key.reserve_region_keys(region, num_keys);
fabric_key.reserve_keys(num_keys); fabric_key.reserve_keys(num_keys);
for (size_t ichild = 0; ichild < num_keys; ++ichild) { for (size_t ichild = 0; ichild < num_keys; ++ichild) {
@ -78,6 +83,9 @@ int write_fabric_key_to_xml_file(const ModuleManager& module_manager,
if (false == module_manager.instance_name(top_module, child_module, child_instance).empty()) { if (false == module_manager.instance_name(top_module, child_module, child_instance).empty()) {
fabric_key.set_key_alias(key, module_manager.instance_name(top_module, child_module, child_instance)); fabric_key.set_key_alias(key, module_manager.instance_name(top_module, child_module, child_instance));
} }
/* Add keys to the region */
fabric_key.add_key_to_region(region, key);
} }
VTR_LOGV(verbose, VTR_LOGV(verbose,