add max_width to technology library XML syntax to support multi-bin transistor in FPGA-SPICE

This commit is contained in:
tangxifan 2020-07-24 16:25:27 -06:00
parent 73e2b857a3
commit 6d046efc52
5 changed files with 67 additions and 0 deletions

View File

@ -122,6 +122,10 @@ void read_xml_device_transistor(pugi::xml_node& xml_device_transistor,
tech_lib.set_transistor_model_min_width(device_model, transistor_type, tech_lib.set_transistor_model_min_width(device_model, transistor_type,
get_attribute(xml_device_transistor, "min_width", loc_data).as_float(0.)); get_attribute(xml_device_transistor, "min_width", loc_data).as_float(0.));
/* Parse the transistor maximum width, by default we consider the same as minimum width */
tech_lib.set_transistor_model_max_width(device_model, transistor_type,
get_attribute(xml_device_transistor, "max_width", loc_data, pugiutil::ReqOpt::OPTIONAL).as_float(tech_lib.transistor_model_min_width(device_model, transistor_type)));
/* Parse the transistor variation name */ /* Parse the transistor variation name */
tech_lib.set_transistor_model_variation_name(device_model, transistor_type, tech_lib.set_transistor_model_variation_name(device_model, transistor_type,
get_attribute(xml_device_transistor, "variation", loc_data).as_string()); get_attribute(xml_device_transistor, "variation", loc_data).as_string());

View File

@ -157,6 +157,18 @@ float TechnologyLibrary::transistor_model_min_width(const TechnologyModelId& mod
return transistor_model_min_widths_[model_id][transistor_type]; return transistor_model_min_widths_[model_id][transistor_type];
} }
/* Access the maximum width of a transistor (either PMOS or NMOS) for a technology model
* Note: This is ONLY applicable to transistor model
*/
float TechnologyLibrary::transistor_model_max_width(const TechnologyModelId& model_id,
const e_tech_lib_transistor_type& transistor_type) const {
/* validate the model_id */
VTR_ASSERT(valid_model_id(model_id));
/* This is only applicable to transistor model */
VTR_ASSERT(TECH_LIB_MODEL_TRANSISTOR == model_type(model_id));
return transistor_model_max_widths_[model_id][transistor_type];
}
/* Access the minimum width of a transistor (either PMOS or NMOS) for a technology model /* Access the minimum width of a transistor (either PMOS or NMOS) for a technology model
* Note: This is ONLY applicable to transistor model * Note: This is ONLY applicable to transistor model
*/ */
@ -270,6 +282,7 @@ TechnologyModelId TechnologyLibrary::add_model(const std::string& name) {
transistor_model_names_.emplace_back(); transistor_model_names_.emplace_back();
transistor_model_chan_lengths_.emplace_back(); transistor_model_chan_lengths_.emplace_back();
transistor_model_min_widths_.emplace_back(); transistor_model_min_widths_.emplace_back();
transistor_model_max_widths_.emplace_back();
transistor_model_variation_names_.emplace_back(); transistor_model_variation_names_.emplace_back();
transistor_model_variation_ids_.push_back(std::array<TechnologyVariationId, 2>{TechnologyVariationId::INVALID(), TechnologyVariationId::INVALID()}); transistor_model_variation_ids_.push_back(std::array<TechnologyVariationId, 2>{TechnologyVariationId::INVALID(), TechnologyVariationId::INVALID()});
@ -394,6 +407,19 @@ void TechnologyLibrary::set_transistor_model_min_width(const TechnologyModelId&
return; return;
} }
/* Set the maximum width for either PMOS or NMOS of a model in the library
* This is ONLY applicable to transistors
*/
void TechnologyLibrary::set_transistor_model_max_width(const TechnologyModelId& model_id,
const e_tech_lib_transistor_type& transistor_type,
const float& max_width) {
/* validate the model_id */
VTR_ASSERT(valid_model_id(model_id));
VTR_ASSERT(TECH_LIB_MODEL_TRANSISTOR == model_type(model_id));
transistor_model_max_widths_[model_id][transistor_type] = max_width;
return;
}
/* Set the variation name for either PMOS or NMOS of a model in the library /* Set the variation name for either PMOS or NMOS of a model in the library
* This is ONLY applicable to transistors * This is ONLY applicable to transistors
*/ */

View File

