libopenfpga/libfabrickey/src/read_xml_fabric_key.cpp
/********************************************************************
 * Parse XML codes of a <key> to an object of FabricKey
 *******************************************************************/
Parse XML codes of a  to an object of FabricKey
Parse XML codes of a to an object of FabricKey
static 
void read_xml_fabric_region(pugi::xml_node& xml_region,
                            const pugiutil::loc_data& loc_data,
                            FabricKey& fabric_key) {
  const FabricRegionId& region_id = FabricRegionId(get_attribute(xml_region, "id", loc_data).as_int());
  if (false == fabric_key.valid_region_id(region_id)) {
    archfpga_throw(loc_data.filename_c_str(), loc_data.line(xml_region),
                   "Invalid region id '%lu' (in total %lu regions)!\n",
                   size_t(region_id),
                   fabric_key.regions().size());
  }
  VTR_ASSERT_SAFE(true == fabric_key.valid_region_id(region_id));
  size_t num_keys = std::distance(xml_region.children().begin(), xml_region.children().end());
  fabric_key.reserve_region_keys(region_id, num_keys);
  for (pugi::xml_node xml_key : xml_region.children()) {
    if (xml_key.name() != std::string("key")) {
      archfpga_throw(loc_data.filename_c_str(), loc_data.line(xml_region),
                     "Unexpected child '%s' in region '%lu', Region XML node can only contain keys!\n",
                     xml_key.name(),
                     size_t(region_id));
    }
    read_xml_region_key(xml_key, loc_data, fabric_key, region_id);
  }
}
static void read_xml_fabric_region ( pugi :: xml_node & xml_region , const pugiutil :: loc_data & loc_data , FabricKey & fabric_key ) { const FabricRegionId & region_id = FabricRegionId ( get_attribute ( xml_region , " " , loc_data ) . as_int ( ) ) ; if ( false == fabric_key . valid_region_id ( region_id ) ) { archfpga_throw ( loc_data . filename_c_str ( ) , loc_data . line ( xml_region ) , " \n " , size_t ( region_id ) , fabric_key . regions ( ) . size ( ) ) ; } VTR_ASSERT_SAFE ( true == fabric_key . valid_region_id ( region_id ) ) ; size_t num_keys = std :: distance ( xml_region . children ( ) . begin ( ) , xml_region . children ( ) . end ( ) ) ; fabric_key . reserve_region_keys ( region_id , num_keys ) ; for ( pugi :: xml_node xml_key : xml_region . children ( ) ) { if ( xml_key . name ( ) != std :: string ( " " ) ) { archfpga_throw ( loc_data . filename_c_str ( ) , loc_data . line ( xml_region ) , " \n " , xml_key . name ( ) , size_t ( region_id ) ) ; } read_xml_region_key ( xml_key , loc_data , fabric_key , region_id ) ; } }
Parse XML codes of a <key> to an object of FabricKey
Parse XML codes of a <key > to an object of FabricKey
/* Find the unique id for the region */ /* Reserve memory space for the keys in the region */ /* Error out if the XML child has an invalid name! */ /* Parse the key for this region */