add XML attribute parsing for physical and operating pb_type annotation

This commit is contained in:
tangxifan 2020-01-26 10:19:47 -07:00
parent bafd866cfc
commit a9f03ce21b
4 changed files with 42 additions and 1 deletions

View File

@ -270,7 +270,7 @@
</direct_connection>
<pb_type_annotations>
<!-- physical pb_type binding in complex block IO -->
<pb_type name="io" physical_mode_name="io_phy"/>
<pb_type name="io" physical_mode_name="io_phy" idle_mode_name="inpad"/>
<pb_type name="io[io_phy].iopad" circuit_model_name="iopad" mode_bits="1"/>
<pb_type name="io[inpad].inpad" physical_pb_type_name="iopad" mode_bits="1"/>
<pb_type name="io[outpad].outpad" physical_pb_type_name="iopad" mode_bits="0"/>

View File

@ -51,6 +51,14 @@ bool PbTypeAnnotation::is_physical_pb_type() const {
return true == physical_pb_type_name_.empty();
}
std::string PbTypeAnnotation::physical_mode_name() const {
return physical_mode_name_;
}
std::string PbTypeAnnotation::idle_mode_name() const {
return idle_mode_name_;
}
std::string PbTypeAnnotation::mode_bits() const {
return mode_bits_;
}
@ -121,6 +129,14 @@ void PbTypeAnnotation::set_physical_parent_mode_names(const std::vector<std::str
physical_parent_mode_names_ = names;
}
void PbTypeAnnotation::set_physical_mode_name(const std::string& name) {
physical_mode_name_ = name;
}
void PbTypeAnnotation::set_idle_mode_name(const std::string& name) {
idle_mode_name_ = name;
}
void PbTypeAnnotation::set_mode_bits(const std::string& mode_bits) {
mode_bits_ = mode_bits;
}

View File

@ -41,6 +41,8 @@ class PbTypeAnnotation {
std::vector<std::string> physical_parent_pb_type_names() const;
std::vector<std::string> physical_parent_mode_names() const;
bool is_physical_pb_type() const;
std::string physical_mode_name() const;
std::string idle_mode_name() const;
std::string mode_bits() const;
std::string circuit_model_name() const;
int physical_pb_type_index_factor() const;
@ -55,6 +57,8 @@ class PbTypeAnnotation {
void set_physical_pb_type_name(const std::string& name);
void set_physical_parent_pb_type_names(const std::vector<std::string>& names);
void set_physical_parent_mode_names(const std::vector<std::string>& names);
void set_physical_mode_name(const std::string& name);
void set_idle_mode_name(const std::string& name);
void set_mode_bits(const std::string& mode_bits);
void set_circuit_model_name(const std::string& name);
void physical_pb_type_index_factor(const int& value);
@ -89,6 +93,12 @@ class PbTypeAnnotation {
std::vector<std::string> physical_parent_pb_type_names_;
std::vector<std::string> physical_parent_mode_names_;
/* Identify which mode is the physical implementation of an operating pb_type */
std::string physical_mode_name_;
/* Identify in which mode is the pb_type will operate when it is not used */
std::string idle_mode_name_;
/* Configuration bits to select an operting mode for the circuit mode name */
std::string mode_bits_;

View File

@ -30,6 +30,7 @@ void read_xml_pb_type_annotation(pugi::xml_node& xml_pb_type,
/* Find the name of pb_type */
const std::string& name_attr = get_attribute(xml_pb_type, "name", loc_data).as_string();
const std::string& physical_name_attr = get_attribute(xml_pb_type, "physical_pb_type_name", loc_data, pugiutil::ReqOpt::OPTIONAL).as_string();
const std::string& physical_mode_name_attr = get_attribute(xml_pb_type, "physical_mode_name", loc_data, pugiutil::ReqOpt::OPTIONAL).as_string();
/* If both names are not empty, this is a operating pb_type */
if ( (false == name_attr.empty())
@ -45,6 +46,20 @@ void read_xml_pb_type_annotation(pugi::xml_node& xml_pb_type,
pb_type_annotation.set_physical_pb_type_name(name_attr);
}
/* Parse physical mode name which are applied to both pb_types */
pb_type_annotation.set_physical_mode_name(get_attribute(xml_pb_type, "physical_mode_name", loc_data, pugiutil::ReqOpt::OPTIONAL).as_string());
/* Parse idle mode name which are applied to both pb_types */
pb_type_annotation.set_idle_mode_name(get_attribute(xml_pb_type, "idle_mode_name", loc_data, pugiutil::ReqOpt::OPTIONAL).as_string());
/* Parse mode bits which are applied to both pb_types */
pb_type_annotation.set_mode_bits(get_attribute(xml_pb_type, "mode_bits", loc_data, pugiutil::ReqOpt::OPTIONAL).as_string());
/* If this is a physical pb_type, circuit model name is a mandatory attribute */
if (true == pb_type_annotation.is_physical_pb_type()) {
pb_type_annotation.set_circuit_model_name(get_attribute(xml_pb_type, "circuit_model_name", loc_data).as_string());
}
/* Finish parsing and add it to the vector */
pb_type_annotations.push_back(pb_type_annotation);
}