@ -101,6 +101,8 @@ class TechnologyLibrary {
const e_tech_lib_transistor_type& transistor_type) const; const e_tech_lib_transistor_type& transistor_type) const;
float transistor_model_min_width(const TechnologyModelId& model_id, float transistor_model_min_width(const TechnologyModelId& model_id,
const e_tech_lib_transistor_type& transistor_type) const; const e_tech_lib_transistor_type& transistor_type) const;
float transistor_model_max_width(const TechnologyModelId& model_id,
const e_tech_lib_transistor_type& transistor_type) const;
TechnologyVariationId transistor_model_variation(const TechnologyModelId& model_id, TechnologyVariationId transistor_model_variation(const TechnologyModelId& model_id,
const e_tech_lib_transistor_type& transistor_type) const; const e_tech_lib_transistor_type& transistor_type) const;
public: /* Public Accessors: Basic data query on RRAM models */ public: /* Public Accessors: Basic data query on RRAM models */
@ -138,6 +140,9 @@ class TechnologyLibrary {
void set_transistor_model_min_width(const TechnologyModelId& model_id, void set_transistor_model_min_width(const TechnologyModelId& model_id,
const e_tech_lib_transistor_type& transistor_type, const e_tech_lib_transistor_type& transistor_type,
const float& min_width); const float& min_width);
void set_transistor_model_max_width(const TechnologyModelId& model_id,
const e_tech_lib_transistor_type& transistor_type,
const float& max_width);
void set_transistor_model_variation_name(const TechnologyModelId& model_id, void set_transistor_model_variation_name(const TechnologyModelId& model_id,
const e_tech_lib_transistor_type& transistor_type, const e_tech_lib_transistor_type& transistor_type,
const std::string& variation_name); const std::string& variation_name);
@ -231,6 +236,15 @@ class TechnologyLibrary {
*/ */
vtr::vector<TechnologyModelId, std::array<float, 2>> transistor_model_min_widths_; vtr::vector<TechnologyModelId, std::array<float, 2>> transistor_model_min_widths_;
/* The maximum width of a transistor.
* This should be defined by your technology vendor
* The maximum width of a transistor will be used to size your transistors
* If the required width in circuit models in larger then the max width,
* multiple transistor bin will be instanciated.
* For FinFET, the maximum width should be the same as min_width
*/
vtr::vector<TechnologyModelId, std::array<float, 2>> transistor_model_max_widths_;
/* The variation name and id binded to PMOS and NMOS transistor /* The variation name and id binded to PMOS and NMOS transistor
* We expect users to provide the exact name of variation defined in this technology library * We expect users to provide the exact name of variation defined in this technology library
* the name and id will be automatically matched by using function link_model_to_variation() * the name and id will be automatically matched by using function link_model_to_variation()

View File

@ -92,6 +92,25 @@ void write_xml_design_technology(std::fstream& fp,
fp << "/>" << "\n"; fp << "/>" << "\n";
} }
/********************************************************************
* A writer to output the device technology of a circuit model to XML format
*******************************************************************/
static
void write_xml_device_technology(std::fstream& fp,
const char* fname,
const CircuitLibrary& circuit_lib,
const CircuitModelId& model) {
/* Validate the file stream */
openfpga::check_file_stream(fname, fp);
if (!circuit_lib.device_model_name(model).empty()) {
fp << "\t\t\t" << "<device_technology";
write_xml_attribute(fp, "device_model_name", circuit_lib.device_model_name(model).c_str());
/* Finish all the attributes, we can return here */
fp << "/>" << "\n";
}
}
/******************************************************************** /********************************************************************
* A writer to output a circuit port to XML format * A writer to output a circuit port to XML format
*******************************************************************/ *******************************************************************/
@ -401,6 +420,9 @@ void write_xml_circuit_model(std::fstream& fp,
/* Write the design technology of circuit model */ /* Write the design technology of circuit model */
write_xml_design_technology(fp, fname, circuit_lib, model); write_xml_design_technology(fp, fname, circuit_lib, model);
/* Write the device technology of circuit model */
write_xml_device_technology(fp, fname, circuit_lib, model);
/* Write the input buffer information of circuit model, /* Write the input buffer information of circuit model,
* only applicable when this circuit model is neither inverter nor buffer * only applicable when this circuit model is neither inverter nor buffer
*/ */

View File

@ -60,6 +60,7 @@ void write_xml_device_model(std::fstream& fp,
write_xml_attribute(fp, "name", tech_lib.transistor_model_name(device_model, TECH_LIB_TRANSISTOR_PMOS).c_str()); 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, "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, "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)) { 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()); write_xml_attribute(fp, "variation", tech_lib.variation_name(tech_lib.transistor_model_variation(device_model, TECH_LIB_TRANSISTOR_PMOS)).c_str());
} }