/******************************************************************** * This file includes functions that outputs a technology library to XML format *******************************************************************/ /* Headers from system goes first */ #include #include /* Headers from vtr util library */ #include "vtr_log.h" #include "openfpga_digest.h" /* Headers from readarchopenfpga library */ #include "write_xml_utils.h" #include "write_xml_technology_library.h" /******************************************************************** * 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) { /* Validate the file stream */ openfpga::check_file_stream(fname, fp); fp << "\t\t\t" << "" << "\n"; /* Write library settings */ fp << "\t\t\t\t" << "" << "\n"; /* Write design parameters. This is ONLY applicable to transistors */ if (TECH_LIB_MODEL_TRANSISTOR == tech_lib.model_type(device_model)) { fp << "\t\t\t\t" << "" << "\n"; } /* Write PMOS and NMOS. This is ONLY applicable to transistors */ if (TECH_LIB_MODEL_TRANSISTOR == tech_lib.model_type(device_model)) { fp << "\t\t\t\t" << "" << "\n"; fp << "\t\t\t\t" << "" << "\n"; } /* Write RRAM device parameters. This is ONLY applicable to RRAM */ if (TECH_LIB_MODEL_RRAM == tech_lib.model_type(device_model)) { fp << "\t\t\t\t" << "" << "\n"; } /* Finished XML dumping for this device model */ fp << "\t\t\t" << "" << "\n"; } /******************************************************************** * A writer to output a device variation in a technology library to XML format *******************************************************************/ static void write_xml_device_variation(std::fstream& fp, const char* fname, const TechnologyLibrary& tech_lib, const TechnologyVariationId& device_variation) { /* Validate the file stream */ openfpga::check_file_stream(fname, fp); fp << "\t\t\t" << "" << "\n"; } /******************************************************************** * A writer to output a technology library to XML format * Note: * This function should be run after that the following methods of * TechnologyLibrary are executed * 1. link_models_to_variations(); *******************************************************************/ void write_xml_technology_library(std::fstream& fp, const char* fname, const TechnologyLibrary& tech_lib) { /* Validate the file stream */ openfpga::check_file_stream(fname, fp); /* Write the root node for technology_library, * we apply a tab becuase technology library is a subnode * under the root node */ fp << "\t" << "" << "\n"; /* Write device library node */ fp << "\t\t" << "" << "\n"; /* Write device model one by one */ for (const TechnologyModelId& device_model : tech_lib.models()) { write_xml_device_model(fp, fname, tech_lib, device_model); } /* Finish writing device library node */ fp << "\t\t" << "" << "\n"; /* Write variation library node */ fp << "\t\t" << "" << "\n"; /* Write variation model one by one */ for (const TechnologyVariationId& variation : tech_lib.variations()) { write_xml_device_variation(fp, fname, tech_lib, variation); } /* Finish writing variation library node */ fp << "\t\t" << "" << "\n"; /* Write the root node for circuit_library */ fp << "\t" << "" << "\n"; }