[lib] update API for bitstream setting default mode overwrite

This commit is contained in:
tangxifan 2024-11-25 11:20:47 -08:00
parent a10c683591
commit 94005fea99
2 changed files with 54 additions and 0 deletions

View File

@ -18,6 +18,12 @@ BitstreamSetting::pb_type_settings() const {
pb_type_setting_ids_.end()); pb_type_setting_ids_.end());
} }
BitstreamSetting::bitstream_default_mode_setting_range
BitstreamSetting::default_mode_settings() const {
return vtr::make_range(default_mode_setting_ids_.begin(),
default_mode_setting_ids_.end());
}
BitstreamSetting::bitstream_interconnect_setting_range BitstreamSetting::bitstream_interconnect_setting_range
BitstreamSetting::interconnect_settings() const { BitstreamSetting::interconnect_settings() const {
return vtr::make_range(interconnect_setting_ids_.begin(), return vtr::make_range(interconnect_setting_ids_.begin(),
@ -80,6 +86,30 @@ size_t BitstreamSetting::bitstream_offset(
return bitstream_offsets_[pb_type_setting_id]; return bitstream_offsets_[pb_type_setting_id];
} }
std::string BitstreamSetting::default_mode_pb_type_name(
const BitstreamDefaultModeSettingId& default_mode_setting_id) const {
VTR_ASSERT(true == valid_bitstream_default_mode_setting_id(default_mode_setting_id));
return default_mode_pb_type_names_[default_mode_setting_id];
}
std::vector<std::string> BitstreamSetting::default_mode_parent_pb_type_names(
const BitstreamDefaultModeSettingId& default_mode_setting_id) const {
VTR_ASSERT(true == valid_bitstream_default_mode_setting_id(default_mode_setting_id));
return default_mode_parent_pb_type_names_[default_mode_setting_id];
}
std::vector<std::string> BitstreamSetting::default_mode_parent_mode_names(
const BitstreamDefaultModeSettingId& default_mode_setting_id) const {
VTR_ASSERT(true == valid_bitstream_default_mode_setting_id(default_mode_setting_id));
return default_mode_parent_mode_names_[default_mode_setting_id];
}
std::string BitstreamSetting::default_mode_bits(
const BitstreamDefaultModeSettingId& default_mode_setting_id) const {
VTR_ASSERT(true == valid_bitstream_default_mode_setting_id(default_mode_setting_id));
return pb_type_default_mode_bits_[default_mode_setting_id];
}
std::string BitstreamSetting::interconnect_name( std::string BitstreamSetting::interconnect_name(
const BitstreamInterconnectSettingId& interconnect_setting_id) const { const BitstreamInterconnectSettingId& interconnect_setting_id) const {
VTR_ASSERT(true == VTR_ASSERT(true ==
@ -159,6 +189,22 @@ void BitstreamSetting::set_bitstream_offset(
bitstream_offsets_[pb_type_setting_id] = offset; bitstream_offsets_[pb_type_setting_id] = offset;
} }
BitstreamDefaultModeSettingId BitstreamSetting::add_bitstream_default_mode_setting(
const std::string& pb_type_name,
const std::vector<std::string>& parent_pb_type_names,
const std::vector<std::string>& parent_mode_names,
const std::string& mode_bits) {
BitstreamDefaultModeSettingId default_mode_setting_id =
BitstreamDefaultModeSettingId(default_mode_setting_ids_.size());
default_mode_setting_ids_.push_back(default_mode_setting_id);
default_mode_pb_type_names_.push_back(pb_type_name);
default_mode_parent_pb_type_names_.push_back(parent_pb_type_names);
default_mode_parent_mode_names_.push_back(parent_mode_names);
pb_type_default_mode_bits_.push_back(mode_bits);
return default_mode_setting_id;
}
BitstreamInterconnectSettingId BitstreamInterconnectSettingId
BitstreamSetting::add_bitstream_interconnect_setting( BitstreamSetting::add_bitstream_interconnect_setting(
const std::string& interconnect_name, const std::string& interconnect_name,
@ -220,6 +266,12 @@ bool BitstreamSetting::valid_bitstream_pb_type_setting_id(
(pb_type_setting_id == pb_type_setting_ids_[pb_type_setting_id]); (pb_type_setting_id == pb_type_setting_ids_[pb_type_setting_id]);
} }
bool BitstreamSetting::valid_bitstream_default_mode_setting_id(
const BitstreamDefaultModeSettingId& default_mode_setting_id) const {
return (size_t(default_mode_setting_id) < default_mode_setting_ids_.size()) &&
(default_mode_setting_id == default_mode_setting_ids_[default_mode_setting_id]);
}
bool BitstreamSetting::valid_bitstream_interconnect_setting_id( bool BitstreamSetting::valid_bitstream_interconnect_setting_id(
const BitstreamInterconnectSettingId& interconnect_setting_id) const { const BitstreamInterconnectSettingId& interconnect_setting_id) const {
return (size_t(interconnect_setting_id) < interconnect_setting_ids_.size()) && return (size_t(interconnect_setting_id) < interconnect_setting_ids_.size()) &&

View File

@ -157,6 +157,8 @@ class BitstreamSetting {
public: /* Public Validators */ public: /* Public Validators */
bool valid_bitstream_pb_type_setting_id( bool valid_bitstream_pb_type_setting_id(
const BitstreamPbTypeSettingId& pb_type_setting_id) const; const BitstreamPbTypeSettingId& pb_type_setting_id) const;
bool valid_bitstream_default_mode_setting_id(
const BitstreamDefaultModeSettingId& default_mode_setting_id) const;
bool valid_bitstream_interconnect_setting_id( bool valid_bitstream_interconnect_setting_id(
const BitstreamInterconnectSettingId& interconnect_setting_id) const; const BitstreamInterconnectSettingId& interconnect_setting_id) const;
bool valid_overwrite_bitstream_id(const OverwriteBitstreamId& id) const; bool valid_overwrite_bitstream_id(const OverwriteBitstreamId& id) const;