libopenfpga/libarchopenfpga/src/read_xml_technology_library.cpp
/********************************************************************
 * Parse XML codes of a <device> to an object of technology library
 *******************************************************************/
Parse XML codes of a  to an object of technology library
Parse XML codes of a to an object of technology library
static 
void read_xml_device_model(pugi::xml_node& xml_device_model,
                           const pugiutil::loc_data& loc_data,
                           TechnologyLibrary& tech_lib) {
  TechnologyModelId device_model = tech_lib.add_model(get_attribute(xml_device_model, "name", loc_data).as_string());
  const char* type_attr = get_attribute(xml_device_model, "type", loc_data).value();
  e_tech_lib_model_type device_model_type = string_to_device_model_type(std::string(type_attr));
  if (NUM_TECH_LIB_MODEL_TYPES == device_model_type) {
    archfpga_throw(loc_data.filename_c_str(), loc_data.line(xml_device_model),
                   "Invalid 'type' attribute '%s'\n",
                   type_attr);
  }
  tech_lib.set_model_type(device_model, device_model_type);
  auto xml_device_model_lib = get_single_child(xml_device_model, "lib", loc_data); 
  read_xml_device_model_lib_settings(xml_device_model_lib, loc_data, tech_lib, device_model);
  if (TECH_LIB_MODEL_TRANSISTOR == tech_lib.model_type(device_model)) {
    auto xml_device_model_design = get_single_child(xml_device_model, "design", loc_data); 
    read_xml_device_model_design_settings(xml_device_model_design, loc_data, tech_lib, device_model);
  }
  if (TECH_LIB_MODEL_TRANSISTOR == tech_lib.model_type(device_model)) {
    auto xml_device_model_pmos = get_single_child(xml_device_model, "pmos", loc_data); 
    read_xml_device_transistor(xml_device_model_pmos, loc_data, tech_lib, device_model, TECH_LIB_TRANSISTOR_PMOS);
    auto xml_device_model_nmos = get_single_child(xml_device_model, "nmos", loc_data); 
    read_xml_device_transistor(xml_device_model_nmos, loc_data, tech_lib, device_model, TECH_LIB_TRANSISTOR_NMOS);
  }
  if (TECH_LIB_MODEL_RRAM == tech_lib.model_type(device_model)) {
    auto xml_device_rram = get_single_child(xml_device_model, "rram", loc_data); 
    read_xml_device_rram(xml_device_rram, loc_data, tech_lib, device_model);
  }
}
static void read_xml_device_model ( pugi :: xml_node & xml_device_model , const pugiutil :: loc_data & loc_data , TechnologyLibrary & tech_lib ) { TechnologyModelId device_model = tech_lib . add_model ( get_attribute ( xml_device_model , " " , loc_data ) . as_string ( ) ) ; const char * type_attr = get_attribute ( xml_device_model , " " , loc_data ) . value ( ) ; e_tech_lib_model_type device_model_type = string_to_device_model_type ( std :: string ( type_attr ) ) ; if ( NUM_TECH_LIB_MODEL_TYPES == device_model_type ) { archfpga_throw ( loc_data . filename_c_str ( ) , loc_data . line ( xml_device_model ) , " \n " , type_attr ) ; } tech_lib . set_model_type ( device_model , device_model_type ) ; auto xml_device_model_lib = get_single_child ( xml_device_model , " " , loc_data ) ; read_xml_device_model_lib_settings ( xml_device_model_lib , loc_data , tech_lib , device_model ) ; if ( TECH_LIB_MODEL_TRANSISTOR == tech_lib . model_type ( device_model ) ) { auto xml_device_model_design = get_single_child ( xml_device_model , " " , loc_data ) ; read_xml_device_model_design_settings ( xml_device_model_design , loc_data , tech_lib , device_model ) ; } if ( TECH_LIB_MODEL_TRANSISTOR == tech_lib . model_type ( device_model ) ) { auto xml_device_model_pmos = get_single_child ( xml_device_model , " " , loc_data ) ; read_xml_device_transistor ( xml_device_model_pmos , loc_data , tech_lib , device_model , TECH_LIB_TRANSISTOR_PMOS ) ; auto xml_device_model_nmos = get_single_child ( xml_device_model , " " , loc_data ) ; read_xml_device_transistor ( xml_device_model_nmos , loc_data , tech_lib , device_model , TECH_LIB_TRANSISTOR_NMOS ) ; } if ( TECH_LIB_MODEL_RRAM == tech_lib . model_type ( device_model ) ) { auto xml_device_rram = get_single_child ( xml_device_model , " " , loc_data ) ; read_xml_device_rram ( xml_device_rram , loc_data , tech_lib , device_model ) ; } }
Parse XML codes of a <device> to an object of technology library
Parse XML codes of a <device > to an object of technology library
/* Get the name of this device_model node and add a device to the technology library */ /* Find the type of device model*/ /* Translate the type of design technology to enumerate */ /* Model library -relate attributes */ /* Model design -relate attributes, this is ONLY applicable to transistor models */ /* Transistor -relate attributes, this is ONLY applicable to transistor models */ /* RRAM -relate attributes, this is ONLY applicable to RRAM models */