add XML parsing for design parameters in technology library

This commit is contained in:
tangxifan 2020-01-17 17:22:09 -07:00
parent de0bcc96fb
commit d48a888804
1 changed files with 24 additions and 2 deletions

View File

@ -51,7 +51,8 @@ e_tech_lib_type string_to_tech_lib_type(const std::string& type_string) {
}
/********************************************************************
* Parse XML codes of a <device> to an object of technology library
* Parse XML codes of a <lib> under a device model definiton
* to an object of technology library
*******************************************************************/
static
void read_xml_device_model_lib_settings(pugi::xml_node& xml_device_model_lib,
@ -83,6 +84,22 @@ void read_xml_device_model_lib_settings(pugi::xml_node& xml_device_model_lib,
tech_lib.set_model_lib_path(device_model, get_attribute(xml_device_model_lib, "path", loc_data).as_string());
}
/********************************************************************
* Parse XML codes of design parameters under a device model
* to an object of technology library
*******************************************************************/
static
void read_xml_device_model_design_settings(pugi::xml_node& xml_device_model_design,
const pugiutil::loc_data& loc_data,
TechnologyLibrary& tech_lib,
TechnologyModelId& device_model) {
/* Parse the vdd to be used in circuit design */
tech_lib.set_model_vdd(device_model, get_attribute(xml_device_model_design, "vdd", loc_data).as_float(0.));
/* Parse the width ratio between PMOS and NMOS transistor */
tech_lib.set_model_pn_ratio(device_model, get_attribute(xml_device_model_design, "pn_ratio", loc_data).as_float(0.));
}
/********************************************************************
* Parse XML codes of a <device> to an object of technology library
*******************************************************************/
@ -110,6 +127,11 @@ void read_xml_device_model(pugi::xml_node& xml_device_model,
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);
/* Model design -relate attributes, this is ONLY applicable to transistor models */
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);
}
}
/********************************************************************