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_region_key(pugi::xml_node& xml_component_key,
                         const pugiutil::loc_data& loc_data,
                         FabricKey& fabric_key,
                         const FabricRegionId& fabric_region) {
  const size_t& id = get_attribute(xml_component_key, "id", loc_data).as_int();
  if (false == fabric_key.valid_key_id(FabricKeyId(id))) {
    archfpga_throw(loc_data.filename_c_str(), loc_data.line(xml_component_key),
                   "Invalid 'id' attribute '%d' (in total %lu keys)!\n",
                   id,
                   fabric_key.keys().size());
  }
  VTR_ASSERT_SAFE(true == fabric_key.valid_key_id(FabricKeyId(id)));
  const std::string& alias = get_attribute(xml_component_key, "alias", loc_data, pugiutil::ReqOpt::OPTIONAL).as_string();
  if (!alias.empty()) {
    fabric_key.set_key_alias(FabricKeyId(id), alias);
  }
  pugiutil::ReqOpt required_name_value = pugiutil::ReqOpt::OPTIONAL; 
  if (true == alias.empty()) {
    required_name_value = pugiutil::ReqOpt::REQUIRED;
  }
  const std::string& name = get_attribute(xml_component_key, "name", loc_data, required_name_value).as_string();
  const size_t& value = get_attribute(xml_component_key, "value", loc_data, required_name_value).as_int();
  fabric_key.set_key_name(FabricKeyId(id), name);
  fabric_key.set_key_value(FabricKeyId(id), value);
  fabric_key.add_key_to_region(fabric_region, FabricKeyId(id));
}
static void read_xml_region_key ( pugi :: xml_node & xml_component_key , const pugiutil :: loc_data & loc_data , FabricKey & fabric_key , const FabricRegionId & fabric_region ) { const size_t & id = get_attribute ( xml_component_key , " " , loc_data ) . as_int ( ) ; if ( false == fabric_key . valid_key_id ( FabricKeyId ( id ) ) ) { archfpga_throw ( loc_data . filename_c_str ( ) , loc_data . line ( xml_component_key ) , " \n " , id , fabric_key . keys ( ) . size ( ) ) ; } VTR_ASSERT_SAFE ( true == fabric_key . valid_key_id ( FabricKeyId ( id ) ) ) ; const std :: string & alias = get_attribute ( xml_component_key , " " , loc_data , pugiutil :: ReqOpt :: OPTIONAL ) . as_string ( ) ; if ( ! alias . empty ( ) ) { fabric_key . set_key_alias ( FabricKeyId ( id ) , alias ) ; } pugiutil :: ReqOpt required_name_value = pugiutil :: ReqOpt :: OPTIONAL ; if ( true == alias . empty ( ) ) { required_name_value = pugiutil :: ReqOpt :: REQUIRED ; } const std :: string & name = get_attribute ( xml_component_key , " " , loc_data , required_name_value ) . as_string ( ) ; const size_t & value = get_attribute ( xml_component_key , " " , loc_data , required_name_value ) . as_int ( ) ; fabric_key . set_key_name ( FabricKeyId ( id ) , name ) ; fabric_key . set_key_value ( FabricKeyId ( id ) , value ) ; fabric_key . add_key_to_region ( fabric_region , FabricKeyId ( 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 id of component key */ /* If we have an alias, set the value as well */ /* If we have the alias set, name and valus are optional then 
   * Otherwise, they are mandatory attributes 
   */