libopenfpga/libarchopenfpga/src/write_xml_technology_library.cpp
/********************************************************************
 * A writer to output a device model in a technology library to XML format
 *******************************************************************/
A writer to output a device model in a technology library to XML format
A writer to output a device model in a technology library to XML format
static 
void write_xml_device_model(std::fstream& fp,
                            const char* fname,
                            const TechnologyLibrary& tech_lib,
                            const TechnologyModelId& device_model) {
  openfpga::check_file_stream(fname, fp);
  fp << "\t\t\t" << "<device_model";
  write_xml_attribute(fp, "name", tech_lib.model_name(device_model).c_str());
  write_xml_attribute(fp, "type", TECH_LIB_MODEL_TYPE_STRING[tech_lib.model_type(device_model)]);
  fp << ">" << "\n";
  fp << "\t\t\t\t" << "<lib";
  write_xml_attribute(fp, "type", TECH_LIB_TYPE_STRING[tech_lib.model_lib_type(device_model)]);
  if (TECH_LIB_INDUSTRY == tech_lib.model_lib_type(device_model)) {
    write_xml_attribute(fp, "corner", tech_lib.model_corner(device_model).c_str());
  }
  write_xml_attribute(fp, "ref", tech_lib.model_ref(device_model).c_str());
  write_xml_attribute(fp, "path", tech_lib.model_lib_path(device_model).c_str());
  fp << ">" << "\n";
  if (TECH_LIB_MODEL_TRANSISTOR == tech_lib.model_type(device_model)) {
    fp << "\t\t\t\t" << "<design";
    write_xml_attribute(fp, "vdd", std::to_string(tech_lib.model_vdd(device_model)).c_str());
    write_xml_attribute(fp, "pn_ratio", std::to_string(tech_lib.model_pn_ratio(device_model)).c_str());
    fp << ">" << "\n";
  }
  if (TECH_LIB_MODEL_TRANSISTOR == tech_lib.model_type(device_model)) {
    fp << "\t\t\t\t" << "<pmos";
    write_xml_attribute(fp, "name", tech_lib.transistor_model_name(device_model, TECH_LIB_TRANSISTOR_PMOS).c_str());
    write_xml_attribute(fp, "chan_length", tech_lib.transistor_model_chan_length(device_model, TECH_LIB_TRANSISTOR_PMOS));
    write_xml_attribute(fp, "min_width", tech_lib.transistor_model_min_width(device_model, TECH_LIB_TRANSISTOR_PMOS));
    write_xml_attribute(fp, "max_width", tech_lib.transistor_model_max_width(device_model, TECH_LIB_TRANSISTOR_PMOS));
    if (TechnologyVariationId::INVALID() != tech_lib.transistor_model_variation(device_model, TECH_LIB_TRANSISTOR_PMOS)) {
      write_xml_attribute(fp, "variation", tech_lib.variation_name(tech_lib.transistor_model_variation(device_model, TECH_LIB_TRANSISTOR_PMOS)).c_str());
    }
    fp << "/>" << "\n";
    fp << "\t\t\t\t" << "<nmos";
    write_xml_attribute(fp, "name", tech_lib.transistor_model_name(device_model, TECH_LIB_TRANSISTOR_NMOS).c_str());
    write_xml_attribute(fp, "chan_length", tech_lib.transistor_model_chan_length(device_model, TECH_LIB_TRANSISTOR_NMOS));
    write_xml_attribute(fp, "min_width", tech_lib.transistor_model_min_width(device_model, TECH_LIB_TRANSISTOR_NMOS));
    if (TechnologyVariationId::INVALID() != tech_lib.transistor_model_variation(device_model, TECH_LIB_TRANSISTOR_NMOS)) {
      write_xml_attribute(fp, "variation", tech_lib.variation_name(tech_lib.transistor_model_variation(device_model, TECH_LIB_TRANSISTOR_NMOS)).c_str());
    }
    fp << "/>" << "\n";
  }
  if (TECH_LIB_MODEL_RRAM == tech_lib.model_type(device_model)) {
    fp << "\t\t\t\t" << "<rram";
    write_xml_attribute(fp, "rlrs", tech_lib.rram_rlrs(device_model));
    write_xml_attribute(fp, "rhrs", tech_lib.rram_rhrs(device_model));
    if (TechnologyVariationId::INVALID() != tech_lib.rram_variation(device_model)) {
      write_xml_attribute(fp, "variation", tech_lib.variation_name(tech_lib.rram_variation(device_model)).c_str());
    }
    fp << "/>" << "\n";
  }
  fp << "\t\t\t" << "</device_model>" << "\n";
}
static void write_xml_device_model ( std :: fstream & fp , const char * fname , const TechnologyLibrary & tech_lib , const TechnologyModelId & device_model ) { openfpga :: check_file_stream ( fname , fp ) ; fp << " \t \t \t " << " " ; write_xml_attribute ( fp , " " , tech_lib . model_name ( device_model ) . c_str ( ) ) ; write_xml_attribute ( fp , " " , TECH_LIB_MODEL_TYPE_STRING [ tech_lib . model_type ( device_model ) ] ) ; fp << " " << " \n " ; fp << " \t \t \t \t " << " " ; write_xml_attribute ( fp , " " , TECH_LIB_TYPE_STRING [ tech_lib . model_lib_type ( device_model ) ] ) ; if ( TECH_LIB_INDUSTRY == tech_lib . model_lib_type ( device_model ) ) { write_xml_attribute ( fp , " " , tech_lib . model_corner ( device_model ) . c_str ( ) ) ; } write_xml_attribute ( fp , " " , tech_lib . model_ref ( device_model ) . c_str ( ) ) ; write_xml_attribute ( fp , " " , tech_lib . model_lib_path ( device_model ) . c_str ( ) ) ; fp << " " << " \n " ; if ( TECH_LIB_MODEL_TRANSISTOR == tech_lib . model_type ( device_model ) ) { fp << " \t \t \t \t " << " " ; write_xml_attribute ( fp , " " , std :: to_string ( tech_lib . model_vdd ( device_model ) ) . c_str ( ) ) ; write_xml_attribute ( fp , " " , std :: to_string ( tech_lib . model_pn_ratio ( device_model ) ) . c_str ( ) ) ; fp << " " << " \n " ; } if ( TECH_LIB_MODEL_TRANSISTOR == tech_lib . model_type ( device_model ) ) { fp << " \t \t \t \t " << " " ; write_xml_attribute ( fp , " " , tech_lib . transistor_model_name ( device_model , TECH_LIB_TRANSISTOR_PMOS ) . c_str ( ) ) ; write_xml_attribute ( fp , " " , tech_lib . transistor_model_chan_length ( device_model , TECH_LIB_TRANSISTOR_PMOS ) ) ; write_xml_attribute ( fp , " " , tech_lib . transistor_model_min_width ( device_model , TECH_LIB_TRANSISTOR_PMOS ) ) ; write_xml_attribute ( fp , " " , tech_lib . transistor_model_max_width ( device_model , TECH_LIB_TRANSISTOR_PMOS ) ) ; if ( TechnologyVariationId :: INVALID ( ) != tech_lib . transistor_model_variation ( device_model , TECH_LIB_TRANSISTOR_PMOS ) ) { write_xml_attribute ( fp , " " , tech_lib . variation_name ( tech_lib . transistor_model_variation ( device_model , TECH_LIB_TRANSISTOR_PMOS ) ) . c_str ( ) ) ; } fp << " " << " \n " ; fp << " \t \t \t \t " << " " ; write_xml_attribute ( fp , " " , tech_lib . transistor_model_name ( device_model , TECH_LIB_TRANSISTOR_NMOS ) . c_str ( ) ) ; write_xml_attribute ( fp , " " , tech_lib . transistor_model_chan_length ( device_model , TECH_LIB_TRANSISTOR_NMOS ) ) ; write_xml_attribute ( fp , " " , tech_lib . transistor_model_min_width ( device_model , TECH_LIB_TRANSISTOR_NMOS ) ) ; if ( TechnologyVariationId :: INVALID ( ) != tech_lib . transistor_model_variation ( device_model , TECH_LIB_TRANSISTOR_NMOS ) ) { write_xml_attribute ( fp , " " , tech_lib . variation_name ( tech_lib . transistor_model_variation ( device_model , TECH_LIB_TRANSISTOR_NMOS ) ) . c_str ( ) ) ; } fp << " " << " \n " ; } if ( TECH_LIB_MODEL_RRAM == tech_lib . model_type ( device_model ) ) { fp << " \t \t \t \t " << " " ; write_xml_attribute ( fp , " " , tech_lib . rram_rlrs ( device_model ) ) ; write_xml_attribute ( fp , " " , tech_lib . rram_rhrs ( device_model ) ) ; if ( TechnologyVariationId :: INVALID ( ) != tech_lib . rram_variation ( device_model ) ) { write_xml_attribute ( fp , " " , tech_lib . variation_name ( tech_lib . rram_variation ( device_model ) ) . c_str ( ) ) ; } fp << " " << " \n " ; } fp << " \t \t \t " << " " << " \n " ; }
A writer to output a device model in a technology library to XML format
A writer to output a device model in a technology library to XML format
/* Validate the file stream */ /* Write up name and type of the device model */ /* Write library settings */ /* Write design parameters. This is ONLY applicable to transistors */ /* Write PMOS and NMOS. This is ONLY applicable to transistors */ /* Write RRAM device parameters. This is ONLY applicable to RRAM */ /* Finished XML dumping for this device model */